[clang] [clang][dataflow] Fix bug in `Value` comparison. (PR #76746)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 10 10:33:14 PST 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 11ac97c67a9315dce48fd938d68ae991e3559f10 b2a6821ea88f6ed3b38c6dca1e5c7aaeef4159a2 -- clang/lib/Analysis/FlowSensitive/Value.cpp clang/unittests/Analysis/FlowSensitive/ValueTest.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Analysis/FlowSensitive/Value.cpp b/clang/lib/Analysis/FlowSensitive/Value.cpp
index fa86874af3..7fad6deb0e 100644
--- a/clang/lib/Analysis/FlowSensitive/Value.cpp
+++ b/clang/lib/Analysis/FlowSensitive/Value.cpp
@@ -27,12 +27,16 @@ static bool areEquivalentIndirectionValues(const Value &Val1,
}
bool areEquivalentValues(const Value &Val1, const Value &Val2) {
- if (&Val1 == &Val2) return true;
- if (Val1.getKind() != Val2.getKind()) return false;
+ if (&Val1 == &Val2)
+ return true;
+ if (Val1.getKind() != Val2.getKind())
+ return false;
// If values are distinct and have properties, we don't consider them equal,
// leaving equality up to the user model.
- if (!Val1.properties().empty() || !Val2.properties().empty()) return false;
- if (isa<TopBoolValue>(&Val1)) return true;
+ if (!Val1.properties().empty() || !Val2.properties().empty())
+ return false;
+ if (isa<TopBoolValue>(&Val1))
+ return true;
return areEquivalentIndirectionValues(Val1, Val2);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/76746
More information about the cfe-commits
mailing list