forked from OSchip/llvm-project
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. llvm-svn: 98083
This commit is contained in:
parent
3dde457b94
commit
4f26205ba8
|
@ -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());
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -g -S -o %t %s
|
||||
// PR: 6554
|
||||
// More then one anonymous aggregates on one line creates chaos when MDNode uniquness is
|
||||
// combined with RAUW operation.
|
||||
// This test case causes crashes if malloc is configured to trip buffer overruns.
|
||||
class MO {
|
||||
|
||||
union { struct { union { int BA; } Val; int Offset; } OffsetedInfo; } Contents;
|
||||
|
||||
};
|
||||
|
||||
class MO m;
|
Loading…
Reference in New Issue