1 // UNSUPPORTED: -zos, -aix
3 // RUN: split-file %s %t
4 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test.m \
5 // RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
6 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -F%t/Frameworks %t/test-functions.m \
7 // RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
9 // Test a case when Objective-C interface ivars are present in two different modules.
11 //--- Frameworks/Foundation.framework/Headers/Foundation.h
15 //--- Frameworks/Foundation.framework/Modules/module.modulemap
16 framework module Foundation {
21 //--- Frameworks/ObjCInterface.framework/Headers/ObjCInterface.h
22 #import <Foundation/Foundation.h>
23 @interface ObjCInterface : NSObject {
29 @interface WithBitFields : NSObject {
36 //--- Frameworks/ObjCInterface.framework/Modules/module.modulemap
37 framework module ObjCInterface {
38 header "ObjCInterface.h"
42 //--- Frameworks/ObjCInterfaceCopy.framework/Headers/ObjCInterfaceCopy.h
43 #import <Foundation/Foundation.h>
44 @interface ObjCInterface : NSObject {
50 @interface WithBitFields : NSObject {
57 // Inlined function present only in Copy.framework to make sure it uses decls from Copy module.
58 __attribute__((always_inline)) void inlinedIVarAccessor(ObjCInterface *obj, WithBitFields *bitFields) {
63 //--- Frameworks/ObjCInterfaceCopy.framework/Modules/module.modulemap
64 framework module ObjCInterfaceCopy {
65 header "ObjCInterfaceCopy.h"
70 #import <ObjCInterface/ObjCInterface.h>
71 #import <ObjCInterfaceCopy/ObjCInterfaceCopy.h>
73 @implementation ObjCInterface
74 - (void)test:(id)item {
79 @implementation WithBitFields
86 //--- test-functions.m
87 #import <ObjCInterface/ObjCInterface.h>
89 void testAccessIVar(ObjCInterface *obj, id item) {
92 void testAccessBitField(WithBitFields *obj) {
96 #import <ObjCInterfaceCopy/ObjCInterfaceCopy.h>
98 void testAccessIVarLater(ObjCInterface *obj, id item) {
101 void testAccessBitFieldLater(WithBitFields *obj) {
104 void testInlinedFunction(ObjCInterface *obj, WithBitFields *bitFields) {
105 inlinedIVarAccessor(obj, bitFields);