diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2017-09-19 21:40:41 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2017-09-19 21:40:41 +0000 |
commit | 918eaf9585dd3a0c15f227876d699c44a56e9927 (patch) | |
tree | 1911138210ee77d31c8c6ac929dd76466d5b8972 /clang/lib/Sema/SemaChecking.cpp | |
parent | d246b0a2843d68768d5695ca40e298ddcb7adf9b (diff) | |
download | bcm5719-llvm-918eaf9585dd3a0c15f227876d699c44a56e9927.tar.gz bcm5719-llvm-918eaf9585dd3a0c15f227876d699c44a56e9927.zip |
Revert "[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare"
This reverts commit r313677.
Buildbots fail with assertion failure
Failing Tests (7):
Clang :: Analysis/null-deref-ps.c
Clang :: CodeGen/enum.c
Clang :: Sema/compare.c
Clang :: Sema/outof-range-constant-compare.c
Clang :: Sema/tautological-unsigned-enum-zero-compare.c
Clang :: Sema/tautological-unsigned-zero-compare.c
Clang :: SemaCXX/compare.cpp
llvm-svn: 313683
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 6544cb923b1..212fe65c76f 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -8583,7 +8583,7 @@ bool CheckTautologicalComparisonWithZero(Sema &S, BinaryOperator *E) { // bool values are handled by DiagnoseOutOfRangeComparison(). - BinaryOperatorKind Op = E->getOpcode(); + BinaryOperatorKind op = E->getOpcode(); if (E->isValueDependent()) return false; @@ -8592,30 +8592,22 @@ bool CheckTautologicalComparisonWithZero(Sema &S, BinaryOperator *E) { bool Match = true; - if (Op == BO_LT && isNonBooleanUnsignedValue(LHS) && IsZero(S, RHS)) { - S.Diag(E->getOperatorLoc(), - HasEnumType(LHS) ? diag::warn_lunsigned_enum_always_true_comparison - : diag::warn_lunsigned_always_true_comparison) - << "< 0" - << "false" << LHS->getSourceRange() << RHS->getSourceRange(); - } else if (Op == BO_GE && isNonBooleanUnsignedValue(LHS) && IsZero(S, RHS)) { - S.Diag(E->getOperatorLoc(), - HasEnumType(LHS) ? diag::warn_lunsigned_enum_always_true_comparison - : diag::warn_lunsigned_always_true_comparison) - << ">= 0" - << "true" << LHS->getSourceRange() << RHS->getSourceRange(); - } else if (Op == BO_GT && isNonBooleanUnsignedValue(RHS) && IsZero(S, LHS)) { - S.Diag(E->getOperatorLoc(), - HasEnumType(RHS) ? diag::warn_runsigned_enum_always_true_comparison - : diag::warn_runsigned_always_true_comparison) - << "0 >" - << "false" << LHS->getSourceRange() << RHS->getSourceRange(); - } else if (Op == BO_LE && isNonBooleanUnsignedValue(RHS) && IsZero(S, LHS)) { - S.Diag(E->getOperatorLoc(), - HasEnumType(RHS) ? diag::warn_runsigned_enum_always_true_comparison - : diag::warn_runsigned_always_true_comparison) - << "0 <=" - << "true" << LHS->getSourceRange() << RHS->getSourceRange(); + 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; |