|
| 1 | +// RUN: rm -rf %t |
| 2 | +// RUN: split-file %s %t |
| 3 | +// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -DHIDDEN_FIRST=1 \ |
| 4 | +// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache |
| 5 | +// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -DHIDDEN_FIRST=0 \ |
| 6 | +// RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache |
| 7 | + |
| 8 | +// Test a case when Objective-C interface is imported both as hidden and as visible. |
| 9 | + |
| 10 | +//--- Frameworks/Foundation.framework/Headers/Foundation.h |
| 11 | +@interface NSObject |
| 12 | +@end |
| 13 | + |
| 14 | +//--- Frameworks/Foundation.framework/Modules/module.modulemap |
| 15 | +framework module Foundation { |
| 16 | + header "Foundation.h" |
| 17 | + export * |
| 18 | +} |
| 19 | + |
| 20 | +//--- Frameworks/Regular.framework/Headers/Regular.h |
| 21 | +#import <Foundation/Foundation.h> |
| 22 | +@interface Regular : NSObject |
| 23 | +@end |
| 24 | + |
| 25 | +//--- Frameworks/Regular.framework/Modules/module.modulemap |
| 26 | +framework module Regular { |
| 27 | + header "Regular.h" |
| 28 | + export * |
| 29 | +} |
| 30 | + |
| 31 | +//--- Frameworks/RegularHider.framework/Headers/Visible.h |
| 32 | +// Empty, file required to create a module. |
| 33 | + |
| 34 | +//--- Frameworks/RegularHider.framework/Headers/Hidden.h |
| 35 | +#import <Foundation/Foundation.h> |
| 36 | +@interface Regular : NSObject |
| 37 | +@end |
| 38 | + |
| 39 | +//--- Frameworks/RegularHider.framework/Modules/module.modulemap |
| 40 | +framework module RegularHider { |
| 41 | + header "Visible.h" |
| 42 | + export * |
| 43 | + |
| 44 | + explicit module Hidden { |
| 45 | + header "Hidden.h" |
| 46 | + export * |
| 47 | + } |
| 48 | +} |
| 49 | + |
| 50 | +//--- test.m |
| 51 | + |
| 52 | +#if HIDDEN_FIRST |
| 53 | +#import <RegularHider/Visible.h> |
| 54 | +#import <Regular/Regular.h> |
| 55 | +#else |
| 56 | +#import <Regular/Regular.h> |
| 57 | +#import <RegularHider/Visible.h> |
| 58 | +#endif |
| 59 | + |
| 60 | +@interface SubClass : Regular |
| 61 | +@end |
0 commit comments