Skip to content

Commit a7544b6

Browse files
committed
fixup! [clang][dataflow] Model conditional operator correctly.
1 parent e6f729d commit a7544b6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clang/lib/Analysis/FlowSensitive/Transfer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,9 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
655655
if (TrueLoc == FalseLoc && TrueLoc != nullptr)
656656
Env.setStorageLocation(*S, *TrueLoc);
657657
} else if (!S->getType()->isRecordType()) {
658+
// The conditional operator can evaluate to either of the values of the
659+
// two branches. To model this, join these two values together to yield
660+
// the result of the conditional operator.
658661
if (Value *Val = Environment::joinValues(
659662
S->getType(), TrueEnv->getValue(*S->getTrueExpr()), *TrueEnv,
660663
FalseEnv->getValue(*S->getFalseExpr()), *FalseEnv, Env, Model))

0 commit comments

Comments
 (0)