[llvm-commits] [dragonegg] r94903 - in /dragonegg/trunk: llvm-debug.cpp llvm-debug.h

Duncan Sands baldrick at free.fr
Sat Jan 30 09:23:45 PST 2010


Author: baldrick
Date: Sat Jan 30 11:23:45 2010
New Revision: 94903

URL: http://llvm.org/viewvc/llvm-project?rev=94903&view=rev
Log:
Port commit 94196 (dpatel) from llvm-gcc:
Use unique names for MDNodes created to hold forward refernce of a subroutine type.

Modified:
    dragonegg/trunk/llvm-debug.cpp
    dragonegg/trunk/llvm-debug.h

Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=94903&r1=94902&r2=94903&view=diff

==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Sat Jan 30 11:23:45 2010
@@ -223,6 +223,7 @@
 , PrevFullPath("")
 , PrevLineNo(0)
 , PrevBB(NULL)
+, FwdTypeCount(0)
 , RegionStack()
 {}
 
@@ -501,10 +502,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: dragonegg/trunk/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.h?rev=94903&r1=94902&r2=94903&view=diff

==============================================================================
--- dragonegg/trunk/llvm-debug.h (original)
+++ dragonegg/trunk/llvm-debug.h Sat Jan 30 11:23:45 2010
@@ -57,6 +57,12 @@
   const char *PrevFullPath;             // Previous location file encountered.
   int PrevLineNo;                       // Previous location line# encountered.
   BasicBlock *PrevBB;                   // Last basic block encountered.
+  
+  // 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