aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-03-09 21:32:27 +0000
committerDevang Patel <dpatel@apple.com>2010-03-09 21:32:27 +0000
commit7573f8b2f90ef65a253f7355fc466c93f0bc9832 (patch)
treebbcf3729107af9ea7ea1e4d157550a98f66ae9e8 /lib/CodeGen
parentaf652faa97aed78567527868f2c339f72c661d0a (diff)
More then one anonymous aggregates on one line creates chaos when MDNode uniquness is combined with RAUW operation. Right solution is to avoid using RAUW.
This fixes PR 6554. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp8
-rw-r--r--lib/CodeGen/CGDebugInfo.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 892669299c..02e5d07d6a 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -37,7 +37,7 @@ using namespace clang::CodeGen;
CGDebugInfo::CGDebugInfo(CodeGenModule &CGM)
: CGM(CGM), DebugFactory(CGM.getModule()),
- BlockLiteralGenericSet(false) {
+ FwdDeclCount(0), BlockLiteralGenericSet(false) {
CreateCompileUnit();
}
@@ -774,12 +774,12 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
// A RD->getName() is not unique. However, the debug info descriptors
// are uniqued so use type name to ensure uniquness.
- std::string STy = QualType(Ty, 0).getAsString();
+ char *FwdDeclName = (char *)alloca(65);
+ sprintf(FwdDeclName, "fwd.type.%d", FwdDeclCount++);
llvm::DIDescriptor FDContext =
getContextDescriptor(dyn_cast<Decl>(RD->getDeclContext()), Unit);
llvm::DICompositeType FwdDecl =
- DebugFactory.CreateCompositeType(Tag, FDContext,
- STy.c_str(),
+ DebugFactory.CreateCompositeType(Tag, FDContext, FwdDeclName,
DefUnit, Line, 0, 0, 0, 0,
llvm::DIType(), llvm::DIArray());
diff --git a/lib/CodeGen/CGDebugInfo.h b/lib/CodeGen/CGDebugInfo.h
index f71f3626be..47a4620483 100644
--- a/lib/CodeGen/CGDebugInfo.h
+++ b/lib/CodeGen/CGDebugInfo.h
@@ -45,11 +45,11 @@ class CGDebugInfo {
CodeGenModule &CGM;
llvm::DIFactory DebugFactory;
llvm::DICompileUnit TheCU;
-
SourceLocation CurLoc, PrevLoc;
-
llvm::DIType VTablePtrType;
-
+ /// FwdDeclCount - This counter is used to ensure unique names for forward
+ /// record decls.
+ unsigned FwdDeclCount;
/// TypeCache - Cache of previously constructed Types.
// FIXME: Eliminate this map. Be careful of iterator invalidation.