diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2022-07-23 01:23:17 +0200 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2022-07-23 01:31:53 +0200 |
commit | b5414b566a5aedd90e41f01dd2b7b632afc5d5b7 (patch) | |
tree | e9ada2143f144fef9d1e80da44dc212dac49ed08 /clang/include | |
parent | 1e4478bbea727dbbffb1023eedfc24eae7185782 (diff) | |
download | llvm-b5414b566a5aedd90e41f01dd2b7b632afc5d5b7.zip llvm-b5414b566a5aedd90e41f01dd2b7b632afc5d5b7.tar.gz llvm-b5414b566a5aedd90e41f01dd2b7b632afc5d5b7.tar.bz2 |
[clang][dataflow] Add DataflowEnvironment::dump()
Start by dumping the flow condition.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D130398
Diffstat (limited to 'clang/include')
3 files changed, 19 insertions, 1 deletions
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h index 358ace0..abc3183 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h @@ -23,6 +23,7 @@ #include "clang/Analysis/FlowSensitive/Value.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/Support/Compiler.h" #include <cassert> #include <memory> #include <type_traits> @@ -251,6 +252,8 @@ public: /// `Val2` imposed by the flow condition. bool equivalentBoolValues(BoolValue &Val1, BoolValue &Val2); + LLVM_DUMP_METHOD void dumpFlowCondition(AtomicBoolValue &Token); + private: struct NullableQualTypeDenseMapInfo : private llvm::DenseMapInfo<QualType> { static QualType getEmptyKey() { diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h index ce195f0..f17df36 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h @@ -19,7 +19,6 @@ #include "clang/AST/DeclBase.h" #include "clang/AST/Expr.h" #include "clang/AST/Type.h" -#include "clang/AST/TypeOrdering.h" #include "clang/Analysis/FlowSensitive/DataflowAnalysisContext.h" #include "clang/Analysis/FlowSensitive/DataflowLattice.h" #include "clang/Analysis/FlowSensitive/StorageLocation.h" @@ -325,6 +324,8 @@ public: /// imply that `Val` is true. bool flowConditionImplies(BoolValue &Val) const; + LLVM_DUMP_METHOD void dump() const; + private: /// Creates a value appropriate for `Type`, if `Type` is supported, otherwise /// return null. diff --git a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h index 74367d2..b8efdeb 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h +++ b/clang/include/clang/Analysis/FlowSensitive/DebugSupport.h @@ -43,6 +43,20 @@ std::string debugString( llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}}); /// Returns a string representation for `Constraints` - a collection of boolean +/// formulas. +/// +/// Atomic booleans appearing in the boolean value `Constraints` are assigned to +/// labels either specified in `AtomNames` or created by default rules as B0, +/// B1, ... +/// +/// Requirements: +/// +/// Names assigned to atoms should not be repeated in `AtomNames`. +std::string debugString( + const llvm::DenseSet<BoolValue *> &Constraints, + llvm::DenseMap<const AtomicBoolValue *, std::string> AtomNames = {{}}); + +/// Returns a string representation for `Constraints` - a collection of boolean /// formulas and the `Result` of satisfiability checking. /// /// Atomic booleans appearing in `Constraints` and `Result` are assigned to |