1// XFAIL: target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}} 2// RUN: rm -rf %t 3// RUN: split-file %s %t 4// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -I %t/include %t/test.m -verify \ 5// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache 6// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -I %t/include %t/test.m -verify -DTEST_MAKE_HIDDEN_VISIBLE=1 \ 7// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache 8// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -I %t/include %t/test.m -verify -x objective-c++ \ 9// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache 10// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -I %t/include %t/test.m -verify -DTEST_MAKE_HIDDEN_VISIBLE=1 -x objective-c++ \ 11// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache 12 13// Test parsing duplicate Objective-C entities when a previous entity is defined 14// in a hidden [sub]module and cannot be used. 15// 16// Testing with header guards and includes on purpose as tracking imports in 17// modules is a separate issue. 18 19//--- include/textual.h 20#ifndef TEXTUAL_H 21#define TEXTUAL_H 22 23@protocol TestProtocol 24- (void)someMethod; 25@end 26 27@protocol ForwardDeclaredProtocolWithoutDefinition; 28 29id<TestProtocol> protocolDefinition(id<TestProtocol> t); 30id<ForwardDeclaredProtocolWithoutDefinition> forwardDeclaredProtocol( 31 id<ForwardDeclaredProtocolWithoutDefinition> t); 32 33@interface NSObject @end 34@class ForwardDeclaredInterfaceWithoutDefinition; 35@interface NSObject(CategoryForTesting) @end 36 37NSObject *interfaceDefinition(NSObject *o); 38NSObject *forwardDeclaredInterface(NSObject *o); 39 40#endif 41 42//--- include/empty.h 43//--- include/initially_hidden.h 44#include "textual.h" 45 46//--- include/module.modulemap 47module Piecewise { 48 module Empty { 49 header "empty.h" 50 } 51 module InitiallyHidden { 52 header "initially_hidden.h" 53 export * 54 } 55} 56 57//--- test.m 58// Including empty.h loads the entire module Piecewise but keeps InitiallyHidden hidden. 59#include "empty.h" 60#include "textual.h" 61#ifdef TEST_MAKE_HIDDEN_VISIBLE 62#include "initially_hidden.h" 63#endif 64// expected-no-diagnostics 65