[clang] [clang][dataflow] Factor out built-in boolean model into an explicit module. (PR #82950)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 10:06:43 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff cb6f657a70f7a8d6ecd4fcc2101550a7400f94a7 16cdcfa9471a089af7e87b0dbea5941d3975c8b9 -- clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h clang/include/clang/Analysis/FlowSensitive/Transfer.h clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp clang/lib/Analysis/FlowSensitive/Transfer.cpp clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp clang/unittests/Analysis/FlowSensitive/TransferTest.cpp clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
index 5949af2905..18b658e156 100644
--- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -568,9 +568,8 @@ const Formula &evaluateEquality(Arena &A, const Formula &EqVal,
   // b) (!LHS & !RHS) => EqVal
   //    If neither is set, then they are equal.
   // We rewrite b) as !EqVal => (LHS v RHS), for a more compact formula.
-  return A.makeAnd(
-      A.makeImplies(EqVal, A.makeEquals(LHS, RHS)),
-      A.makeImplies(A.makeNot(EqVal), A.makeOr(LHS, RHS)));
+  return A.makeAnd(A.makeImplies(EqVal, A.makeEquals(LHS, RHS)),
+                   A.makeImplies(A.makeNot(EqVal), A.makeOr(LHS, RHS)));
 }
 
 void transferOptionalAndOptionalCmp(const clang::CXXOperatorCallExpr *CmpExpr,
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
index f6e8f26585..ff0ddc2d12 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp
@@ -1382,7 +1382,8 @@ protected:
 
 INSTANTIATE_TEST_SUITE_P(
     UncheckedOptionalUseTestInst, UncheckedOptionalAccessTest,
-    ::testing::Values(OptionalTypeIdentifier{"std", "optional"}// ,
+    ::testing::Values(OptionalTypeIdentifier{"std", "optional"}
+                      // ,
                       // OptionalTypeIdentifier{"absl", "optional"},
                       // OptionalTypeIdentifier{"base", "Optional"}
                       ),

``````````

</details>


https://github.com/llvm/llvm-project/pull/82950


More information about the cfe-commits mailing list