diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 22:23:56 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 22:23:56 +0000 |
| commit | f4f8278c95c2f15fc03c76abe37ebcb76e47d602 (patch) | |
| tree | 3190b405a7b67a21716f8e0917a19abb330b4ec4 /clang/lib/Sema | |
| parent | 29c8c8fe927828aae6311b9c2ff50bf866695cef (diff) | |
| download | bcm5719-llvm-f4f8278c95c2f15fc03c76abe37ebcb76e47d602.tar.gz bcm5719-llvm-f4f8278c95c2f15fc03c76abe37ebcb76e47d602.zip | |
Don't warn for "if ((a == b))" if the parens came from a macro. Thanks to Fariborz for the hint!
llvm-svn: 124689
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 8448ed80793..6fe111fac73 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9228,6 +9228,11 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) { /// \brief Redundant parentheses over an equality comparison can indicate /// that the user intended an assignment used as condition. void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { + // Don't warn if the parens came from a macro. + SourceLocation parenLoc = parenE->getLocStart(); + if (parenLoc.isInvalid() || parenLoc.isMacroID()) + return; + Expr *E = parenE->IgnoreParens(); if (BinaryOperator *opE = dyn_cast<BinaryOperator>(E)) |

