[PATCH] D146625: [dataflow] handle missing case in value debug strings

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 07:48:03 PDT 2023


sammccall created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
sammccall published this revision for review.
sammccall added a reviewer: gribozavr2.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D146625

Files:
  clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
  clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp


Index: clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp
@@ -27,7 +27,14 @@
   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));
 }
 
Index: clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
+++ clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
@@ -106,6 +106,10 @@
       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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146625.507320.patch
Type: text/x-patch
Size: 1127 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230322/731bc48b/attachment.bin>


More information about the cfe-commits mailing list