Author: rjmccall Date: Wed Jan 6 17:34:20 2016 New Revision: 256996 URL: http://llvm.org/viewvc/llvm-project?rev=256996&view=rev Log: Properly bind up any cleanups in an ExprWithCleanups after instantiating a default argument expression.
This was previously just working implicitly by reinstantiating in the current context, but caching means that we weren't registering cleanups in subsequent uses. Modified: cfe/trunk/lib/Sema/SemaExpr.cpp Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=256996&r1=256995&r2=256996&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jan 6 17:34:20 2016 @@ -4313,17 +4313,16 @@ ExprResult Sema::BuildCXXDefaultArgExpr( if (Result.isInvalid()) return ExprError(); - Expr *Arg = Result.getAs<Expr>(); - CheckCompletedExpr(Arg, Param->getOuterLocStart()); + Result = ActOnFinishFullExpr(Result.getAs<Expr>(), + Param->getOuterLocStart()); + if (Result.isInvalid()) + return ExprError(); // Remember the instantiated default argument. - Param->setDefaultArg(Arg); + Param->setDefaultArg(Result.getAs<Expr>()); if (ASTMutationListener *L = getASTMutationListener()) { L->DefaultArgumentInstantiated(Param); } - - // Build the default argument expression. - return CXXDefaultArgExpr::Create(Context, CallLoc, Param); } // If the default expression creates temporaries, we need to _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits