summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-10-16 18:18:03 +0000
committerDevang Patel <dpatel@apple.com>2009-10-16 18:18:03 +0000
commit149aa7cce368a879e3ad20b2a6ec777e9441cdab (patch)
treec35dba744843e6917f593a8476dac59830361f06 /lib
parent136526ce2d2ea86450f4205e20f3fda24ac16a5b (diff)
downloadllvm-149aa7cce368a879e3ad20b2a6ec777e9441cdab.tar.gz
llvm-149aa7cce368a879e3ad20b2a6ec777e9441cdab.tar.bz2
llvm-149aa7cce368a879e3ad20b2a6ec777e9441cdab.tar.xz
If there is not any llvm instruction associated with each lexical scope encoded in debug info then create such scope on demand for variable info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 2914851095..87e808ff9a 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1811,10 +1811,18 @@ void DwarfDebug::CollectVariableInfo() {
DIVariable DV (Var);
if (DV.isNull()) continue;
unsigned VSlot = VI->second;
+ DbgScope *Scope = NULL;
DenseMap<MDNode *, DbgScope *>::iterator DSI =
DbgScopeMap.find(DV.getContext().getNode());
- assert (DSI != DbgScopeMap.end() && "Unable to find variable scope!");
- DbgScope *Scope = DSI->second;
+ if (DSI != DbgScopeMap.end())
+ Scope = DSI->second;
+ else
+ // There is not any instruction assocated with this scope, so get
+ // a new scope.
+ Scope = getDbgScope(DV.getContext().getNode(),
+ NULL /* Not an instruction */,
+ NULL /* Not inlined */);
+ assert (Scope && "Unable to find variable scope!");
Scope->AddVariable(new DbgVariable(DV, VSlot, false));
}
}