From: David Blaikie Date: Tue, 6 May 2014 17:02:15 +0000 (+0000) Subject: Revert "DebugInfo: Emit the definition of enums when the definition preceeds the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8304a54201c0c0b408fc70ec18baf9a2b6cc23d3;p=clang Revert "DebugInfo: Emit the definition of enums when the definition preceeds the declaration and initial use." This is breaking the compiler-rt build. Reverting while I investigate/fix. This reverts commit r208065. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208106 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index f88ac393f9..cd966a0e7f 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1427,21 +1427,6 @@ llvm::DIType CGDebugInfo::getOrCreateInterfaceType(QualType D, return T; } -void CGDebugInfo::completeType(const EnumDecl *ED) { - if (DebugKind <= CodeGenOptions::DebugLineTablesOnly) - return; - QualType Ty = CGM.getContext().getEnumType(ED); - void* TyPtr = Ty.getAsOpaquePtr(); - auto I = TypeCache.find(TyPtr); - if (I != TypeCache.end() && - !llvm::DIType(cast(static_cast(I->second))) - .isForwardDecl()) - return; - llvm::DIType Res = CreateTypeDefinition(Ty->castAs()); - assert(!Res.isForwardDecl()); - TypeCache[TyPtr] = Res; -} - void CGDebugInfo::completeType(const RecordDecl *RD) { if (DebugKind > CodeGenOptions::LimitedDebugInfo || !CGM.getLangOpts().CPlusPlus) @@ -1930,20 +1915,6 @@ llvm::DIType CGDebugInfo::CreateEnumType(const EnumType *Ty) { return RetTy; } - return CreateTypeDefinition(Ty); -} - -llvm::DIType CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { - const EnumDecl *ED = Ty->getDecl(); - uint64_t Size = 0; - uint64_t Align = 0; - if (!ED->getTypeForDecl()->isIncompleteType()) { - Size = CGM.getContext().getTypeSize(ED->getTypeForDecl()); - Align = CGM.getContext().getTypeAlign(ED->getTypeForDecl()); - } - - SmallString<256> FullName = getUniqueTagTypeName(Ty, CGM, TheCU); - // Create DIEnumerator elements for each enumerator. SmallVector Enumerators; ED = ED->getDefinition(); diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h index f7640bc28d..700e3358de 100644 --- a/lib/CodeGen/CGDebugInfo.h +++ b/lib/CodeGen/CGDebugInfo.h @@ -135,7 +135,6 @@ class CGDebugInfo { llvm::DIType CreateType(const MemberPointerType *Ty, llvm::DIFile F); llvm::DIType CreateType(const AtomicType *Ty, llvm::DIFile F); llvm::DIType CreateEnumType(const EnumType *Ty); - llvm::DIType CreateTypeDefinition(const EnumType *Ty); llvm::DIType CreateSelfType(const QualType &QualTy, llvm::DIType Ty); llvm::DIType getTypeOrNull(const QualType); llvm::DICompositeType getOrCreateMethodType(const CXXMethodDecl *Method, @@ -296,7 +295,6 @@ public: llvm::DIType getOrCreateInterfaceType(QualType Ty, SourceLocation Loc); - void completeType(const EnumDecl *ED); void completeType(const RecordDecl *RD); void completeRequiredType(const RecordDecl *RD); void completeClassData(const RecordDecl *RD); diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp index 9be633c1c9..b7f37462a6 100644 --- a/lib/CodeGen/CodeGenTypes.cpp +++ b/lib/CodeGen/CodeGenTypes.cpp @@ -242,10 +242,6 @@ void CodeGenTypes::UpdateCompletedType(const TagDecl *TD) { if (!ConvertType(ED->getIntegerType())->isIntegerTy(32)) TypeCache.clear(); } - // If necessary, provide the full definition of a type only used with a - // declaration so far. - if (CGDebugInfo *DI = CGM.getModuleDebugInfo()) - DI->completeType(ED); return; } diff --git a/test/CodeGen/debug-info-enum.c b/test/CodeGen/debug-info-enum.c deleted file mode 100644 index acf3f52408..0000000000 --- a/test/CodeGen/debug-info-enum.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s - -// CHECK: metadata [[TEST3_ENUMS:![0-9]*]], {{[^,]*}}, null, null, null} ; [ DW_TAG_enumeration_type ] [e] -// CHECK: [[TEST3_ENUMS]] = metadata !{metadata [[TEST3_E:![0-9]*]]} -// CHECK: [[TEST3_E]] = {{.*}}, metadata !"E", i64 -1} ; [ DW_TAG_enumerator ] [E :: -1] - -enum e; -void func(enum e *p) { -} -enum e { E = -1 }; diff --git a/test/CodeGenCXX/debug-info-enum-class.cpp b/test/CodeGenCXX/debug-info-enum-class.cpp index af62487689..0f4b09afb5 100644 --- a/test/CodeGenCXX/debug-info-enum-class.cpp +++ b/test/CodeGenCXX/debug-info-enum-class.cpp @@ -12,6 +12,7 @@ D d; // CHECK: ; [ DW_TAG_enumeration_type ] [A] [line 3, size 32, align 32, offset 0] [def] [from int] // CHECK: ; [ DW_TAG_enumeration_type ] [B] [line 4, size 64, align 64, offset 0] [def] [from long unsigned int] // CHECK: ; [ DW_TAG_enumeration_type ] [C] [line 5, size 32, align 32, offset 0] [def] [from ] +// CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [decl] [from ] namespace PR14029 { // Make sure this doesn't crash/assert. @@ -26,45 +27,3 @@ namespace PR14029 { }; Test t; } - -namespace test2 { -// FIXME: this should just be a declaration under -fno-standalone-debug -// CHECK: metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST2:![0-9]*]], {{.*}}, metadata [[TEST_ENUMS:![0-9]*]], {{[^,]*}}, null, null, metadata !"_ZTSN5test21EE"} ; [ DW_TAG_enumeration_type ] [E] -// CHECK: [[TEST2]] = {{.*}} ; [ DW_TAG_namespace ] [test2] -// CHECK: [[TEST_ENUMS]] = metadata !{metadata [[TEST_E:![0-9]*]]} -// CHECK: [[TEST_E]] = {{.*}}, metadata !"e", i64 0} ; [ DW_TAG_enumerator ] [e :: 0] -enum E : int; -void func(E *) { -} -enum E : int { e }; -} - -namespace test3 { -// FIXME: this should just be a declaration under -fno-standalone-debug -// CHECK: metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST3:![0-9]*]], {{.*}}, metadata [[TEST_ENUMS]], {{[^,]*}}, null, null, metadata !"_ZTSN5test31EE"} ; [ DW_TAG_enumeration_type ] [E] -// CHECK: [[TEST3]] = {{.*}} ; [ DW_TAG_namespace ] [test3] -enum E : int { e }; -void func(E *) { -} -} - -namespace test4 { -// CHECK: metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST4:![0-9]*]], {{.*}}, metadata [[TEST_ENUMS]], {{[^,]*}}, null, null, metadata !"_ZTSN5test41EE"} ; [ DW_TAG_enumeration_type ] [E] -// CHECK: [[TEST4]] = {{.*}} ; [ DW_TAG_namespace ] [test4] -enum E : int; -void f1(E *) { -} -enum E : int { e }; -void f2(E) { -} -} - -// CHECK: ; [ DW_TAG_enumeration_type ] [D] [line 6, size 16, align 16, offset 0] [decl] [from ] - -namespace test5 { -// CHECK: metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST5:![0-9]*]], {{.*}}, null, {{[^,]*}}, null, null, metadata !"_ZTSN5test51EE"} ; [ DW_TAG_enumeration_type ] [E] -// CHECK: [[TEST5]] = {{.*}} ; [ DW_TAG_namespace ] [test5] -enum E : int; -void f1(E *) { -} -}