[PATCH] D37629: [Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 12 08:26:52 PDT 2017
aaron.ballman added inline comments.
================
Comment at: lib/Sema/SemaChecking.cpp:8602
- if (op == BO_LT && isNonBooleanUnsignedValue(LHS) && IsZero(S, RHS)) {
- S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
- << "< 0" << "false" << HasEnumType(LHS)
- << LHS->getSourceRange() << RHS->getSourceRange();
- } else if (op == BO_GE && isNonBooleanUnsignedValue(LHS) && IsZero(S, RHS)) {
- S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
- << ">= 0" << "true" << HasEnumType(LHS)
- << LHS->getSourceRange() << RHS->getSourceRange();
- } else if (op == BO_GT && isNonBooleanUnsignedValue(RHS) && IsZero(S, LHS)) {
- S.Diag(E->getOperatorLoc(), diag::warn_runsigned_always_true_comparison)
- << "0 >" << "false" << HasEnumType(RHS)
- << LHS->getSourceRange() << RHS->getSourceRange();
- } else if (op == BO_LE && isNonBooleanUnsignedValue(RHS) && IsZero(S, LHS)) {
- S.Diag(E->getOperatorLoc(), diag::warn_runsigned_always_true_comparison)
- << "0 <=" << "true" << HasEnumType(RHS)
- << LHS->getSourceRange() << RHS->getSourceRange();
- } else
- Match = false;
+ const std::array<const TautologicalComparison, 4> TautologicalComparisons = {{
+ {LHS,
----------------
I don't think this is an improvement over the old code.
Repository:
rL LLVM
https://reviews.llvm.org/D37629
More information about the cfe-commits
mailing list