[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology
Takuya Shimizu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 28 10:02:18 PDT 2023
hazohelet marked 2 inline comments as done.
hazohelet added a comment.
Thanks for the review
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:9743-9748
+def warn_tautological_negation_and_compare: Warning<
+ "'&&' against a variable and its negation always evaluates to false">,
+ InGroup<TautologicalNegationCompare>, DefaultIgnore;
+def warn_tautological_negation_or_compare: Warning<
+ "'||' against a variable and its negation always evaluates to true">,
+ InGroup<TautologicalNegationCompare>, DefaultIgnore;
----------------
aaron.ballman wrote:
> Let's combine these if we can. I'm not 100% certain that `%select` is going to like `&&|||` though, so if there's an issue, separate is also fine.
`%select(&&|||)0` doesn't seem to work as we want it to, so I kept it separated
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152093/new/
https://reviews.llvm.org/D152093
More information about the cfe-commits
mailing list