r202898 - [CFG] Tweak "?:" CFG construction to record the unreachable blocks.
Ted Kremenek
kremenek at apple.com
Tue Mar 4 13:53:26 PST 2014
Author: kremenek
Date: Tue Mar 4 15:53:26 2014
New Revision: 202898
URL: http://llvm.org/viewvc/llvm-project?rev=202898&view=rev
Log:
[CFG] Tweak "?:" CFG construction to record the unreachable blocks.
Modified:
cfe/trunk/lib/Analysis/CFG.cpp
Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=202898&r1=202897&r2=202898&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Tue Mar 4 15:53:26 2014
@@ -1634,8 +1634,8 @@ CFGBlock *CFGBuilder::VisitConditionalOp
// See if this is a known constant.
const TryResult& KnownVal = tryEvaluateBool(C->getCond());
- addSuccessor(Block, KnownVal.isFalse() ? NULL : LHSBlock);
- addSuccessor(Block, KnownVal.isTrue() ? NULL : RHSBlock);
+ addSuccessor(Block, LHSBlock, !KnownVal.isFalse());
+ addSuccessor(Block, RHSBlock, !KnownVal.isTrue());
Block->setTerminator(C);
Expr *condExpr = C->getCond();
@@ -3408,7 +3408,7 @@ CFGBlock *CFGBuilder::VisitConditionalOp
const TryResult &KnownVal = tryEvaluateBool(E->getCond());
if (LHSBlock) {
- addSuccessor(Block, KnownVal.isFalse() ? NULL : LHSBlock);
+ addSuccessor(Block, LHSBlock, !KnownVal.isFalse());
} else if (KnownVal.isFalse()) {
addSuccessor(Block, NULL);
} else {
@@ -3418,7 +3418,8 @@ CFGBlock *CFGBuilder::VisitConditionalOp
if (!RHSBlock)
RHSBlock = ConfluenceBlock;
- addSuccessor(Block, KnownVal.isTrue() ? NULL : RHSBlock);
+
+ addSuccessor(Block, RHSBlock, !KnownVal.isTrue());
return Block;
}
More information about the cfe-commits
mailing list