forked from OSchip/llvm-project
[CFG] Tweak "?:" CFG construction to record the unreachable blocks.
llvm-svn: 202898
This commit is contained in:
parent
841f1c782e
commit
5a09527d0d
|
@ -1634,8 +1634,8 @@ CFGBlock *CFGBuilder::VisitConditionalOperator(AbstractConditionalOperator *C,
|
||||||
|
|
||||||
// See if this is a known constant.
|
// See if this is a known constant.
|
||||||
const TryResult& KnownVal = tryEvaluateBool(C->getCond());
|
const TryResult& KnownVal = tryEvaluateBool(C->getCond());
|
||||||
addSuccessor(Block, KnownVal.isFalse() ? NULL : LHSBlock);
|
addSuccessor(Block, LHSBlock, !KnownVal.isFalse());
|
||||||
addSuccessor(Block, KnownVal.isTrue() ? NULL : RHSBlock);
|
addSuccessor(Block, RHSBlock, !KnownVal.isTrue());
|
||||||
Block->setTerminator(C);
|
Block->setTerminator(C);
|
||||||
Expr *condExpr = C->getCond();
|
Expr *condExpr = C->getCond();
|
||||||
|
|
||||||
|
@ -3408,7 +3408,7 @@ CFGBlock *CFGBuilder::VisitConditionalOperatorForTemporaryDtors(
|
||||||
const TryResult &KnownVal = tryEvaluateBool(E->getCond());
|
const TryResult &KnownVal = tryEvaluateBool(E->getCond());
|
||||||
|
|
||||||
if (LHSBlock) {
|
if (LHSBlock) {
|
||||||
addSuccessor(Block, KnownVal.isFalse() ? NULL : LHSBlock);
|
addSuccessor(Block, LHSBlock, !KnownVal.isFalse());
|
||||||
} else if (KnownVal.isFalse()) {
|
} else if (KnownVal.isFalse()) {
|
||||||
addSuccessor(Block, NULL);
|
addSuccessor(Block, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3418,7 +3418,8 @@ CFGBlock *CFGBuilder::VisitConditionalOperatorForTemporaryDtors(
|
||||||
|
|
||||||
if (!RHSBlock)
|
if (!RHSBlock)
|
||||||
RHSBlock = ConfluenceBlock;
|
RHSBlock = ConfluenceBlock;
|
||||||
addSuccessor(Block, KnownVal.isTrue() ? NULL : RHSBlock);
|
|
||||||
|
addSuccessor(Block, RHSBlock, !KnownVal.isTrue());
|
||||||
|
|
||||||
return Block;
|
return Block;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue