diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-04-14 21:41:27 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-06-22 18:20:56 +0000 |
| commit | bdd1243df58e60e85101c09001d9812a789b6bc4 (patch) | |
| tree | a1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp | |
| parent | 781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff) | |
| parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) | |
Diffstat (limited to 'contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp')
| -rw-r--r-- | contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp index 714ad08643ed..d4886f154b33 100644 --- a/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp +++ b/contrib/llvm-project/clang/lib/Analysis/FlowSensitive/DebugSupport.cpp @@ -18,6 +18,7 @@ #include "clang/Analysis/FlowSensitive/Value.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormatAdapters.h" @@ -31,7 +32,35 @@ using llvm::AlignStyle; using llvm::fmt_pad; using llvm::formatv; -std::string debugString(Solver::Result::Assignment Assignment) { +llvm::StringRef 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::TopBool: + return "TopBool"; + 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"); +} + +llvm::StringRef debugString(Solver::Result::Assignment Assignment) { switch (Assignment) { case Solver::Result::Assignment::AssignedFalse: return "False"; @@ -41,7 +70,7 @@ std::string debugString(Solver::Result::Assignment Assignment) { llvm_unreachable("Booleans can only be assigned true/false"); } -std::string debugString(Solver::Result::Status Status) { +llvm::StringRef debugString(Solver::Result::Status Status) { switch (Status) { case Solver::Result::Status::Satisfiable: return "Satisfiable"; @@ -156,7 +185,7 @@ Constraints auto StatusString = clang::dataflow::debugString(Result.getStatus()); auto Solution = Result.getSolution(); - auto SolutionString = Solution ? "\n" + debugString(Solution.value()) : ""; + auto SolutionString = Solution ? "\n" + debugString(*Solution) : ""; return formatv( Template, |
