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);


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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D146625: [dataflow] han... Sam McCall via Phabricator via cfe-commits

Reply via email to