aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-14 00:00:48 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-14 00:00:48 +0000
commitd5387e86ce3dfe1ae09e050ee11d86ca0d066d04 (patch)
treedc324b8b16eac75b96b3b03e86a30595eb60ff0d /lib/Sema/TreeTransform.h
parente76872e81ea32fbc863d8d7ef6eadc91a8f8673b (diff)
Link together the call operator produced from transforming a lambda
expression with the original call operator, so that we don't try to separately instantiate the call operator. Test and tweak a few more bits for template instantiation of lambda expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r--lib/Sema/TreeTransform.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index ba6ec82c81..a63b9c804a 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -7672,6 +7672,13 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
E->getCallOperator()->getLocEnd());
getDerived().transformAttrs(E->getCallOperator(), CallOperator);
+ // FIXME: Instantiation-specific.
+ CallOperator->setInstantiationOfMemberFunction(E->getCallOperator(),
+ TSK_ImplicitInstantiation);
+
+ // Introduce the context of the call operator.
+ Sema::ContextRAII SavedContext(getSema(), CallOperator);
+
// Enter the scope of the lambda.
sema::LambdaScopeInfo *LSI
= getSema().enterLambdaScope(CallOperator, E->getIntroducerRange(),
@@ -7741,17 +7748,12 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
}
// Instantiate the body of the lambda expression.
- StmtResult Body;
- {
- Sema::ContextRAII SavedContext(getSema(), CallOperator);
-
- Body = getDerived().TransformStmt(E->getBody());
- if (Body.isInvalid()) {
- getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/0,
- /*IsInstantiation=*/true);
- return ExprError();
- }
- }
+ StmtResult Body = getDerived().TransformStmt(E->getBody());
+ if (Body.isInvalid()) {
+ getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/0,
+ /*IsInstantiation=*/true);
+ return ExprError();
+ }
return getSema().ActOnLambdaExpr(E->getLocStart(), Body.take(),
/*CurScope=*/0,