[cfe-commits] r47649 - /cfe/trunk/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Tue Feb 26 16:28:17 PST 2008
Author: kremenek
Date: Tue Feb 26 18:28:17 2008
New Revision: 47649
URL: http://llvm.org/viewvc/llvm-project?rev=47649&view=rev
Log:
Fixed CFG construction bug that occurred when a condition for a loop spanned
multiple basic blocks (which can happen when they contain '&&', '||', '?'). The
bug was that the loop backedge when to the last block in the loop condition, not
the first.
Modified:
cfe/trunk/AST/CFG.cpp
Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=47649&r1=47648&r2=47649&view=diff
==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Tue Feb 26 18:28:17 2008
@@ -656,7 +656,7 @@
CFGBlock* BodyBlock = Visit(F->getBody());
if (!BodyBlock)
- BodyBlock = ExitConditionBlock; // can happen for "for (...;...; ) ;"
+ BodyBlock = EntryConditionBlock; // can happen for "for (...;...; ) ;"
else if (Block)
FinishBlock(BodyBlock);
@@ -710,6 +710,7 @@
if (Stmt* C = W->getCond()) {
Block = ExitConditionBlock;
EntryConditionBlock = addStmt(C);
+ assert (Block == EntryConditionBlock);
if (Block) FinishBlock(EntryConditionBlock);
}
@@ -739,7 +740,7 @@
CFGBlock* BodyBlock = Visit(W->getBody());
if (!BodyBlock)
- BodyBlock = ExitConditionBlock; // can happen for "while(...) ;"
+ BodyBlock = EntryConditionBlock; // can happen for "while(...) ;"
else if (Block)
FinishBlock(BodyBlock);
@@ -817,7 +818,7 @@
BodyBlock = Visit(D->getBody());
if (!BodyBlock)
- BodyBlock = ExitConditionBlock; // can happen for "do ; while(...)"
+ BodyBlock = EntryConditionBlock; // can happen for "do ; while(...)"
else if (Block)
FinishBlock(BodyBlock);
More information about the cfe-commits
mailing list