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