[llvm-commits] [llvm] r100224 - /llvm/trunk/lib/Analysis/DebugInfo.cpp
Chris Lattner
sabre at nondot.org
Fri Apr 2 13:44:29 PDT 2010
Author: lattner
Date: Fri Apr 2 15:44:29 2010
New Revision: 100224
URL: http://llvm.org/viewvc/llvm-project?rev=100224&view=rev
Log:
DebugInfoFinder::processModule was foiling my plot by
materializing an MDNode for every debugloc. don't do that! :)
"clang -g -S t.c" really no longer makes mdnodes for location
tuples now.
Modified:
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=100224&r1=100223&r2=100224&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Fri Apr 2 15:44:29 2010
@@ -1146,16 +1146,31 @@
/// processModule - Process entire module and collect debug info.
void DebugInfoFinder::processModule(Module &M) {
- unsigned MDDbgKind = M.getMDKindID("dbg");
-
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
++BI) {
- if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI))
+ if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(BI)) {
processDeclare(DDI);
- else if (MDNode *L = BI->getMetadata(MDDbgKind))
- processLocation(DILocation(L));
+ continue;
+ }
+
+ DebugLoc Loc = BI->getDebugLoc();
+ if (Loc.isUnknown())
+ continue;
+
+ LLVMContext &Ctx = BI->getContext();
+ DIDescriptor Scope(Loc.getScope(Ctx));
+
+ if (Scope.isCompileUnit())
+ addCompileUnit(DICompileUnit(Scope.getNode()));
+ else if (Scope.isSubprogram())
+ processSubprogram(DISubprogram(Scope.getNode()));
+ else if (Scope.isLexicalBlock())
+ processLexicalBlock(DILexicalBlock(Scope.getNode()));
+
+ if (MDNode *IA = Loc.getInlinedAt(Ctx))
+ processLocation(DILocation(IA));
}
NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv");
More information about the llvm-commits
mailing list