[llvm-commits] [llvm-gcc-4.2] r94196 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h

Devang Patel dpatel at apple.com
Fri Jan 22 11:08:20 PST 2010


Author: dpatel
Date: Fri Jan 22 13:08:20 2010
New Revision: 94196

URL: http://llvm.org/viewvc/llvm-project?rev=94196&view=rev
Log:
Use unique names for MDNodes created to hold forward refernce of a subroutine type.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-debug.h

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=94196&r1=94195&r2=94196&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Fri Jan 22 13:08:20 2010
@@ -208,6 +208,8 @@
 , PrevFullPath("")
 , PrevLineNo(0)
 , PrevBB(NULL)
+, CurrentGCCLexicalBlock(NULL)
+, FwdTypeCount(0)
 , RegionStack()
 {}
 
@@ -583,10 +585,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());

Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=94196&r1=94195&r2=94196&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Fri Jan 22 13:08:20 2010
@@ -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 





More information about the llvm-commits mailing list