merge r94196 from mainline.
llvm-svn: 95276
diff --git a/llvm-gcc-4.2/gcc/llvm-debug.cpp b/llvm-gcc-4.2/gcc/llvm-debug.cpp
index 7fcff95..986641f 100644
--- a/llvm-gcc-4.2/gcc/llvm-debug.cpp
+++ b/llvm-gcc-4.2/gcc/llvm-debug.cpp
@@ -208,6 +208,8 @@
, PrevFullPath("")
, PrevLineNo(0)
, PrevBB(NULL)
+, CurrentGCCLexicalBlock(NULL)
+, FwdTypeCount(0)
, RegionStack()
{}
@@ -582,10 +584,12 @@
// Create a place holder type first. The may be used as a context
// for the argument types.
+ char *FwdTypeName = (char *)alloca(65);
+ sprintf(FwdTypeName, "fwd.type.%d", FwdTypeCount++);
llvm::DIType FwdType =
DebugFactory.CreateCompositeType(llvm::dwarf::DW_TAG_subroutine_type,
getOrCreateCompileUnit(NULL),
- StringRef(),
+ FwdTypeName,
getOrCreateCompileUnit(NULL),
0, 0, 0, 0, 0,
llvm::DIType(), llvm::DIArray());
diff --git a/llvm-gcc-4.2/gcc/llvm-debug.h b/llvm-gcc-4.2/gcc/llvm-debug.h
index 0e85a13..83ccfa5 100644
--- a/llvm-gcc-4.2/gcc/llvm-debug.h
+++ b/llvm-gcc-4.2/gcc/llvm-debug.h
@@ -62,7 +62,15 @@
const char *PrevFullPath; // Previous location file encountered.
int PrevLineNo; // Previous location line# encountered.
BasicBlock *PrevBB; // Last basic block encountered.
- tree_node *CurrentGCCLexicalBlock; // Current GCC lexical block (or enclosing FUNCTION_DECL).
+
+ // Current GCC lexical block (or enclosing FUNCTION_DECL).
+ tree_node *CurrentGCCLexicalBlock;
+
+ // This counter counts debug info for forward referenced subroutine types.
+ // This counter is used to create unique name for such types so that their
+ // debug info (through MDNodes) is not shared accidently.
+ unsigned FwdTypeCount;
+
std::map<std::string, WeakVH > CUCache;
std::map<tree_node *, WeakVH > TypeCache;
// Cache of previously constructed