From 743f7f1aff3b35f787b4b8e2974fd14ce4019926 Mon Sep 17 00:00:00 2001 From: Adrian McCarthy Date: Wed, 6 Jul 2016 15:15:38 +0000 Subject: [PATCH] Revert "Include debug info for nested structs and classes" This reverts commit 0af5ee9631c7c167dc40498b415876553e314c95. llvm-svn: 274633 --- clang/lib/CodeGen/CGDebugInfo.cpp | 14 ++------------ clang/lib/CodeGen/CGDebugInfo.h | 2 -- clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp | 2 +- .../CodeGenCXX/debug-info-indirect-field-decl.cpp | 12 ++++++------ clang/test/CodeGenCXX/debug-info-ms-abi.cpp | 6 +++--- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 661c888b07b9..d51e1d978bbf 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1095,13 +1095,6 @@ void CGDebugInfo::CollectRecordNormalField( elements.push_back(FieldType); } -void CGDebugInfo::CollectRecordNestedRecord( - const RecordDecl *RD, SmallVectorImpl &elements) { - QualType Ty = CGM.getContext().getTypeDeclType(RD); - llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateMainFile()); - elements.push_back(nestedType); -} - void CGDebugInfo::CollectRecordFields( const RecordDecl *record, llvm::DIFile *tunit, SmallVectorImpl &elements, @@ -1138,9 +1131,6 @@ void CGDebugInfo::CollectRecordFields( // Bump field number for next field. ++fieldNo; - } else if (const auto *nestedRec = dyn_cast(I)) { - if (!nestedRec->isImplicit() && nestedRec->getDeclContext() == record) - CollectRecordNestedRecord(nestedRec, elements); } } } @@ -3643,8 +3633,8 @@ void CGDebugInfo::EmitUsingDirective(const UsingDirectiveDecl &UD) { if (CGM.getCodeGenOpts().getDebugInfo() < codegenoptions::LimitedDebugInfo) return; const NamespaceDecl *NSDecl = UD.getNominatedNamespace(); - if (!NSDecl->isAnonymousNamespace() || - CGM.getCodeGenOpts().DebugExplicitImport) { + if (!NSDecl->isAnonymousNamespace() || + CGM.getCodeGenOpts().DebugExplicitImport) { DBuilder.createImportedModule( getCurrentContextDescriptor(cast(UD.getDeclContext())), getOrCreateNameSpace(NSDecl), diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 70c16462965f..366dd81ac812 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -254,8 +254,6 @@ class CGDebugInfo { llvm::DIFile *F, SmallVectorImpl &E, llvm::DIType *RecordTy, const RecordDecl *RD); - void CollectRecordNestedRecord(const RecordDecl *RD, - SmallVectorImpl &E); void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F, SmallVectorImpl &E, llvm::DICompositeType *RecordTy); diff --git a/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp b/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp index 3b23ebf7dedc..f7a2cfe7bae6 100644 --- a/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp +++ b/clang/test/CodeGenCXX/debug-info-dup-fwd-decl.cpp @@ -19,6 +19,6 @@ protected: Test t; -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data" // CHECK: !DIDerivedType(tag: DW_TAG_pointer_type +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data" // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data" diff --git a/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp b/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp index 5642719a517a..70b233cac4dc 100644 --- a/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp +++ b/clang/test/CodeGenCXX/debug-info-indirect-field-decl.cpp @@ -8,18 +8,18 @@ template class Foo { }; struct Bar { int i1; // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int" - // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E") + // CHECK: !DIDerivedType(tag: DW_TAG_member, scope: + // 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+9]] + // CHECK-SAME: line: [[@LINE+5]] // CHECK-SAME: baseType: ![[INT]] // CHECK-SAME: size: 32, align: 32 // CHECK-NOT: offset: // CHECK-SAME: ){{$}} - // CHECK: !DIDerivedType(tag: DW_TAG_member, scope: - // CHECK-SAME: line: [[@LINE-8]] - // CHECK-SAME: baseType: ![[UNION]] - // CHECK-SAME: size: 32, align: 32, offset: 32 int i2; }; }; diff --git a/clang/test/CodeGenCXX/debug-info-ms-abi.cpp b/clang/test/CodeGenCXX/debug-info-ms-abi.cpp index 2652128b39de..a146ce94176e 100644 --- a/clang/test/CodeGenCXX/debug-info-ms-abi.cpp +++ b/clang/test/CodeGenCXX/debug-info-ms-abi.cpp @@ -14,9 +14,6 @@ Foo::Nested n; // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", // CHECK-SAME: identifier: ".?AUFoo@@" -// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", -// CHECK-SAME: identifier: ".?AUNested@Foo@@" - // CHECK: !DISubprogram(name: "f", // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0, // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual, @@ -28,3 +25,6 @@ Foo::Nested n; // CHECK: !DISubprogram(name: "h", // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2, // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual, + +// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", +// CHECK-SAME: identifier: ".?AUNested@Foo@@"