[clang] [clang][dataflow] Refactor `widen` API to be explicit about change effect. (PR #87233)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 05:22:16 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 a1a8bb1d3ae9a535526aba9514e87f76e2d040fa 6889df911a11fc5c27149f138176166aef3e1f73 -- clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
index 8e4e846e59..0a37d9d68e 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
@@ -142,12 +142,12 @@ public:
// The default implementation reduces to just comparison, since comparison
// is required by the API, even if no widening is performed.
switch (compare(Type, Prev, PrevEnv, Current, CurrentEnv)) {
- case ComparisonResult::Unknown:
- return std::nullopt;
- case ComparisonResult::Same:
- return WidenResult{&Current, LatticeJoinEffect::Unchanged};
- case ComparisonResult::Different:
- return WidenResult{&Current, LatticeJoinEffect::Changed};
+ case ComparisonResult::Unknown:
+ return std::nullopt;
+ case ComparisonResult::Same:
+ return WidenResult{&Current, LatticeJoinEffect::Unchanged};
+ case ComparisonResult::Different:
+ return WidenResult{&Current, LatticeJoinEffect::Changed};
}
llvm_unreachable("all cases in switch covered");
}
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
index d41f03262e..8ae51b7cdb 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
@@ -170,9 +170,10 @@ namespace {
using WidenResult = Environment::ValueModel::WidenResult;
}
-static WidenResult widenDistinctValues(
- QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current,
- Environment &CurrentEnv, Environment::ValueModel &Model) {
+static WidenResult widenDistinctValues(QualType Type, Value &Prev,
+ const Environment &PrevEnv,
+ Value &Current, Environment &CurrentEnv,
+ Environment::ValueModel &Model) {
// Boolean-model widening.
if (auto *PrevBool = dyn_cast<BoolValue>(&Prev)) {
if (isa<TopBoolValue>(Prev))
``````````
</details>
https://github.com/llvm/llvm-project/pull/87233
More information about the cfe-commits
mailing list