diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index a4991f6b742a..ae1d6f9df0f5 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -1634,8 +1634,8 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C, // 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::VisitConditionalOperatorForTemporaryDtors( 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::VisitConditionalOperatorForTemporaryDtors( if (!RHSBlock) RHSBlock = ConfluenceBlock; - addSuccessor(Block, KnownVal.isTrue() ? NULL : RHSBlock); + + addSuccessor(Block, RHSBlock, !KnownVal.isTrue()); return Block; }