diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 19:32:59 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-02-01 19:32:59 +0000 |
| commit | 582dd685413a6aa709a4f875ad9072635d71998a (patch) | |
| tree | 22106d056e30030803ad77213243a1457cd0eed1 /clang/lib/Sema | |
| parent | 15a3daa18990f6d8e5417918a83276ab9532638e (diff) | |
| download | bcm5719-llvm-582dd685413a6aa709a4f875ad9072635d71998a.tar.gz bcm5719-llvm-582dd685413a6aa709a4f875ad9072635d71998a.zip | |
For "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!
llvm-svn: 124675
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 82771298e0a..8448ed80793 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9231,7 +9231,9 @@ void Sema::DiagnoseEqualityWithExtraParens(ParenExpr *parenE) { Expr *E = parenE->IgnoreParens(); if (BinaryOperator *opE = dyn_cast<BinaryOperator>(E)) - if (opE->getOpcode() == BO_EQ) { + if (opE->getOpcode() == BO_EQ && + opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(Context) + == Expr::MLV_Valid) { SourceLocation Loc = opE->getOperatorLoc(); Diag(Loc, diag::warn_equality_with_extra_parens) << E->getSourceRange(); |

