aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-08-17 21:00:06 +0000
committerTed Kremenek <kremenek@apple.com>2010-08-17 21:00:06 +0000
commit334c19566104d3333cf662f0017088a18eddfa81 (patch)
treed01beacfc7c3aee262386ba70c37fcae092d06f6 /lib/Analysis/CFG.cpp
parentd173dc7825e999edab836f8215a82a96eae7c738 (diff)
Fix horrible CFG bug caused by a series of NullStmts appearing at the beginning of a do...while loop. This would cause
the body of the DoStmt to be disconnected from the preceding code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r--lib/Analysis/CFG.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index 1d5d8521ad..da7f36a132 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -702,7 +702,10 @@ CFGBlock* CFGBuilder::VisitCompoundStmt(CompoundStmt* C) {
for (CompoundStmt::reverse_body_iterator I=C->body_rbegin(), E=C->body_rend();
I != E; ++I ) {
- LastBlock = addStmt(*I);
+ // If we hit a segment of code just containing ';' (NullStmts), we can
+ // get a null block back. In such cases, just use the LastBlock
+ if (CFGBlock *newBlock = addStmt(*I))
+ LastBlock = newBlock;
if (badCFG)
return NULL;