summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-12-15 21:07:16 +0000
committerReid Kleckner <reid@kleckner.net>2014-12-15 21:07:16 +0000
commitaac43c6a7743bc29dd00953cb3e4fe9bca13244a (patch)
tree5507cf2097acb21f43dc19a4e5788af8767fe440 /clang/lib/Sema/TreeTransform.h
parent42be29f74883699ab4f189e8db92bbff22effc92 (diff)
downloadbcm5719-llvm-aac43c6a7743bc29dd00953cb3e4fe9bca13244a.tar.gz
bcm5719-llvm-aac43c6a7743bc29dd00953cb3e4fe9bca13244a.zip
Handle errors in lambda prototype instantiation correctly
Previously we would attempt to build a TypeSourceInfo for a null type, and then we would forget to pop the function scope before returning an error. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D6665 llvm-svn: 224271
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r--clang/lib/Sema/TreeTransform.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 295d208edfc..36abbb624af 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -9121,6 +9121,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
}
LambdaScopeInfo *LSI = getSema().PushLambdaScope();
+ Sema::FunctionScopeRAII FuncScopeCleanup(getSema());
+
// Transform the template parameters, and add them to the current
// instantiation scope. The null case is handled correctly.
LSI->GLTemplateParameterList = getDerived().TransformTemplateParameterList(
@@ -9145,10 +9147,10 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
return This->TransformExceptionSpec(OldCallOpFPTL.getBeginLoc(), ESI,
ExceptionStorage, Changed);
});
+ if (NewCallOpType.isNull())
+ return ExprError();
NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,
NewCallOpType);
- if (!NewCallOpTSI)
- return ExprError();
}
// Create the local class that will describe the lambda.
@@ -9168,6 +9170,10 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
getDerived().transformAttrs(E->getCallOperator(), NewCallOperator);
+ // TransformLambdaScope will manage the function scope, so we can disable the
+ // cleanup.
+ FuncScopeCleanup.disable();
+
return getDerived().TransformLambdaScope(E, NewCallOperator,
InitCaptureExprsAndTypes);
}
OpenPOWER on IntegriCloud