Refactor to share code for handling return statements between lambda expressions and block literals. As it turns out, almost all the logic can be shared.
llvm-svn: 149031
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 8a53ece..018aadf 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -8769,6 +8769,8 @@
else
CurContext = Block;
+ getCurBlock()->HasImplicitReturnType = true;
+
// Enter a new evaluation context to insulate the block from any
// cleanups from the enclosing full-expression.
PushExpressionEvaluationContext(PotentiallyEvaluated);
@@ -8835,6 +8837,7 @@
if (RetTy != Context.DependentTy) {
CurBlock->ReturnType = RetTy;
CurBlock->TheDecl->setBlockMissingReturnType(false);
+ CurBlock->HasImplicitReturnType = false;
}
// Push block parameters from the declarator if we had them.