diff options
Diffstat (limited to 'Sema')
-rw-r--r-- | Sema/SemaChecking.cpp | 4 | ||||
-rw-r--r-- | Sema/SemaExpr.cpp | 4 | ||||
-rw-r--r-- | Sema/SemaUtil.h | 9 |
3 files changed, 4 insertions, 13 deletions
diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp index 61c67f02fe..44c559b4d5 100644 --- a/Sema/SemaChecking.cpp +++ b/Sema/SemaChecking.cpp @@ -751,8 +751,8 @@ static DeclRefExpr* EvalVal(Expr *E) { void Sema::CheckFloatComparison(SourceLocation loc, Expr* lex, Expr *rex) { bool EmitWarning = true; - Expr* LeftExprSansParen = IgnoreParen(lex); - Expr* RightExprSansParen = IgnoreParen(rex); + Expr* LeftExprSansParen = lex->IgnoreParens(); + Expr* RightExprSansParen = lex->IgnoreParens(); // Special case: check for x == x (which is OK). // Do not emit warnings for such cases. diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index 81376a6500..a80bc43525 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -1418,8 +1418,8 @@ inline QualType Sema::CheckCompareOperands( // C99 6.5.8 // x == x, x != x, x < x, etc. These always evaluate to a constant, and // often indicate logic errors in the program. if (!lType->isFloatingType()) { - if (DeclRefExpr* DRL = dyn_cast<DeclRefExpr>(IgnoreParen(lex))) - if (DeclRefExpr* DRR = dyn_cast<DeclRefExpr>(IgnoreParen(rex))) + if (DeclRefExpr* DRL = dyn_cast<DeclRefExpr>(lex->IgnoreParens())) + if (DeclRefExpr* DRR = dyn_cast<DeclRefExpr>(rex->IgnoreParens())) if (DRL->getDecl() == DRR->getDecl()) Diag(loc, diag::warn_selfcomparison); } diff --git a/Sema/SemaUtil.h b/Sema/SemaUtil.h index 1a15557fdf..9be668bc54 100644 --- a/Sema/SemaUtil.h +++ b/Sema/SemaUtil.h @@ -19,15 +19,6 @@ namespace clang { -/// Utility method to plow through parentheses to get the first nested -/// non-ParenExpr expr. -static inline Expr* IgnoreParen(Expr* E) { - while (ParenExpr* P = dyn_cast<ParenExpr>(E)) - E = P->getSubExpr(); - - return E; -} - /// Utility method to plow through parenthesis and casts. static inline Expr* IgnoreParenCasts(Expr* E) { while(true) { |