[clang] [clang][dataflow] Expand debug dumping of `Value`s. (PR #71527)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 7 04:04:33 PST 2023
https://github.com/martinboehme created https://github.com/llvm/llvm-project/pull/71527
None
>From 4a07c0ae8021d77da1cec7932e02a05a37f35f51 Mon Sep 17 00:00:00 2001
From: Martin Braenne <mboehme at google.com>
Date: Tue, 7 Nov 2023 12:02:32 +0000
Subject: [PATCH] [clang][dataflow] Expand debug dumping of `Value`s.
---
clang/lib/Analysis/FlowSensitive/Value.cpp | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
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