[PATCH] D131891: [clang][dataflow] Debug string for value kinds.

weiyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 15 07:34:04 PDT 2022


wyt created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
wyt requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131891

Files:
  clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
  clang/lib/Analysis/FlowSensitive/DebugSupport.cpp


Index: clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
+++ clang/lib/Analysis/FlowSensitive/DebugSupport.cpp
@@ -31,6 +31,32 @@
 using llvm::fmt_pad;
 using llvm::formatv;
 
+std::string debugString(Value::Kind Kind) {
+  switch (Kind) {
+  case Value::Kind::Integer:
+    return "Integer";
+  case Value::Kind::Reference:
+    return "Reference";
+  case Value::Kind::Pointer:
+    return "Pointer";
+  case Value::Kind::Struct:
+    return "Struct";
+  case Value::Kind::AtomicBool:
+    return "AtomicBool";
+  case Value::Kind::Conjunction:
+    return "Conjunction";
+  case Value::Kind::Disjunction:
+    return "Disjunction";
+  case Value::Kind::Negation:
+    return "Negation";
+  case Value::Kind::Implication:
+    return "Implication";
+  case Value::Kind::Biconditional:
+    return "Biconditional";
+  }
+  llvm_unreachable("Unhandled value kind");
+}
+
 std::string debugString(Solver::Result::Assignment Assignment) {
   switch (Assignment) {
   case Solver::Result::Assignment::AssignedFalse:
Index: clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
===================================================================
--- clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
+++ clang/include/clang/Analysis/FlowSensitive/DebugSupport.h
@@ -24,6 +24,9 @@
 namespace clang {
 namespace dataflow {
 
+/// Returns a string representation of a value kind.
+std::string debugString(Value::Kind Kind);
+
 /// Returns a string representation of a boolean assignment to true or false.
 std::string debugString(Solver::Result::Assignment Assignment);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131891.452663.patch
Type: text/x-patch
Size: 1699 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220815/64d7cfb4/attachment.bin>


More information about the cfe-commits mailing list