brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · da1601b Raw
85 lines · plain
1// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}2// RUN: rm -rf %t3// RUN: split-file %s %t4// 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.cache6 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.cache9 10// Test anonymous TagDecl inside Objective-C interfaces are merged and ivars with these anonymous types are merged too.11 12//--- Frameworks/Foundation.framework/Headers/Foundation.h13@interface NSObject14@end15 16//--- Frameworks/Foundation.framework/Modules/module.modulemap17framework module Foundation {18  header "Foundation.h"19  export *20}21 22//--- Frameworks/Target.framework/Headers/Target.h23#import <Foundation/Foundation.h>24@interface TestClass : NSObject {25@public26  struct {27    struct { int x; int y; } left;28    struct { int w; int z; } right;29  } structIvar;30  union { int x; float y; } *unionIvar;31  enum { kX = 0, } enumIvar;32}33@property struct { int u; } prop;34#ifndef __cplusplus35- (struct { int v; })method;36#endif37@end38 39@interface TestClass() {40@public41  struct { int y; } extensionIvar;42}43@end44 45@implementation TestClass {46@public47  struct { int z; } implementationIvar;48}49@end50 51//--- Frameworks/Target.framework/Modules/module.modulemap52framework module Target {53  header "Target.h"54  export *55}56 57//--- Frameworks/Redirect.framework/Headers/Redirect.h58#import <Target/Target.h>59 60//--- Frameworks/Redirect.framework/Modules/module.modulemap61framework module Redirect {62  header "Redirect.h"63  export *64}65 66//--- test.m67// 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.72 73void test(TestClass *obj) {74  obj->structIvar.left.x = 0;75  obj->unionIvar->y = 1.0f;76  obj->enumIvar = kX;77  int tmp = obj.prop.u;78#ifndef __cplusplus79  tmp += [obj method].v;80#endif81 82  obj->extensionIvar.y = 0;83  obj->implementationIvar.z = 0;84}85