1 // UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
3 // RUN: split-file %s %t
4 // RUN: %clang_cc1 -fsyntax-only -F%t/Frameworks %t/test.m -Wno-objc-property-implementation -Wno-incomplete-implementation \
5 // RUN: -fmodules -fmodule-name=Target -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
7 // RUN: %clang_cc1 -fsyntax-only -F%t/Frameworks -x objective-c++ %t/test.m -Wno-objc-property-implementation -Wno-incomplete-implementation \
8 // RUN: -fmodules -fmodule-name=Target -fimplicit-module-maps -fmodules-cache-path=%t/modules.cache
10 // Test anonymous TagDecl inside Objective-C interfaces are merged and ivars with these anonymous types are merged too.
12 //--- Frameworks/Foundation.framework/Headers/Foundation.h
16 //--- Frameworks/Foundation.framework/Modules/module.modulemap
17 framework module Foundation {
22 //--- Frameworks/Target.framework/Headers/Target.h
23 #import <Foundation/Foundation.h>
24 @interface TestClass : NSObject {
27 struct { int x; int y; } left;
28 struct { int w; int z; } right;
30 union { int x; float y; } *unionIvar;
31 enum { kX = 0, } enumIvar;
33 @property struct { int u; } prop;
35 - (struct { int v; })method;
39 @interface TestClass() {
41 struct { int y; } extensionIvar;
45 @implementation TestClass {
47 struct { int z; } implementationIvar;
51 //--- Frameworks/Target.framework/Modules/module.modulemap
52 framework module Target {
57 //--- Frameworks/Redirect.framework/Headers/Redirect.h
58 #import <Target/Target.h>
60 //--- Frameworks/Redirect.framework/Modules/module.modulemap
61 framework module Redirect {
67 // At first import everything as non-modular.
68 #import <Target/Target.h>
69 // And now as modular to merge same entities obtained through different sources.
70 #import <Redirect/Redirect.h>
71 // Non-modular import is achieved through using the same name (-fmodule-name) as the imported framework module.
73 void test(TestClass *obj) {
74 obj->structIvar.left.x = 0;
75 obj->unionIvar->y = 1.0f;
79 tmp += [obj method].v;
82 obj->extensionIvar.y = 0;
83 obj->implementationIvar.z = 0;