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