[llvm-commits] [llvm-gcc-4.2] r79978 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h
Devang Patel
dpatel at apple.com
Mon Aug 24 22:25:03 PDT 2009
Author: dpatel
Date: Tue Aug 25 00:25:02 2009
New Revision: 79978
URL: http://llvm.org/viewvc/llvm-project?rev=79978&view=rev
Log:
DebugInfo now uses MDNodes to encode compile units.
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=79978&r1=79977&r2=79978&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Tue Aug 25 00:25:02 2009
@@ -576,10 +576,18 @@
// 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))
+ FwdName = GetNodeName(TYPE_CONTEXT(type));
+ FwdName = FwdName + GetNodeName(type);
llvm::DICompositeType FwdDecl =
DebugFactory.CreateCompositeType(Tag,
findRegion(type),
- GetNodeName(type),
+ FwdName,
getOrCreateCompileUnit(Loc.file),
Loc.line,
0, 0, 0, llvm::DIType::FlagFwdDecl,
@@ -859,7 +867,7 @@
bool isMain) {
if (!FullPath)
FullPath = main_input_filename;
- GlobalVariable *&CU = CUCache[FullPath];
+ MDNode *&CU = CUCache[FullPath];
if (CU)
return DICompileUnit(CU);
@@ -907,7 +915,7 @@
version_string, isMain,
optimize, Flags,
ObjcRunTimeVer);
- CU = NewCU.getGV();
+ CU = NewCU.getNode();
return NewCU;
}
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=79978&r1=79977&r2=79978&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Tue Aug 25 00:25:02 2009
@@ -59,7 +59,7 @@
const char *PrevFullPath; // Previous location file encountered.
int PrevLineNo; // Previous location line# encountered.
BasicBlock *PrevBB; // Last basic block encountered.
- std::map<std::string, GlobalVariable *> CUCache;
+ std::map<std::string, MDNode *> CUCache;
std::map<tree_node *, DIType> TypeCache;
// Cache of previously constructed
// Types.
More information about the llvm-commits
mailing list