From: Duncan P. N. Exon Smith Date: Sat, 23 Apr 2016 21:08:27 +0000 (+0000) Subject: DebugInfo: Adapt to loss of DITypeRef in LLVM r267296 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a0e8aa964fd08a1ca5b43e5d1db7dfe41892460;p=clang DebugInfo: Adapt to loss of DITypeRef in LLVM r267296 LLVM stopped using MDString-based type references, and DIBuilder no longer fills 'retainedTypes:' with every DICompositeType that has an 'identifier:' field. There are just minor changes to keep the same behaviour in CFE. Leaving 'retainedTypes:' unfilled has a dramatic impact on the output order of the IR though. There are a huge number of testcase changes, which were unfortunately not really scriptable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267297 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 9e8abdc2f5..70a5f619aa 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1451,11 +1451,6 @@ llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D, llvm::DIType *T = getOrCreateType(D, getOrCreateFile(Loc)); assert(T && "could not create debug info for type"); - // Composite types with UIDs were already retained by DIBuilder - // because they are only referenced by name in the IR. - if (auto *CTy = dyn_cast(T)) - if (!CTy->getIdentifier().empty()) - return T; RetainedTypes.push_back(D.getAsOpaquePtr()); return T; } @@ -3435,6 +3430,9 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, auto *RD = cast(VarD->getDeclContext()); getDeclContextDescriptor(VarD); // Ensure that the type is retained even though it's otherwise unreferenced. + // + // FIXME: This is probably unnecessary, since Ty should reference RD + // through its scope. RetainedTypes.push_back( CGM.getContext().getRecordType(RD).getAsOpaquePtr()); return; diff --git a/test/CodeGen/debug-info-imported-entity.cpp b/test/CodeGen/debug-info-imported-entity.cpp index a9a0408ac4..105cc3dc53 100644 --- a/test/CodeGen/debug-info-imported-entity.cpp +++ b/test/CodeGen/debug-info-imported-entity.cpp @@ -6,5 +6,6 @@ using std::A; using ::A; // CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]]) // CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]} -// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: !"_ZTSSt1A", line: 4) +// CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], line: 4) +// CHECK: [[STDA]] = !DICompositeType(tag: DW_TAG_class_type, name: "A", diff --git a/test/CodeGenCXX/debug-info-access.cpp b/test/CodeGenCXX/debug-info-access.cpp index 1699bab961..41b7f71fce 100644 --- a/test/CodeGenCXX/debug-info-access.cpp +++ b/test/CodeGenCXX/debug-info-access.cpp @@ -1,13 +1,16 @@ // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple %itanium_abi_triple %s -o - | FileCheck %s // Test the various accessibility flags in the debug info. struct A { + // CHECK: ![[A:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", + // CHECK-DAG: !DISubprogram(name: "pub_default",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagPrototyped, void pub_default(); // CHECK-DAG: !DIDerivedType(tag: DW_TAG_member, name: "pub_default_static",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagStaticMember) static int pub_default_static; }; -// CHECK: !DIDerivedType(tag: DW_TAG_inheritance,{{.*}} baseType: !"_ZTS1A",{{.*}} flags: DIFlagPublic) + +// CHECK: !DIDerivedType(tag: DW_TAG_inheritance,{{.*}} baseType: ![[A]],{{.*}} flags: DIFlagPublic) class B : public A { public: // CHECK-DAG: !DISubprogram(name: "pub",{{.*}} line: [[@LINE+1]],{{.*}} flags: DIFlagPublic | DIFlagPrototyped, diff --git a/test/CodeGenCXX/debug-info-artificial-arg.cpp b/test/CodeGenCXX/debug-info-artificial-arg.cpp index e927dc5d73..a0cf131f83 100644 --- a/test/CodeGenCXX/debug-info-artificial-arg.cpp +++ b/test/CodeGenCXX/debug-info-artificial-arg.cpp @@ -24,9 +24,8 @@ int main(int argc, char **argv) { // CHECK: ![[CLASSTYPE:.*]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "A", // CHECK-SAME: identifier: "_ZTS1A" -// CHECK: ![[ARTARG:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1A", -// CHECK-SAME: DIFlagArtificial -// CHECK: !DISubprogram(name: "A", scope: !"_ZTS1A" +// CHECK: ![[ARTARG:.*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[CLASSTYPE]],{{.*}} DIFlagArtificial +// CHECK: !DISubprogram(name: "A", scope: ![[CLASSTYPE]] // CHECK-SAME: line: 12 // CHECK-SAME: DIFlagPublic // CHECK: !DISubroutineType(types: [[FUNCTYPE:![0-9]*]]) diff --git a/test/CodeGenCXX/debug-info-class.cpp b/test/CodeGenCXX/debug-info-class.cpp index ece5c94544..d03c0845dd 100644 --- a/test/CodeGenCXX/debug-info-class.cpp +++ b/test/CodeGenCXX/debug-info-class.cpp @@ -90,6 +90,15 @@ int main(int argc, char **argv) { // CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b) // CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]] // CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]] + +// CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F" +// CHECK-SAME: DIFlagFwdDecl +// CHECK-SAME: identifier: "_ZTS1F" +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "I" +// CHECK-NOT: DIFlagFwdDecl +// CHECK-SAME: ){{$}} + +// CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" // CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "bar" // CHECK: !DICompositeType(tag: DW_TAG_union_type, name: "baz" @@ -99,12 +108,10 @@ int main(int argc, char **argv) { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "_vptr$B", // CHECK-SAME: DIFlagArtificial -// CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" - // CHECK: [[C:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: [[C_MEM:![0-9]*]] -// CHECK-SAME: vtableHolder: !"_ZTS1C" +// CHECK-SAME: vtableHolder: [[C]] // CHECK-SAME: identifier: "_ZTS1C" // CHECK: [[C_MEM]] = !{[[C_VPTR:![0-9]*]], [[C_S:![0-9]*]], [[C_DTOR:![0-9]*]]} // CHECK: [[C_VPTR]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$C" @@ -114,39 +121,33 @@ int main(int argc, char **argv) { // CHECK-SAME: DIFlagStaticMember // CHECK: [[C_DTOR]] = !DISubprogram(name: "~C" -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "D" +// CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D" // CHECK-SAME: DIFlagFwdDecl // CHECK-SAME: identifier: "_ZTS1D" // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "E" // CHECK-SAME: DIFlagFwdDecl // CHECK-SAME: identifier: "_ZTS1E" -// CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F" -// CHECK-SAME: DIFlagFwdDecl -// CHECK-SAME: identifier: "_ZTS1F" -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G" -// CHECK-SAME: DIFlagFwdDecl -// CHECK-SAME: identifier: "_ZTS1G" -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner" -// CHECK: line: 50 +// CHECK: !DISubprogram(name: "func",{{.*}} scope: [[D]] +// CHECK-SAME: isDefinition: true +// CHECK-SAME: declaration: [[D_FUNC_DECL:![0-9]*]] +// CHECK: [[D_FUNC_DECL]] = !DISubprogram(name: "func",{{.*}} scope: [[D]] +// CHECK-SAME: isDefinition: false + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 50 // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]] // CHECK-SAME: identifier: "_ZTSN1G5innerE" + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "G" +// CHECK-SAME: DIFlagFwdDecl +// CHECK-SAME: identifier: "_ZTS1G" // CHECK: [[G_INNER_MEM]] = !{[[G_INNER_I:![0-9]*]]} // CHECK: [[G_INNER_I]] = !DIDerivedType(tag: DW_TAG_member, name: "j" // CHECK-SAME: baseType: ![[INT]] // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize" -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "I" -// CHECK-NOT: DIFlagFwdDecl -// CHECK-SAME: ){{$}} // -// CHECK: !DISubprogram(name: "func",{{.*}} scope: !"_ZTS1D" -// CHECK-SAME: isDefinition: true -// CHECK-SAME: declaration: [[D_FUNC_DECL:![0-9]*]] -// CHECK: [[D_FUNC_DECL]] = !DISubprogram(name: "func",{{.*}} scope: !"_ZTS1D" -// CHECK-SAME: isDefinition: false - // CHECK: ![[EXCEPTLOC]] = !DILocation(line: 84, // CHECK: ![[RETLOC]] = !DILocation(line: 83, diff --git a/test/CodeGenCXX/debug-info-cxx1y.cpp b/test/CodeGenCXX/debug-info-cxx1y.cpp index 37f9595991..faf29d3ed1 100644 --- a/test/CodeGenCXX/debug-info-cxx1y.cpp +++ b/test/CodeGenCXX/debug-info-cxx1y.cpp @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm-only -std=c++14 -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s // CHECK: [[EMPTY:![0-9]*]] = !{} -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo", +// CHECK: [[FOO:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", // CHECK-SAME: elements: [[EMPTY]] // FIXME: The context of this definition should be the CU/file scope, not the class. -// CHECK: !DISubprogram(name: "func", {{.*}} scope: !"_ZTS3foo" +// CHECK: !DISubprogram(name: "func", {{.*}} scope: [[FOO]] // CHECK-SAME: type: [[SUBROUTINE_TYPE:![0-9]*]] // CHECK-SAME: isDefinition: true // CHECK-SAME: declaration: [[FUNC_DECL:![0-9]*]] @@ -12,7 +12,7 @@ // CHECK: [[TYPE_LIST]] = !{[[INT:![0-9]*]]} // CHECK: [[INT]] = !DIBasicType(name: "int" // CHECK: [[FUNC_DECL]] = !DISubprogram(name: "func", -// CHECK-SAME: scope: !"_ZTS3foo" +// CHECK-SAME: scope: [[FOO]] // CHECK-SAME: type: [[SUBROUTINE_TYPE]] // CHECK-SAME: isDefinition: false diff --git a/test/CodeGenCXX/debug-info-enum-class.cpp b/test/CodeGenCXX/debug-info-enum-class.cpp index 70c57d6cb7..44daf412d3 100644 --- a/test/CodeGenCXX/debug-info-enum-class.cpp +++ b/test/CodeGenCXX/debug-info-enum-class.cpp @@ -101,11 +101,11 @@ void f2(E) { void fz() { Z z; } namespace test5 { +// CHECK: [[TEST5:![0-9]+]] = !DINamespace(name: "test5" // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E" -// CHECK-SAME: scope: [[TEST5:![0-9]+]] +// CHECK-SAME: scope: [[TEST5]] // CHECK-SAME: flags: DIFlagFwdDecl // CHECK-SAME: identifier: "_ZTSN5test51EE" -// CHECK: [[TEST5]] = !DINamespace(name: "test5" enum E : int; void f1(E *) { } diff --git a/test/CodeGenCXX/debug-info-function-context.cpp b/test/CodeGenCXX/debug-info-function-context.cpp index 47a8d4d602..1db62d96d5 100644 --- a/test/CodeGenCXX/debug-info-function-context.cpp +++ b/test/CodeGenCXX/debug-info-function-context.cpp @@ -26,10 +26,11 @@ int global_namespace_variable = 1; // function has the file as a context. // CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp", +// CHECK: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C", // CHECK: ![[NS:.*]] = !DINamespace(name: "ns" -// CHECK: !DISubprogram(name: "member_function",{{.*}} scope: !"_ZTS1C",{{.*}} isDefinition: true +// CHECK: !DISubprogram(name: "member_function",{{.*}} scope: ![[C]],{{.*}} isDefinition: true -// CHECK: !DISubprogram(name: "static_member_function",{{.*}} scope: !"_ZTS1C",{{.*}} isDefinition: true +// CHECK: !DISubprogram(name: "static_member_function",{{.*}} scope: ![[C]],{{.*}} isDefinition: true // CHECK: !DISubprogram(name: "global_function",{{.*}} scope: ![[FILE]],{{.*}} isDefinition: true diff --git a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp index 19f8d01e1a..70b233cac4 100644 --- a/test/CodeGenCXX/debug-info-indirect-field-decl.cpp +++ b/test/CodeGenCXX/debug-info-indirect-field-decl.cpp @@ -9,9 +9,10 @@ struct Bar { int i1; // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, scope: - // CHECK-SAME: line: [[@LINE+3]] - // CHECK-SAME: baseType: !"_ZTSN3BarUt_E" + // CHECK-SAME: line: [[@LINE+4]] + // CHECK-SAME: baseType: ![[UNION:[0-9]+]] // CHECK-SAME: size: 32, align: 32, offset: 32 + // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E") union { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2", // CHECK-SAME: line: [[@LINE+5]] diff --git a/test/CodeGenCXX/debug-info-method.cpp b/test/CodeGenCXX/debug-info-method.cpp index bdd14e0b73..b55e2c4b81 100644 --- a/test/CodeGenCXX/debug-info-method.cpp +++ b/test/CodeGenCXX/debug-info-method.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -debug-info-kind=limited %s -o - | FileCheck %s -// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "A",{{.*}} identifier: "_ZTS1A") +// CHECK: ![[A:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "A",{{.*}} identifier: "_ZTS1A") // CHECK: !DISubprogram(name: "foo", linkageName: "_ZN1A3fooEiS_3$_0" // CHECK-SAME: DIFlagProtected -// CHECK: ![[THISTYPE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1A" +// CHECK: ![[THISTYPE:[0-9]+]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[A]] // CHECK-SAME: DIFlagArtificial // CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type // CHECK: !DIDerivedType(tag: DW_TAG_ptr_to_member_type, baseType: ![[MEMFUNTYPE:[0-9]+]] diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index 5cdf91bc1b..bd7412a103 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -57,41 +57,41 @@ void B::func_fwd() {} // CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-SAME: imports: [[MODULES:![0-9]*]] -// CHECK: [[FOO:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", -// CHECK-SAME: line: 5 -// CHECK-SAME: DIFlagFwdDecl -// CHECK: [[FOOCPP:![0-9]+]] = !DIFile(filename: "foo.cpp" -// CHECK: [[NS:![0-9]+]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]], file: [[FOOCPP]], line: 1) +// CHECK: [[I:![0-9]+]] = !DIGlobalVariable(name: "i",{{.*}} scope: [[NS:![0-9]+]], +// CHECK: [[NS]] = !DINamespace(name: "B", scope: [[CTXT:![0-9]+]], file: [[FOOCPP:![0-9]+]], line: 1) +// CHECK: [[FOOCPP]] = !DIFile(filename: "foo.cpp" // CHECK: [[CTXT]] = !DINamespace(name: "A", scope: null, file: [[FILE:![0-9]+]], line: 5) // CHECK: [[FILE]] = !DIFile(filename: "{{.*}}debug-info-namespace.cpp", -// CHECK: [[BAR:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", -// CHECK-SAME: line: 6 -// CHECK-SAME: DIFlagFwdDecl - -// CHECK: [[I:![0-9]+]] = !DIGlobalVariable(name: "i",{{.*}} scope: [[NS]], // CHECK: [[VAR_FWD:![0-9]+]] = !DIGlobalVariable(name: "var_fwd",{{.*}} scope: [[NS]], // CHECK-SAME: line: 44 // CHECK-SAME: isDefinition: true - // CHECK: [[MODULES]] = !{[[M1:![0-9]+]], [[M2:![0-9]+]], [[M3:![0-9]+]], [[M4:![0-9]+]], [[M5:![0-9]+]], [[M6:![0-9]+]], [[M7:![0-9]+]], [[M8:![0-9]+]], [[M9:![0-9]+]], [[M10:![0-9]+]], [[M11:![0-9]+]], [[M12:![0-9]+]], [[M13:![0-9]+]], [[M14:![0-9]+]], [[M15:![0-9]+]], [[M16:![0-9]+]], [[M17:![0-9]+]]} // CHECK: [[M1]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CTXT]], entity: [[NS]], line: 15) + // CHECK: [[M2]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[CU]], entity: [[CTXT]], // CHECK: [[M3]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "E", scope: [[CU]], entity: [[CTXT]], line: 19) // CHECK: [[M4]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[LEX2:![0-9]+]], entity: [[NS]], line: 23) // CHECK: [[LEX2]] = distinct !DILexicalBlock(scope: [[LEX1:![0-9]+]], file: [[FOOCPP]], // CHECK: [[LEX1]] = distinct !DILexicalBlock(scope: [[FUNC:![0-9]+]], file: [[FOOCPP]], -// CHECK: [[FUNC]] = distinct !DISubprogram(name: "func",{{.*}} isDefinition: true -// CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[FUNC]], entity: [[CTXT]], -// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:!"_ZTSN1A1B3fooE"]], line: 27) -// CHECK: [[M7]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAR:!"_ZTSN1A1B3barE"]] +// CHECK: [[FUNC:![0-9]+]] = distinct !DISubprogram(name: "func",{{.*}} isDefinition: true +// CHECK: [[M5]] = !DIImportedEntity(tag: DW_TAG_imported_module, scope: [[FUNC]], entity: [[CTXT:![0-9]+]], +// CHECK: [[M6]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FOO:![0-9]+]], line: 27) +// CHECK: [[FOO]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", +// CHECK-SAME: line: 5 +// CHECK-SAME: DIFlagFwdDecl +// CHECK: [[M7]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAR:![0-9]+]] +// CHECK: [[BAR]] = !DICompositeType(tag: DW_TAG_structure_type, name: "bar", +// CHECK-SAME: line: 6 +// CHECK-SAME: DIFlagFwdDecl + // CHECK: [[M8]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[F1:![0-9]+]] // CHECK: [[F1:![0-9]+]] = distinct !DISubprogram(name: "f1",{{.*}} line: 4 // CHECK-SAME: isDefinition: true // CHECK: [[M9]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[I]] // CHECK: [[M10]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[BAZ:![0-9]+]] // CHECK: [[BAZ]] = !DIDerivedType(tag: DW_TAG_typedef, name: "baz", scope: [[NS]], file: [[FOOCPP]], -// CHECK-SAME: baseType: !"_ZTSN1A1B3barE" +// CHECK-SAME: baseType: [[BAR]] // CHECK: [[M11]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "X", scope: [[FUNC]], entity: [[CTXT]] // CHECK: [[M12]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "Y", scope: [[FUNC]], entity: [[M11]] // CHECK: [[M13]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[VAR_DECL:![0-9]+]] diff --git a/test/CodeGenCXX/debug-info-static-member.cpp b/test/CodeGenCXX/debug-info-static-member.cpp index 81ab203418..ed8ae015cf 100644 --- a/test/CodeGenCXX/debug-info-static-member.cpp +++ b/test/CodeGenCXX/debug-info-static-member.cpp @@ -24,37 +24,35 @@ public: static X x_a; }; -int C::a = 4; -int C::b = 2; -int C::c = 1; - -int main() -{ - C instance_C; - instance_C.d = 8; - return C::c; -} - // The definition of C::a drives the emission of class C, which is // why the definition of "a" comes before the declarations while // "b" and "c" come after. // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "X"{{.*}}, identifier: "_ZTS1X") -// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "C"{{.*}}, identifier: "_ZTS1C") -// -// CHECK: ![[DECL_A:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "a" +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "anon_static_decl_struct" +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "anon_static_decl_var" +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "static_decl_templ" +// CHECK-NOT: DIFlagFwdDecl +// CHECK-SAME: ){{$}} +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_decl_templ_var" + +// CHECK: !DIGlobalVariable(name: "a", {{.*}}variable: i32* @_ZN1C1aE, declaration: ![[DECL_A:[0-9]+]]) +int C::a = 4; +// CHECK: ![[DECL_A]] = !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-NOT: size: // CHECK-NOT: align: // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagStaticMember) // +// CHECK: !DICompositeType(tag: DW_TAG_class_type, name: "C"{{.*}}, identifier: "_ZTS1C") +// // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "const_a" // CHECK-NOT: size: // CHECK-NOT: align: // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagStaticMember, // CHECK-SAME: extraData: i1 true) -// + // CHECK: ![[DECL_B:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "b" // CHECK-NOT: size: // CHECK-NOT: align: @@ -67,7 +65,7 @@ int main() // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected | DIFlagStaticMember, // CHECK-SAME: extraData: float 0x{{.*}}) -// + // CHECK: ![[DECL_C:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "c" // CHECK-NOT: size: // CHECK-NOT: align: @@ -84,12 +82,19 @@ int main() // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "x_a" // CHECK-SAME: flags: DIFlagPublic | DIFlagStaticMember) -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "static_decl_templ" -// CHECK-NOT: DIFlagFwdDecl -// CHECK-SAME: ){{$}} -// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "static_decl_templ_var" +// CHECK: !DIGlobalVariable(name: "b", {{.*}}variable: i32* @_ZN1C1bE, declaration: ![[DECL_B]]) +int C::b = 2; +// CHECK: !DIGlobalVariable(name: "c", {{.*}}variable: i32* @_ZN1C1cE, declaration: ![[DECL_C]]) +int C::c = 1; -// CHECK: [[NS_X:![0-9]+]] = !DINamespace(name: "x" +int main() +{ + C instance_C; + instance_C.d = 8; + return C::c; +} + +// CHECK-NOT: !DIGlobalVariable(name: "anon_static_decl_var" // Test this in an anonymous namespace to ensure the type is retained even when // it doesn't get automatically retained by the string type reference machinery. @@ -100,9 +105,6 @@ struct anon_static_decl_struct { } -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "anon_static_decl_struct" -// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "anon_static_decl_var" - int ref() { return anon_static_decl_struct::anon_static_decl_var; } @@ -119,12 +121,6 @@ int static_decl_templ_ref() { return static_decl_templ::static_decl_templ_var; } -// CHECK: !DIGlobalVariable(name: "a", {{.*}}variable: i32* @_ZN1C1aE, declaration: ![[DECL_A]]) -// CHECK: !DIGlobalVariable(name: "b", {{.*}}variable: i32* @_ZN1C1bE, declaration: ![[DECL_B]]) -// CHECK: !DIGlobalVariable(name: "c", {{.*}}variable: i32* @_ZN1C1cE, declaration: ![[DECL_C]]) - -// CHECK-NOT: !DIGlobalVariable(name: "anon_static_decl_var" - // Verify that even when a static member declaration is created lazily when // creating the definition, the declaration line is that of the canonical // declaration, not the definition. Also, since we look at the canonical @@ -141,10 +137,10 @@ const int V::const_va; namespace x { struct y { +// CHECK: !DIGlobalVariable(name: "z", +// CHECK-SAME: scope: [[NS_X:![0-9]+]] +// CHECK: [[NS_X]] = !DINamespace(name: "x" static int z; }; int y::z; } - -// CHECK: !DIGlobalVariable(name: "z", -// CHECK-SAME: scope: [[NS_X]] diff --git a/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp index 04c63ae2ff..08146c2526 100644 --- a/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ b/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -6,6 +6,11 @@ // LINES-ONLY-NOT: !DICompositeType(tag: DW_TAG_structure_type +// "h" is at the top because it's in the compile unit's retainedTypes: list. +// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "h" +// CHECK-NOT: DIFlagFwdDecl +// CHECK-SAME: ){{$}} + template struct a { }; @@ -85,9 +90,6 @@ template struct h { }; template class h; -// CHECK: DICompositeType(tag: DW_TAG_structure_type, name: "h" -// CHECK-NOT: DIFlagFwdDecl -// CHECK-SAME: ){{$}} template struct i { diff --git a/test/CodeGenCXX/debug-info-template-limit.cpp b/test/CodeGenCXX/debug-info-template-limit.cpp index 7e3a4a6959..172ab94dce 100644 --- a/test/CodeGenCXX/debug-info-template-limit.cpp +++ b/test/CodeGenCXX/debug-info-template-limit.cpp @@ -2,7 +2,7 @@ // Check that this pointer type is TC // CHECK: ![[LINE:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_class_type, name: "TC"{{.*}}, identifier: "_ZTS2TCIiE") -// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS2TCIiE" +// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type, baseType: ![[LINE]] template class TC { diff --git a/test/CodeGenCXX/debug-info-template-member.cpp b/test/CodeGenCXX/debug-info-template-member.cpp index dcc464629f..88f024b59a 100644 --- a/test/CodeGenCXX/debug-info-template-member.cpp +++ b/test/CodeGenCXX/debug-info-template-member.cpp @@ -16,6 +16,12 @@ inline int add3(int x) { return MyClass().add<3>(x); // even though add<3> is ODR used, don't emit it since we don't codegen it } +// The compile unit pulls in the global variables first. +// CHECK: !DIGlobalVariable(name: "x", +// CHECK-SAME: type: ![[OUTER_FOO_INNER_ID:[0-9]+]] +// CHECK-SAME: variable: %"struct.outer::inner"* @x + +// CHECK: ![[OUTER_FOO_INNER_ID:[0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "inner"{{.*}}, identifier: // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "foo" // CHECK-SAME: elements: [[FOO_MEM:![0-9]*]] // CHECK-SAME: identifier: "_ZTS3foo" @@ -23,33 +29,35 @@ inline int add3(int x) { // CHECK: [[FOO_FUNC]] = !DISubprogram(name: "func", linkageName: "_ZN3foo4funcEN5outerIS_E5innerE", // CHECK-SAME: type: [[FOO_FUNC_TYPE:![0-9]*]] // CHECK: [[FOO_FUNC_TYPE]] = !DISubroutineType(types: [[FOO_FUNC_PARAMS:![0-9]*]]) -// CHECK: [[FOO_FUNC_PARAMS]] = !{null, !{{[0-9]*}}, !"[[OUTER_FOO_INNER_ID:.*]]"} -// CHECK: !{{[0-9]*}} = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "inner"{{.*}}, identifier: "[[OUTER_FOO_INNER_ID]]") - -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "virt" -// CHECK-SAME: elements: [[VIRT_MEM:![0-9]*]] -// CHECK-SAME: vtableHolder: !"_ZTS4virtI4elemE" -// CHECK-SAME: templateParams: [[VIRT_TEMP_PARAM:![0-9]*]] -// CHECK-SAME: identifier: "_ZTS4virtI4elemE" -// CHECK: [[VIRT_TEMP_PARAM]] = !{[[VIRT_T:![0-9]*]]} -// CHECK: [[VIRT_T]] = !DITemplateTypeParameter(name: "T", type: !"_ZTS4elem") +// CHECK: [[FOO_FUNC_PARAMS]] = !{null, !{{[0-9]*}}, ![[OUTER_FOO_INNER_ID]]} // CHECK: [[C:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "MyClass" // CHECK-SAME: elements: [[C_MEM:![0-9]*]] -// CHECK-SAME: vtableHolder: !"_ZTS7MyClass" +// CHECK-SAME: vtableHolder: [[C]] // CHECK-SAME: identifier: "_ZTS7MyClass") // CHECK: [[C_MEM]] = !{[[C_VPTR:![0-9]*]], [[C_FUNC:![0-9]*]]} // CHECK: [[C_VPTR]] = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$MyClass" // CHECK: [[C_FUNC]] = !DISubprogram(name: "func",{{.*}} line: 7, -// CHECK: [[ELEM:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "elem" +// CHECK: !DISubprogram(name: "add<2>" +// CHECK-SAME: scope: [[C]] +// +// CHECK: [[VIRT_TEMP:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "virt" +// CHECK-SAME: elements: [[VIRT_MEM:![0-9]*]] +// CHECK-SAME: vtableHolder: [[VIRT_TEMP]] +// CHECK-SAME: templateParams: [[VIRT_TEMP_PARAM:![0-9]*]] +// CHECK-SAME: identifier: "_ZTS4virtI4elemE" + +// CHECK: [[ELEM:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "elem" // CHECK-SAME: elements: [[ELEM_MEM:![0-9]*]] // CHECK-SAME: identifier: "_ZTS4elem" // CHECK: [[ELEM_MEM]] = !{[[ELEM_X:![0-9]*]]} -// CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !"_ZTS4elem" -// CHECK-SAME: baseType: !"_ZTS4virtI4elemE" +// CHECK: [[ELEM_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: [[ELEM]] +// CHECK-SAME: baseType: [[VIRT_TEMP:![0-9]+]] +// CHECK: [[VIRT_TEMP_PARAM]] = !{[[VIRT_T:![0-9]*]]} +// CHECK: [[VIRT_T]] = !DITemplateTypeParameter(name: "T", type: [[ELEM]]) template struct outer { @@ -71,10 +79,6 @@ inline void func() { outer::inner x; -// CHECK: !DIGlobalVariable(name: "x", -// CHECK-SAME: type: !"[[OUTER_FOO_INNER_ID]]" -// CHECK-SAME: variable: %"struct.outer::inner"* @x - template struct virt { T* values; @@ -96,6 +100,4 @@ void f2() { // from being added to type units, while still appearing in the type // declaration/reference in the compile unit. // CHECK: !DISubprogram(name: "MyClass" -// CHECK-SAME: scope: !"_ZTS7MyClass" -// CHECK: !DISubprogram(name: "add<2>" -// CHECK-SAME: scope: !"_ZTS7MyClass" +// CHECK-SAME: scope: [[C]] diff --git a/test/CodeGenCXX/debug-info-template-quals.cpp b/test/CodeGenCXX/debug-info-template-quals.cpp index 881bb0e200..7a0d0d4a27 100644 --- a/test/CodeGenCXX/debug-info-template-quals.cpp +++ b/test/CodeGenCXX/debug-info-template-quals.cpp @@ -15,17 +15,17 @@ void foo (const char *c) { str.assign(c, str); } +// CHECK: [[P:![0-9]*]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[CON:![0-9]*]] +// CHECK: [[CON]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[CH:![0-9]*]] +// CHECK: [[CH]] = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) // CHECK: [[BS:.*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "basic_string" // CHECK-SAME: line: 4 // CHECK-SAME: size: 8, align: 8 // CHECK: [[TYPE:![0-9]*]] = !DISubroutineType(types: [[ARGS:.*]]) -// CHECK: [[ARGS]] = !{!{{.*}}, !{{.*}}, [[P:![0-9]*]], [[R:.*]]} -// CHECK: [[P]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[CON:![0-9]*]] -// CHECK: [[CON]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[CH:![0-9]*]] -// CHECK: [[CH]] = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) +// CHECK: [[ARGS]] = !{!{{.*}}, !{{.*}}, [[P]], [[R:.*]]} // CHECK: [[R]] = !DIDerivedType(tag: DW_TAG_reference_type, baseType: [[CON2:![0-9]*]] -// CHECK: [[CON2]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTS12basic_stringIcE" +// CHECK: [[CON2]] = !DIDerivedType(tag: DW_TAG_const_type, baseType: [[BS]] // CHECK: !DISubprogram(name: "assign" // CHECK-SAME: line: 7 // CHECK-SAME: scopeLine: 8 diff --git a/test/CodeGenCXX/debug-info-template.cpp b/test/CodeGenCXX/debug-info-template.cpp index 569357c061..d35bb70fa7 100644 --- a/test/CodeGenCXX/debug-info-template.cpp +++ b/test/CodeGenCXX/debug-info-template.cpp @@ -1,73 +1,105 @@ // RUN: %clang -S -emit-llvm -target x86_64-unknown_unknown -g %s -o - -std=c++11 | FileCheck %s // CHECK: !DICompileUnit( -// CHECK-SAME: retainedTypes: [[RETAIN:![0-9]*]] // CHECK: [[EMPTY:![0-9]*]] = !{} -// CHECK: [[RETAIN]] = !{!{{[0-9]]*}}, [[FOO:![0-9]*]], +struct foo { + char pad[8]; // make the member pointer to 'e' a bit more interesting (nonzero) + int e; + void f(); + static void g(); +}; -// CHECK: [[TC:![0-9]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TC" +typedef int foo::*foo_mem; + +template +struct TC { + struct nested { + }; +}; + +// CHECK: [[INT:![0-9]+]] = !DIBasicType(name: "int" +int glb; +void func(); + +// CHECK: !DIGlobalVariable(name: "tci", +// CHECK-SAME: type: ![[TCNESTED:[0-9]+]] +// CHECK-SAME: variable: %"struct.TC::nested"* @tci +// CHECK: ![[TCNESTED]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "nested", +// CHECK-SAME: scope: ![[TC:[0-9]+]], + +// CHECK: ![[TC]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "TC" // CHECK-SAME: templateParams: [[TCARGS:![0-9]*]] +TC // CHECK: [[TCARGS]] = !{[[TCARG1:![0-9]*]], [[TCARG2:![0-9]*]], [[TCARG3:![0-9]*]], [[TCARG4:![0-9]*]], [[TCARG5:![0-9]*]], [[TCARG6:![0-9]*]], [[TCARG7:![0-9]*]]} -// // CHECK: [[TCARG1]] = !DITemplateTypeParameter(name: "T", type: [[UINT:![0-9]*]]) // CHECK: [[UINT:![0-9]*]] = !DIBasicType(name: "unsigned int" +< unsigned, // CHECK: [[TCARG2]] = !DITemplateValueParameter(type: [[UINT]], value: i32 2) + 2, // CHECK: [[TCARG3]] = !DITemplateValueParameter(name: "x", type: [[CINTPTR:![0-9]*]], value: i32* @glb) // CHECK: [[CINTPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, {{.*}}baseType: [[CINT:![0-9]+]] -// CHECK: [[CINT]] = !DIDerivedType(tag: DW_TAG_const_type, {{.*}}baseType: [[INT:![0-9]+]] -// CHECK: [[INT]] = !DIBasicType(name: "int" +// CHECK: [[CINT]] = !DIDerivedType(tag: DW_TAG_const_type, {{.*}}baseType: [[INT]] + &glb, // CHECK: [[TCARG4]] = !DITemplateValueParameter(name: "a", type: [[MEMINTPTR:![0-9]*]], value: i64 8) -// CHECK: [[MEMINTPTR]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[INT]], {{.*}}extraData: !"_ZTS3foo") +// CHECK: [[MEMINTPTR]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[INT]], {{.*}}extraData: ![[FOO:[0-9]+]]) +// +// We could just emit a declaration of 'foo' here, rather than the entire +// definition (same goes for any time we emit a member (function or data) +// pointer type) +// CHECK: [[FOO]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", {{.*}}identifier: "_ZTS3foo") +// CHECK: !DISubprogram(name: "f", linkageName: "_ZN3foo1fEv", {{.*}}type: [[FTYPE:![0-9]*]] // // Currently Clang emits the pointer-to-member-function value, but LLVM doesn't // use it (GCC doesn't emit a value for pointers to member functions either - so // it's not clear what, if any, format would be acceptable to GDB) // -// CHECK: [[TCARG5]] = !DITemplateValueParameter(name: "b", type: [[MEMFUNPTR:![0-9]*]], value: { i64, i64 } { i64 ptrtoint (void (%struct.foo*)* @_ZN3foo1fEv to i64), i64 0 }) -// CHECK: [[MEMFUNPTR]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[FTYPE:![0-9]*]], {{.*}}extraData: !"_ZTS3foo") -// CHECK: [[FTYPE]] = !DISubroutineType(types: [[FARGS:![0-9]*]]) +// CHECK: [[FTYPE:![0-9]*]] = !DISubroutineType(types: [[FARGS:![0-9]*]]) // CHECK: [[FARGS]] = !{null, [[FARG1:![0-9]*]]} // CHECK: [[FARG1]] = !DIDerivedType(tag: DW_TAG_pointer_type, -// CHECK-SAME: baseType: !"_ZTS3foo" +// CHECK-SAME: baseType: ![[FOO]] // CHECK-NOT: line: // CHECK-SAME: size: 64, align: 64 // CHECK-NOT: offset: 0 // CHECK-SAME: DIFlagArtificial -// -// CHECK: [[TCARG6]] = !DITemplateValueParameter(name: "f", type: [[FUNPTR:![0-9]*]], value: void ()* @_ZN3foo1gEv) -// CHECK: [[FUNPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[FUNTYPE:![0-9]*]] -// CHECK: [[FUNTYPE]] = !DISubroutineType(types: [[FUNARGS:![0-9]*]]) +// CHECK: [[FUNTYPE:![0-9]*]] = !DISubroutineType(types: [[FUNARGS:![0-9]*]]) // CHECK: [[FUNARGS]] = !{null} + &foo::e, +// CHECK: [[TCARG5]] = !DITemplateValueParameter(name: "b", type: [[MEMFUNPTR:![0-9]*]], value: { i64, i64 } { i64 ptrtoint (void (%struct.foo*)* @_ZN3foo1fEv to i64), i64 0 }) +// CHECK: [[MEMFUNPTR]] = !DIDerivedType(tag: DW_TAG_ptr_to_member_type, {{.*}}baseType: [[FTYPE]], {{.*}}extraData: ![[FOO]]) + &foo::f, +// CHECK: [[TCARG6]] = !DITemplateValueParameter(name: "f", type: [[FUNPTR:![0-9]*]], value: void ()* @_ZN3foo1gEv) +// CHECK: [[FUNPTR]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[FUNTYPE]] + &foo::g, // CHECK: [[TCARG7]] = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "Is", value: [[TCARG7_VALS:![0-9]*]]) // CHECK: [[TCARG7_VALS]] = !{[[TCARG7_1:![0-9]*]], [[TCARG7_2:![0-9]*]], [[TCARG7_3:![0-9]*]]} // CHECK: [[TCARG7_1]] = !DITemplateValueParameter(type: [[INT]], value: i32 1) + 1, // CHECK: [[TCARG7_2]] = !DITemplateValueParameter(type: [[INT]], value: i32 2) + 2, // CHECK: [[TCARG7_3]] = !DITemplateValueParameter(type: [[INT]], value: i32 3) -// -// We could just emit a declaration of 'foo' here, rather than the entire -// definition (same goes for any time we emit a member (function or data) -// pointer type) -// CHECK: [[FOO]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo", {{.*}}identifier: "_ZTS3foo") -// CHECK: !DISubprogram(name: "f", linkageName: "_ZN3foo1fEv", {{.*}}type: [[FTYPE:![0-9]*]] -// + 3>::nested tci; -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "nested", -// CHECK-SAME: scope: !"_ZTS2TCIjLj2EXadL_Z3glbEEXadL_ZN3foo1eEEEXadL_ZNS0_1fEvEEXadL_ZNS0_1gEvEEJLi1ELi2ELi3EEE" -// CHECK-SAME: identifier: "[[TCNESTED:.*]]") -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "TC" +// CHECK: !DIGlobalVariable(name: "tcn" +// CHECK-SAME: type: ![[TCNT:[0-9]+]] +// CHECK-SAME: variable: %struct.TC* @tcn +TC +// CHECK: ![[TCNT]] ={{.*}}!DICompositeType(tag: DW_TAG_structure_type, name: "TC" // CHECK-SAME: templateParams: [[TCNARGS:![0-9]*]] -// CHECK-SAME: identifier: "[[TCNT:.*]]") // CHECK: [[TCNARGS]] = !{[[TCNARG1:![0-9]*]], [[TCNARG2:![0-9]*]], [[TCNARG3:![0-9]*]], [[TCNARG4:![0-9]*]], [[TCNARG5:![0-9]*]], [[TCNARG6:![0-9]*]], [[TCNARG7:![0-9]*]]} // CHECK: [[TCNARG1]] = !DITemplateTypeParameter(name: "T", type: [[INT]]) + tcn; + +template +struct tmpl_impl { +}; + +template