summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2014-10-13 20:44:58 +0000
committerAdrian Prantl <aprantl@apple.com>2014-10-13 20:44:58 +0000
commit049d21caea4cb66bfda771fa8f4e21b88dfd1364 (patch)
tree733def1e1aa6d1b1e2cabf06108a1b1f98d2cb6d
parent13c58820f8df2eb8b81ebce60f1ca5b2865c5943 (diff)
downloadbcm5719-llvm-049d21caea4cb66bfda771fa8f4e21b88dfd1364.tar.gz
bcm5719-llvm-049d21caea4cb66bfda771fa8f4e21b88dfd1364.zip
Add an assertion about the integrity of the iterator.
Broken parent scope pointers in inlined DIVariables can cause ensureAbstractVariableIsCreated to insert new abstract scopes, thus invalidating the iterator in this loop and leading to hard-to-debug crashes. Useful when manually reducing IR for testcases. llvm-svn: 219628
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 491681aafd2..6e641884d76 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1365,6 +1365,9 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
return;
}
+#ifndef NDEBUG
+ size_t NumAbstractScopes = LScopes.getAbstractScopesList().size();
+#endif
// Construct abstract scopes.
for (LexicalScope *AScope : LScopes.getAbstractScopesList()) {
DISubprogram SP(AScope->getScopeNode());
@@ -1377,6 +1380,8 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
if (!ProcessedVars.insert(DV))
continue;
ensureAbstractVariableIsCreated(DV, DV.getContext());
+ assert(LScopes.getAbstractScopesList().size() == NumAbstractScopes
+ && "ensureAbstractVariableIsCreated inserted abstract scopes");
}
constructAbstractSubprogramScopeDIE(AScope);
}
OpenPOWER on IntegriCloud