Use IgnoreParenCasts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47041 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaChecking.cpp b/Sema/SemaChecking.cpp
index 1dfb145..fe82ea6 100644
--- a/Sema/SemaChecking.cpp
+++ b/Sema/SemaChecking.cpp
@@ -149,15 +149,7 @@
// Verify that the second argument to the builtin is the last argument of the
// current function or method.
bool SecondArgIsLastNamedArgument = false;
- const Expr *Arg = TheCall->getArg(1);
- while (1) {
- if (const ParenExpr *PE = dyn_cast<ParenExpr>(Arg))
- Arg = PE->getSubExpr();
- else if (const ImplicitCastExpr *CE = dyn_cast<ImplicitCastExpr>(Arg))
- Arg = CE->getSubExpr();
- else
- break;
- }
+ const Expr *Arg = TheCall->getArg(1)->IgnoreParenCasts();
if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Arg)) {
if (const ParmVarDecl *PV = dyn_cast<ParmVarDecl>(DR->getDecl())) {