Author: Sam McCall Date: 2023-03-25T04:20:06+01:00 New Revision: d630134f1f1f83291177310c6fcf0dc7274f6494
URL: https://github.com/llvm/llvm-project/commit/d630134f1f1f83291177310c6fcf0dc7274f6494 DIFF: https://github.com/llvm/llvm-project/commit/d630134f1f1f83291177310c6fcf0dc7274f6494.diff LOG: [dataflow] handle missing case in value debug strings Differential Revision: https://reviews.llvm.org/D146625 Added: Modified: clang/lib/Analysis/FlowSensitive/DebugSupport.cpp clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp Removed: ################################################################################ diff --git a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp b/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp index d4886f154b33..6ac90e3970cc 100644 --- a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp +++ b/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp @@ -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); diff --git a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp index 6dded4b26702..810ba82e4c33 100644 --- a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp @@ -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)); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits