[clang] 64ed4ed - [clang][dataflow] Expand debug dumping of `Value`s. (#71527)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 7 20:41:29 PST 2023


Author: martinboehme
Date: 2023-11-08T05:41:26+01:00
New Revision: 64ed4edca8e76e2ce2586584fdcb3b906532aa18

URL: https://github.com/llvm/llvm-project/commit/64ed4edca8e76e2ce2586584fdcb3b906532aa18
DIFF: https://github.com/llvm/llvm-project/commit/64ed4edca8e76e2ce2586584fdcb3b906532aa18.diff

LOG: [clang][dataflow] Expand debug dumping of `Value`s. (#71527)

Added: 
    

Modified: 
    clang/lib/Analysis/FlowSensitive/Value.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/FlowSensitive/Value.cpp b/clang/lib/Analysis/FlowSensitive/Value.cpp
index b069c1cd3da1171..80dde7c8d582358 100644
--- a/clang/lib/Analysis/FlowSensitive/Value.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Value.cpp
@@ -34,13 +34,18 @@ bool areEquivalentValues(const Value &Val1, const Value &Val2) {
 
 raw_ostream &operator<<(raw_ostream &OS, const Value &Val) {
   switch (Val.getKind()) {
-  case Value::Kind::Pointer: {
-    const auto *PV = dyn_cast<PointerValue>(&Val);
-    return OS << "Pointer(" << &PV->getPointeeLoc() << ")";
-  }
-  // FIXME: support remaining cases.
-  default:
-    return OS << debugString(Val.getKind());
+  case Value::Kind::Integer:
+    return OS << "Integer(@" << &Val << ")";
+  case Value::Kind::Pointer:
+    return OS << "Pointer(" << &cast<PointerValue>(Val).getPointeeLoc() << ")";
+  case Value::Kind::Record:
+    return OS << "Record(" << &cast<RecordValue>(Val).getLoc() << ")";
+  case Value::Kind::TopBool:
+    return OS << "TopBool(" << cast<TopBoolValue>(Val).getAtom() << ")";
+  case Value::Kind::AtomicBool:
+    return OS << "AtomicBool(" << cast<AtomicBoolValue>(Val).getAtom() << ")";
+  case Value::Kind::FormulaBool:
+    return OS << "FormulaBool(" << cast<FormulaBoolValue>(Val).formula() << ")";
   }
 }
 


        


More information about the cfe-commits mailing list