]> granicus.if.org Git - clang/commitdiff
Avoid redundant recursive calls in SemaCheckStringLiteral by just updating the expression
authorTed Kremenek <kremenek@apple.com>
Thu, 9 Sep 2010 03:51:39 +0000 (03:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 9 Sep 2010 03:51:39 +0000 (03:51 +0000)
and trying again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113468 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp

index 7b0941e34b6cf8e237ff30a343235e34a3c3db64..6092348004e60658cc53f50771656e42a1946856 100644 (file)
@@ -942,7 +942,7 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall,
                                   bool HasVAListArg,
                                   unsigned format_idx, unsigned firstDataArg,
                                   bool isPrintf) {
-
+ tryAgain:
   if (E->isTypeDependent() || E->isValueDependent())
     return false;
 
@@ -956,15 +956,13 @@ bool Sema::SemaCheckStringLiteral(const Expr *E, const CallExpr *TheCall,
   }
 
   case Stmt::ImplicitCastExprClass: {
-    const ImplicitCastExpr *Expr = cast<ImplicitCastExpr>(E);
-    return SemaCheckStringLiteral(Expr->getSubExpr(), TheCall, HasVAListArg,
-                                  format_idx, firstDataArg, isPrintf);
+    E = cast<ImplicitCastExpr>(E)->getSubExpr();
+    goto tryAgain;
   }
 
   case Stmt::ParenExprClass: {
-    const ParenExpr *Expr = cast<ParenExpr>(E);
-    return SemaCheckStringLiteral(Expr->getSubExpr(), TheCall, HasVAListArg,
-                                  format_idx, firstDataArg, isPrintf);
+    E = cast<ParenExpr>(E)->getSubExpr();
+    goto tryAgain;
   }
 
   case Stmt::DeclRefExprClass: {