[PATCH] D152093: [clang][Analysis] Handle && and || against variable and its negation as tautology
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 27 04:42:02 PDT 2023
aaron.ballman added a comment.
Generally LGTM, just a minor suggestion on slightly rewording the diagnostics and combining them.
================
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;
----------------
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.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152093/new/
https://reviews.llvm.org/D152093
More information about the cfe-commits
mailing list