aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
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 2914851..87e808f 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));
}
}