[PATCH] D155067: [clang][dataflow] Strengthen flow condition assertions.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 04:05:37 PDT 2023


mboehme created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Instead of asserting merely that the flow condition doesn't imply that a
variable is true, make the stronger assertion that the flow condition implies
that the variable is false.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155067

Files:
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp


Index: clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
===================================================================
--- clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
+++ clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
@@ -3530,7 +3530,7 @@
         EXPECT_TRUE(EnvThen.flowConditionImplies(BarValThen));
 
         auto &BarValElse = *cast<BoolValue>(EnvElse.getValue(*BarDecl));
-        EXPECT_FALSE(EnvElse.flowConditionImplies(BarValElse));
+        EXPECT_TRUE(EnvElse.flowConditionImplies(EnvElse.makeNot(BarValElse)));
       });
 }
 
@@ -3561,7 +3561,7 @@
         ASSERT_THAT(BarDecl, NotNull());
 
         auto &BarValThen = *cast<BoolValue>(EnvThen.getValue(*BarDecl));
-        EXPECT_FALSE(EnvThen.flowConditionImplies(BarValThen));
+        EXPECT_TRUE(EnvThen.flowConditionImplies(EnvThen.makeNot(BarValThen)));
 
         auto &BarValElse = *cast<BoolValue>(EnvElse.getValue(*BarDecl));
         EXPECT_TRUE(EnvElse.flowConditionImplies(BarValElse));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155067.539488.patch
Type: text/x-patch
Size: 1001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230712/35cc7118/attachment.bin>


More information about the cfe-commits mailing list