Skip to content

Commit

Permalink
[dataflow] handle missing case in value debug strings
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D146625
  • Loading branch information
sam-mccall committed Mar 25, 2023
1 parent ead2d86 commit d630134
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class DebugStringGenerator {
S = getAtomName(&cast<AtomicBoolValue>(B));
break;
}
case Value::Kind::TopBool: {
S = "top";
break;
}
case Value::Kind::Conjunction: {
auto &C = cast<ConjunctionValue>(B);
auto L = debugString(C.getLeftSubValue(), Depth + 1);
Expand Down
9 changes: 8 additions & 1 deletion clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ TEST(BoolValueDebugStringTest, AtomicBoolean) {
auto B = Ctx.atom();

auto Expected = R"(B0)";
debugString(*B);
EXPECT_THAT(debugString(*B), StrEq(Expected));
}

TEST(BoolValueDebugStringTest, Top) {
ConstraintContext Ctx;
auto B = Ctx.top();

auto Expected = R"(top)";
EXPECT_THAT(debugString(*B), StrEq(Expected));
}

Expand Down

0 comments on commit d630134

Please sign in to comment.