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 -debugger-tuning=lldb -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 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-MOD %s 12 13 // PCH: 14 // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -debugger-tuning=lldb -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll 15 // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-CXX %s 16 // RUN: cat %t-pch.ll | FileCheck --check-prefix=CHECK-NEG %s 17 18 #ifdef MODULES 19 @import DebugCXX; 20 #endif 21 22 // CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, 23 // CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, 24 25 // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, 26 // CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11, 27 // CHECK-SAME: isOptimized: false, 28 // CHECK-NOT: splitDebugFilename: 29 // CHECK-SAME: dwoId: 30 31 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum" 32 // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") 33 // CHECK: !DINamespace(name: "DebugCXX" 34 35 // CHECK-MOD: ![[DEBUGCXX:.*]] = !DIModule(scope: null, name: "DebugCXX 36 37 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 38 // CHECK-NOT: name: 39 // CHECK-SAME: ) 40 41 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 42 // CHECK-NOT: name: 43 // CHECK-SAME: ) 44 45 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 46 // CHECK-NOT: name: 47 // CHECK-SAME: identifier: "_ZTS11TypedefEnum") 48 49 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, 50 // CHECK-NOT: name: 51 // CHECK-SAME: ) 52 // CHECK: !DIEnumerator(name: "e5", value: 5, isUnsigned: true) 53 54 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Struct" 55 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6StructE") 56 57 // This type is anchored by an explicit template instantiation. 58 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 59 // CHECK-SAME: name: "Template<int, DebugCXX::traits<int> >" 60 // CHECK-SAME: elements: 61 // CHECK-SAME: templateParams: 62 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIiNS_6traitsIiEEEE") 63 64 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "traits<int>" 65 // CHECK-SAME: flags: DIFlagFwdDecl 66 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6traitsIiEE") 67 68 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "traits<float>" 69 // CHECK-SAME: elements: 70 // CHECK-SAME: templateParams: 71 // CHECK-SAME: identifier: "_ZTSN8DebugCXX6traitsIfEE") 72 73 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 74 // CHECK-SAME: name: "Template<long, DebugCXX::traits<long> >" 75 // CHECK-SAME: elements: 76 // CHECK-SAME: templateParams: 77 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIlNS_6traitsIlEEEE") 78 79 // This type is anchored by a function parameter. 80 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A<void>" 81 // CHECK-SAME: elements: 82 // CHECK-SAME: templateParams: 83 // CHECK-SAME: identifier: "_ZTSN8DebugCXX1AIJvEEE") 84 85 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "FloatInstantiation" 86 // no mangled name here yet. 87 88 // CHECK: !DICompositeType(tag: DW_TAG_class_type, 89 // CHECK-SAME: name: "Template<float, DebugCXX::traits<float> >" 90 // CHECK-SAME: flags: DIFlagFwdDecl 91 // CHECK-SAME: identifier: "_ZTSN8DebugCXX8TemplateIfNS_6traitsIfEEEE") 92 93 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "B", 94 // no mangled name here yet. 95 96 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Virtual" 97 // CHECK-SAME: elements: 98 // CHECK-SAME: identifier: "_ZTS7Virtual") 99 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$Virtual" 100 101 // CHECK: !DICompositeType(tag: DW_TAG_union_type, 102 // CHECK-NOT: name: 103 // CHECK-SAME: identifier: "_ZTS12TypedefUnion") 104 105 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 106 // CHECK-NOT: name: 107 // CHECK-SAME: identifier: "_ZTS13TypedefStruct") 108 109 // CHECK: !DICompositeType(tag: DW_TAG_union_type, 110 // CHECK-NOT: name: 111 // CHECK-SAME: ) 112 113 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 114 // CHECK-NOT: name: 115 // CHECK-SAME: ) 116 117 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, 118 // CHECK-SAME: name: "InAnonymousNamespace", 119 // CHECK-SAME: elements: !{{[0-9]+}}) 120 121 // CHECK: ![[A:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "A", 122 // CHECK-SAME: elements: 123 // CHECK-SAME: vtableHolder: ![[A]]) 124 125 // CHECK: ![[DERIVED:.*]] = {{.*}}!DICompositeType(tag: DW_TAG_class_type, name: "Derived", 126 // CHECK-SAME: identifier: "_ZTS7Derived") 127 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "B", scope: ![[DERIVED]], 128 // CHECK-SAME: elements: ![[B_MBRS:.*]], vtableHolder: 129 // CHECK: ![[B_MBRS]] = !{{{.*}}, ![[GET_PARENT:.*]]} 130 // CHECK: ![[GET_PARENT]] = !DISubprogram(name: "getParent" 131 132 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "TypedefTemplate", 133 // CHECK-SAME: baseType: ![[BASE:.*]]) 134 // CHECK: ![[BASE]] = !DICompositeType(tag: DW_TAG_class_type, 135 // CHECK-SAME: name: "Template1<void *>", 136 // CHECK-SAME: flags: DIFlagFwdDecl 137 // CHECK-SAME: identifier: "_ZTS9Template1IPvE") 138 139 // Explicit instantiation. 140 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "Template1<int>", 141 // CHECK-SAME: templateParams: 142 // CHECK-SAME: identifier: "_ZTS9Template1IiE") 143 144 // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "FwdDeclTemplate<int>", 145 // CHECK-SAME: flags: DIFlagFwdDecl 146 // CHECK-SAME: identifier: "_ZTS15FwdDeclTemplateIiE") 147 148 // Forward-declared member of a template. 149 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Member", 150 // CHECK-SAME: flags: DIFlagFwdDecl 151 // CHECK-SAME: identifier: "_ZTSN21FwdDeclTemplateMemberIiE6MemberE") 152 153 // CHECK: !DIDerivedType(tag: DW_TAG_typedef, name: "SpecializedBase", 154 // CHECK-SAME: baseType: ![[SPECIALIZEDBASE:.*]]) 155 // CHECK: ![[SPECIALIZEDBASE]] = !DICompositeType(tag: DW_TAG_class_type, 156 // CHECK-SAME: name: "WithSpecializedBase<float>", 157 // CHECK-SAME: flags: DIFlagFwdDecl 158 159 // CHECK-MOD: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[DEBUGCXX]], 160 // CHECK-MOD-SAME: entity: ![[DUMMY:[0-9]+]], 161 // CHECK-MOD-SAME: line: 3) 162 // CHECK-MOD: ![[DUMMY]] = !DIModule(scope: null, name: "dummy", 163 // CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_ObjC_plus_plus, 164 // CHECK-MOD-SAME: splitDebugFilename: "{{.*}}dummy{{.*}}.pcm", 165 166 // CHECK-NEG-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "PureForwardDecl" 167