Skip to content

Commit 86a18d3

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

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/Analysis/FlowSensitive/Transfer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,12 @@ class TransferVisitor : public ConstStmtVisitor<TransferVisitor> {
645645
const Environment *TrueEnv = StmtToEnv.getEnvironment(*S->getTrueExpr());
646646
const Environment *FalseEnv = StmtToEnv.getEnvironment(*S->getFalseExpr());
647647

648-
if (TrueEnv == nullptr || FalseEnv == nullptr)
648+
if (TrueEnv == nullptr || FalseEnv == nullptr) {
649+
// We should always have an environment as we should visit the true /
650+
// false branches before the conditional operator.
651+
assert(false);
649652
return;
653+
}
650654

651655
if (S->isGLValue()) {
652656
StorageLocation *TrueLoc = TrueEnv->getStorageLocation(*S->getTrueExpr());

0 commit comments

Comments
 (0)