1 // Test that (the same) debug info is emitted for an Objective-C++ 2 // module and a C++ precompiled header. 3 4 // REQUIRES: asserts 5 6 // Modules: 7 // RUN: rm -rf %t 8 // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll 9 // RUN: cat %t-mod.ll | FileCheck %s 10 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s 11 12 // PCH: 13 // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll 14 // RUN: cat %t-pch.ll | FileCheck %s 15 // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s 16 17 #ifdef MODULES 18 @import DebugCXX; 19 #endif 20 21 // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, 22 // CHECK-SAME: isOptimized: false, 23 // CHECK-NOT: splitDebugFilename: 24 // CHECK-SAME: dwoId: 25 26 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum" 27 // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") 28 // CHECK: !DINamespace(name: "DebugCXX" 29 30 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 31 // CHECK-NOT: name: 32 // CHECK-SAME: ) 33 34 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 35 // CHECK-NOT: name: 36 // CHECK-SAME: ) 37 38 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 39 // CHECK-NOT: name: 40 // CHECK-SAME: identifier: "_ZTS11TypedefEnum") 41 42 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 43 // CHECK-NOT: name: 44 // CHECK-SAME: ) 45 // CHECK: !DIEnumerator(name: "e5", value: 5) 46 47 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B", 48 // no mangled name here yet. 49 50 // This type is anchored by a function parameter. 51 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>" 52 // CHECK-SAME: elements: 53 // CHECK-SAME: templateParams: 54 // CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE") 55 56 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct" 57 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE") 58 59 // This type is anchored by an explicit template instantiation. 60 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 61 // CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >" 62 // CHECK-SAME: elements: 63 // CHECK-SAME: templateParams: 64 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE") 65 66 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "traits<int>" 67 // CHECK-SAME: flags: DIFlagFwdDecl 68 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6traitsIiEE") 69 70 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "traits<float>" 71 // CHECK-SAME: elements: 72 // CHECK-SAME: templateParams: 73 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6traitsIfEE") 74 75 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 76 // CHECK-SAME: name: "Template<long, DebugCXX::traits<long> >" 77 // CHECK-SAME: elements: 78 // CHECK-SAME: templateParams: 79 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIlEEEE") 80 81 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstantiation" 82 // no mangled name here yet. 83 84 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 85 // CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >" 86 // CHECK-SAME: flags: DIFlagFwdDecl 87 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE") 88 89 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdVirtual" 90 // CHECK-SAME: elements: 91 // CHECK-SAME: identifier: "_ZTS10FwdVirtual") 92 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$FwdVirtual" 93 94 // CHECK: !DICompositeType(tag: DW_TAG_union_type, 95 // CHECK-NOT: name: 96 // CHECK-SAME: identifier: "_ZTS12TypedefUnion") 97 98 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 99 // CHECK-NOT: name: 100 // CHECK-SAME: identifier: "_ZTS13TypedefStruct") 101 102 // CHECK: !DICompositeType(tag: DW_TAG_union_type, 103 // CHECK-NOT: name: 104 // CHECK-SAME: ) 105 106 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 107 // CHECK-NOT: name: 108 // CHECK-SAME: ) 109 110 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 111 // CHECK-SAME: name: "InAnonymousNamespace", 112 // CHECK-SAME: elements: !{{[0-9]+}}) 113 114 // CHECK: ![[DERIVED:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "Derived", 115 // CHECK-SAME: identifier: "_ZTS7Derived") 116 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: ![[DERIVED]], 117 // CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder: 118 // CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]} 119 // CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent" 120 121 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefTemplate", 122 // CHECK-SAME: baseType: ![[BASE:.*]]) 123 // CHECK: ![[BASE]] = !DICompositeType(tag: DW_TAG_class_type, 124 // CHECK-SAME: name: "Template1<void *>", 125 // CHECK-SAME: flags: DIFlagFwdDecl, 126 // CHECK-SAME: identifier: "_ZTS9Template1IPvE") 127 128 // Explicit instantiation. 129 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1<int>", 130 // CHECK-SAME: templateParams: 131 // CHECK-SAME: identifier: "_ZTS9Template1IiE") 132 133 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdDeclTemplate<int>", 134 // CHECK-SAME: flags: DIFlagFwdDecl 135 // CHECK-SAME: identifier: "_ZTS15FwdDeclTemplateIiE") 136 137 // Forward-declared member of a template. 138 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member", 139 // CHECK-SAME: flags: DIFlagFwdDecl 140 // CHECK-SAME: identifier: "_ZTSN21FwdDeclTemplateMemberIiE6MemberE") 141 142 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "SpecializedBase", 143 // CHECK-SAME: baseType: ![[SPECIALIZEDBASE:.*]]) 144 // CHECK: ![[SPECIALIZEDBASE]] = !DICompositeType(tag: DW_TAG_class_type, 145 // CHECK-SAME: name: "WithSpecializedBase<float>", 146 // CHECK-SAME: flags: DIFlagFwdDecl, 147 148 // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl" 149