[llvm-commits] [dragonegg] r112407 - /dragonegg/trunk/llvm-debug.cpp

Duncan Sands baldrick at free.fr
Sat Aug 28 21:45:39 PDT 2010


Author: baldrick
Date: Sat Aug 28 23:45:39 2010
New Revision: 112407

URL: http://llvm.org/viewvc/llvm-project?rev=112407&view=rev
Log:
Port commit 111689 (djg) from llvm-gcc:
Use DIFactor::CreateTemporaryType.

Modified:
    dragonegg/trunk/llvm-debug.cpp

Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=112407&r1=112406&r2=112407&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Sat Aug 28 23:45:39 2010
@@ -529,15 +529,7 @@
 
   // 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,
-                                     getOrCreateFile(main_input_filename),
-                                     FwdTypeName,
-                                     getOrCreateFile(main_input_filename),
-                                     0, 0, 0, 0, 0,
-                                     llvm::DIType(), llvm::DIArray());
+  llvm::DIType FwdType = DebugFactory.CreateTemporaryType();
   llvm::MDNode *FTN = FwdType;
   llvm::TrackingVH<llvm::MDNode> FwdTypeNode = FTN;
   TypeCache[type] = WeakVH(FwdType);
@@ -583,7 +575,7 @@
 
   // Now that we have a real decl for the struct, replace anything using the
   // old decl with the new one.  This will recursively update the debug info.
-  llvm::DIDerivedType(FwdTypeNode).replaceAllUsesWith(RealType);
+  llvm::DIType(FwdTypeNode).replaceAllUsesWith(RealType);
 
   return RealType;
 }
@@ -759,19 +751,6 @@
   // recursive) and replace all  uses of the forward declaration with the
   // final definition.
   expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false);
-  // FIXME: findRegion() is not able to find context all the time. This
-  // means when type names in different context match then FwdDecl is
-  // reused because MDNodes are uniqued. To avoid this, use type context
-  /// also while creating FwdDecl for now.
-  std::string FwdName;
-  if (TYPE_CONTEXT(type)) {
-    StringRef TypeContextName = GetNodeName(TYPE_CONTEXT(type));
-    if (!TypeContextName.empty())
-      FwdName = TypeContextName;
-  }
-  StringRef TypeName = GetNodeName(type);
-  if (!TypeName.empty())
-    FwdName = FwdName + TypeName.data();
   unsigned SFlags = 0;
   DIDescriptor TyContext =  findRegion(TYPE_CONTEXT(type));
 
@@ -787,7 +766,7 @@
     llvm::DICompositeType FwdDecl =
       DebugFactory.CreateCompositeType(Tag,
                                        TyContext,
-                                       FwdName.c_str(),
+                                       GetNodeName(type),
                                        getOrCreateFile(Loc.file),
                                        Loc.line,
                                        0, 0, 0,
@@ -959,7 +938,7 @@
 
   // Now that we have a real decl for the struct, replace anything using the
   // old decl with the new one.  This will recursively update the debug info.
-  llvm::DIDerivedType(FwdDeclNode).replaceAllUsesWith(RealDecl);
+  llvm::DIType(FwdDeclNode).replaceAllUsesWith(RealDecl);
 
   return RealDecl;
 }





More information about the llvm-commits mailing list