[llvm-commits] [llvm-gcc-4.2] r111689 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
Dan Gohman
gohman at apple.com
Fri Aug 20 15:40:14 PDT 2010
Author: djg
Date: Fri Aug 20 17:40:14 2010
New Revision: 111689
URL: http://llvm.org/viewvc/llvm-project?rev=111689&view=rev
Log:
Use DIFactor::CreateTemporaryType.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp
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=111689&r1=111688&r2=111689&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Fri Aug 20 17:40:14 2010
@@ -772,15 +772,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,
- findRegion(TYPE_CONTEXT(type)),
- 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);
@@ -826,7 +818,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;
}
@@ -1002,19 +994,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;
if (TYPE_BLOCK_IMPL_STRUCT(type))
SFlags |= llvm::DIType::FlagAppleBlock;
@@ -1029,15 +1008,7 @@
if (MDNode *TN = dyn_cast_or_null<MDNode>(I->second))
return DIType(TN);
- llvm::DICompositeType FwdDecl =
- DebugFactory.CreateCompositeType(Tag,
- TyContext,
- FwdName.c_str(),
- getOrCreateFile(Loc.file),
- Loc.line,
- 0, 0, 0, SFlags | llvm::DIType::FlagFwdDecl,
- llvm::DIType(), llvm::DIArray(),
- RunTimeLang);
+ llvm::DIType FwdDecl = DebugFactory.CreateTemporaryType();
// forward declaration,
if (TYPE_SIZE(type) == 0)
@@ -1203,7 +1174,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