brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 074c3b1 Raw
78 lines · plain
1// UNSUPPORTED: target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}}2// RUN: rm -rf %t3// RUN: split-file %s %t4// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -Werror=objc-method-access -DHIDDEN_FIRST=1 \5// RUN:            -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache6// RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m -Werror=objc-method-access -DHIDDEN_FIRST=0 \7// RUN:            -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache8 9// Test a case when Objective-C protocol is imported both as hidden and as visible.10 11//--- Frameworks/Foundation.framework/Headers/Foundation.h12@interface NSObject13@end14 15//--- Frameworks/Foundation.framework/Modules/module.modulemap16framework module Foundation {17  header "Foundation.h"18  export *19}20 21//--- Frameworks/Common.framework/Headers/Common.h22#import <Foundation/Foundation.h>23@protocol Testing;24@interface Common : NSObject25- (id<Testing>)getProtocolObj;26@end27 28//--- Frameworks/Common.framework/Modules/module.modulemap29framework module Common {30  header "Common.h"31  export *32}33 34//--- Frameworks/Regular.framework/Headers/Regular.h35@protocol Testing36- (void)protocolMethod;37@end38 39//--- Frameworks/Regular.framework/Modules/module.modulemap40framework module Regular {41  header "Regular.h"42  export *43}44 45//--- Frameworks/RegularHider.framework/Headers/Visible.h46// Empty, file required to create a module.47 48//--- Frameworks/RegularHider.framework/Headers/Hidden.h49@protocol Testing50- (void)protocolMethod;51@end52 53//--- Frameworks/RegularHider.framework/Modules/module.modulemap54framework module RegularHider {55  header "Visible.h"56  export *57 58  explicit module Hidden {59    header "Hidden.h"60    export *61  }62}63 64//--- test.m65#import <Common/Common.h>66 67#if HIDDEN_FIRST68#import <RegularHider/Visible.h>69#import <Regular/Regular.h>70#else71#import <Regular/Regular.h>72#import <RegularHider/Visible.h>73#endif74 75void test(Common *obj) {76  [[obj getProtocolObj] protocolMethod];77}78