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 21TypedefUnion tdu; 22TypedefEnum tde; 23TypedefStruct tds; 24 25int foo(ObjCClass *c) { 26 InnerEnum e = e0; 27 GlobalStruct.i = GlobalUnion.i = GlobalEnum; 28 [c instanceMethodWithInt: 0]; 29 return [c property]; 30} 31 32// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, 33// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "ObjCClass", 34// CHECK-SAME: scope: ![[MOD:[0-9]+]], 35// CHECK-SAME: flags: DIFlagFwdDecl) 36// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, 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]] = !DICompositeType(tag: DW_TAG_union_type, 42// CHECK-SAME: elements: !{{[0-9]+}}) 43// CHECK: !DIGlobalVariable(name: "GlobalStruct", 44// CHECK-SAME: type: ![[GLOBAL_STRUCT:[0-9]+]] 45// CHECK: ![[GLOBAL_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, 46// CHECK-SAME: elements: !{{[0-9]+}}) 47 48// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefUnion", 49// CHECK-SAME: baseType: ![[TD_UNION:.*]]) 50// CHECK: ![[TD_UNION]] = !DICompositeType(tag: DW_TAG_union_type, 51// CHECK-SAME: flags: DIFlagFwdDecl) 52// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefEnum", 53// CHECK-SAME: baseType: ![[TD_ENUM:.*]]) 54// CHECK: ![[TD_ENUM]] = !DICompositeType(tag: DW_TAG_enumeration_type, 55// CHECK-SAME: flags: DIFlagFwdDecl) 56// CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefStruct", 57// CHECK-SAME: baseType: ![[TD_STRUCT:.*]]) 58// CHECK: ![[TD_STRUCT]] = !DICompositeType(tag: DW_TAG_structure_type, 59// CHECK-SAME: flags: DIFlagFwdDecl) 60 61// CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, 62// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 63// CHECK-SAME: scope: ![[MOD]], 64// CHECK-SAME: flags: DIFlagFwdDecl) 65