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/unittests | |
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/unittests')
-rw-r--r-- | clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp index d59de0a..6b9321b 100644 --- a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp @@ -188,6 +188,31 @@ TEST(BoolValueDebugStringTest, ComplexBooleanWithSomeNames) { StrEq(Expected)); } +TEST(ConstraintSetDebugStringTest, Empty) { + llvm::DenseSet<BoolValue *> Constraints; + EXPECT_THAT(debugString(Constraints), StrEq("")); +} + +TEST(ConstraintSetDebugStringTest, Simple) { + ConstraintContext Ctx; + llvm::DenseSet<BoolValue *> Constraints; + auto X = cast<AtomicBoolValue>(Ctx.atom()); + auto Y = cast<AtomicBoolValue>(Ctx.atom()); + Constraints.insert(Ctx.disj(X, Y)); + Constraints.insert(Ctx.disj(X, Ctx.neg(Y))); + + auto Expected = R"((or + X + (not + Y)) +(or + X + Y) +)"; + EXPECT_THAT(debugString(Constraints, {{X, "X"}, {Y, "Y"}}), + StrEq(Expected)); +} + Solver::Result CheckSAT(std::vector<BoolValue *> Constraints) { llvm::DenseSet<BoolValue *> ConstraintsSet(Constraints.begin(), Constraints.end()); |