diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-02 02:20:30 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-02 02:20:30 +0000 |
commit | ae022096dbf6d8a15470bddb9fa8d1db9ef9fcc7 (patch) | |
tree | 6d933b8712923c48767cb35ef566d6ad7e5f93b1 | |
parent | c6f0bda83900d479c9b8d62478a59f098c550763 (diff) | |
download | bcm5719-llvm-ae022096dbf6d8a15470bddb9fa8d1db9ef9fcc7.tar.gz bcm5719-llvm-ae022096dbf6d8a15470bddb9fa8d1db9ef9fcc7.zip |
Remove redundant check to not warn for warn_equality_with_extra_parens if we are in a macro. This is checked twice.
llvm-svn: 124714
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 17 | ||||
-rw-r--r-- | clang/test/SemaCXX/warn-assignment-condition.cpp | 9 |
2 files changed, 6 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index c084bb0a80d..ec5e3e0c3c3 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9244,17 +9244,12 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { == Expr::MLV_Valid) { SourceLocation Loc = opE->getOperatorLoc(); - // Don't emit a warning if the operation occurs within a macro. - // Sometimes extra parentheses are used within macros to make the - // instantiation of the macro less error prone. - if (!Loc.isMacroID()) { - Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); - Diag(Loc, diag::note_equality_comparison_to_assign) - << FixItHint::CreateReplacement(Loc, "="); - Diag(Loc, diag::note_equality_comparison_silence) - << FixItHint::CreateRemoval(parenE->getSourceRange().getBegin()) - << FixItHint::CreateRemoval(parenE->getSourceRange().getEnd()); - } + Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); + Diag(Loc, diag::note_equality_comparison_to_assign) + << FixItHint::CreateReplacement(Loc, "="); + Diag(Loc, diag::note_equality_comparison_silence) + << FixItHint::CreateRemoval(parenE->getSourceRange().getBegin()) + << FixItHint::CreateRemoval(parenE->getSourceRange().getEnd()); } } diff --git a/clang/test/SemaCXX/warn-assignment-condition.cpp b/clang/test/SemaCXX/warn-assignment-condition.cpp index ab9d2ad4a57..27eedb9128d 100644 --- a/clang/test/SemaCXX/warn-assignment-condition.cpp +++ b/clang/test/SemaCXX/warn-assignment-condition.cpp @@ -125,12 +125,3 @@ void test2() { if ((test2 == fn)) {} } -// Do not warn about extra '()' used within a macro. This pattern -// occurs frequently. -#define COMPARE(x,y) (x == y) -int test3(int x, int y) { - if (COMPARE(x, y)) // no-warning - return 0; - return 1; -} - |