[clang] [clang][dataflow] Expand debug dumping of `Value`s. (PR #71527)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 7 04:05:00 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (martinboehme)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/71527.diff
1 Files Affected:
- (modified) clang/lib/Analysis/FlowSensitive/Value.cpp (+12-7)
``````````diff
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() << ")";
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/71527
More information about the cfe-commits
mailing list