Move IgnoreParenCasts to be a method on Expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47040 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp
index 76363c9..1dfb145 100644
--- a/Sema/SemaChecking.cpp
+++ b/Sema/SemaChecking.cpp
@@ -88,7 +88,7 @@
/// CheckBuiltinCFStringArgument - Checks that the argument to the builtin
/// CFString constructor is correct
bool Sema::CheckBuiltinCFStringArgument(Expr* Arg) {
- Arg = IgnoreParenCasts(Arg);
+ Arg = Arg->IgnoreParenCasts();
StringLiteral *Literal = dyn_cast<StringLiteral>(Arg);
@@ -267,7 +267,7 @@
return;
}
- Expr *OrigFormatExpr = IgnoreParenCasts(TheCall->getArg(format_idx));
+ Expr *OrigFormatExpr = TheCall->getArg(format_idx)->IgnoreParenCasts();
// CHECK: format string is not a string literal.
//
@@ -527,7 +527,7 @@
void
Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType,
SourceLocation ReturnLoc) {
-
+
// Perform checking for returned stack addresses.
if (lhsType->isPointerType()) {
if (DeclRefExpr *DR = EvalAddr(RetValExp))
diff --git a/Sema/SemaUtil.h b/Sema/SemaUtil.h
index 9be668b..35452b1 100644
--- a/Sema/SemaUtil.h
+++ b/Sema/SemaUtil.h
@@ -19,23 +19,9 @@
namespace clang {
-/// Utility method to plow through parenthesis and casts.
-static inline Expr* IgnoreParenCasts(Expr* E) {
- while(true) {
- if (ParenExpr* P = dyn_cast<ParenExpr>(E))
- E = P->getSubExpr();
- else if (CastExpr* P = dyn_cast<CastExpr>(E))
- E = P->getSubExpr();
- else if (ImplicitCastExpr* P = dyn_cast<ImplicitCastExpr>(E))
- E = P->getSubExpr();
- else
- return E;
- }
-}
-
/// Utility method to determine if a CallExpr is a call to a builtin.
static inline bool isCallBuiltin(CallExpr* cexp) {
- Expr* sub = IgnoreParenCasts(cexp->getCallee());
+ Expr* sub = cexp->getCallee()->IgnoreParenCasts();
if (DeclRefExpr* E = dyn_cast<DeclRefExpr>(sub))
if (E->getDecl()->getIdentifier()->getBuiltinID() > 0)