diff --git a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h --- a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h +++ b/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); diff --git a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp b/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp --- a/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp +++ b/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: