| 1 |
// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}} |
| 2 |
// RUN: rm -rf %t |
| 3 |
// Test that only forward declarations are emitted for types defined in modules. |
| 4 |
|
| 5 |
// Modules: |
| 6 |
// RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs -fmodules \ |
| 7 |
// RUN: -fmodule-format=obj -fimplicit-module-maps -DMODULES \ |
| 8 |
// RUN: -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t-mod.ll |
| 9 |
// RUN: cat %t-mod.ll | FileCheck %s |
| 10 |
// RUN: cat %t-mod.ll | FileCheck %s --check-prefix=DWOID |
| 11 |
|
| 12 |
// PCH: |
| 13 |
// RUN: %clang_cc1 -x objective-c -fmodule-format=obj -emit-pch -I%S/Inputs \ |
| 14 |
// RUN: -o %t.pch %S/Inputs/DebugObjC.h |
| 15 |
// RUN: %clang_cc1 -x objective-c -debug-info-kind=limited -dwarf-ext-refs \ |
| 16 |
// RUN: -fmodule-format=obj \ |
| 17 |
// RUN: -include-pch %t.pch %s -emit-llvm -o %t-pch.ll %s |
| 18 |
// RUN: cat %t-pch.ll | FileCheck %s |
| 19 |
// RUN: cat %t-pch.ll | FileCheck %s --check-prefix=DWOID |
| 20 |
|
| 21 |
#ifdef MODULES |
| 22 |
@import DebugObjC; |
| 23 |
#endif |
| 24 |
|
| 25 |
@implementation ObjCClassWithPrivateIVars { |
| 26 |
int hidden_ivar; |
| 27 |
} |
| 28 |
@end |
| 29 |
|
| 30 |
TypedefUnion tdu; |
| 31 |
TypedefEnum tde; |
| 32 |
TypedefStruct tds; |
| 33 |
|
| 34 |
int foo(ObjCClass *c) { |
| 35 |
InnerEnum e = e0; |
| 36 |
GlobalStruct.i = GlobalUnion.i = GlobalEnum; |
| 37 |
[c instanceMethodWithInt: 0]; |
| 38 |
return [c property]; |
| 39 |
} |
| 40 |
|
| 41 |
// DWOID: !DICompileUnit(language: DW_LANG_ObjC,{{.*}}isOptimized: false,{{.*}}dwoId: |
| 42 |
|
| 43 |
// CHECK: ![[MOD:.*]] = !DIModule(scope: null, name: "DebugObjC |
| 44 |
|
| 45 |
// CHECK: !DIGlobalVariable(name: "GlobalUnion", |
| 46 |
// CHECK-SAME: type: ![[GLOBAL_UNION:[0-9]+]] |
| 47 |
// CHECK: ![[GLOBAL_UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type, |
| 48 |
// CHECK-SAME: elements: !{{[0-9]+}}) |
| 49 |
|
| 50 |
// CHECK: !DIGlobalVariable(name: "GlobalStruct", |
| 51 |
// CHECK-SAME: type: ![[GLOBAL_STRUCT:[0-9]+]] |
| 52 |
// CHECK: ![[GLOBAL_STRUCT]] = distinct !DICompositeType(tag: DW_TAG_structure_type, |
| 53 |
// CHECK-SAME: elements: !{{[0-9]+}}) |
| 54 |
|
| 55 |
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClassWithPrivateIVars", |
| 56 |
// CHECK-SAME: flags: DIFlagObjcClassComplete |
| 57 |
|
| 58 |
// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "hidden_ivar", |
| 59 |
// CHECK-SAME: flags: DIFlagPrivate) |
| 60 |
|
| 61 |
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum", |
| 62 |
// CHECK-SAME: baseType: ![[TD_ENUM:.*]]) |
| 63 |
// CHECK: ![[TD_ENUM]] = !DICompositeType(tag: DW_TAG_enumeration_type, |
| 64 |
// CHECK-SAME: flags: DIFlagFwdDecl) |
| 65 |
|
| 66 |
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct", |
| 67 |
// CHECK-SAME: baseType: ![[TD_STRUCT:.*]]) |
| 68 |
// CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, |
| 69 |
// CHECK-SAME: flags: DIFlagFwdDecl) |
| 70 |
|
| 71 |
// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion", |
| 72 |
// CHECK-SAME: baseType: ![[TD_UNION:.*]]) |
| 73 |
// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type, |
| 74 |
// CHECK-SAME: flags: DIFlagFwdDecl) |
| 75 |
|
| 76 |
// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", |
| 77 |
// CHECK-SAME: scope: ![[MOD]], |
| 78 |
// CHECK-SAME: flags: DIFlagFwdDecl, |
| 79 |
// CHECK-SAME: runtimeLang: DW_LANG_ObjC) |
| 80 |
|
| 81 |
// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, |
| 82 |
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, |
| 83 |
// CHECK-SAME: scope: ![[MOD]], |
| 84 |
// CHECK-SAME: flags: DIFlagFwdDecl) |