aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/TreeTransform.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-04-04 17:40:10 +0000
committerDouglas Gregor <dgregor@apple.com>2012-04-04 17:40:10 +0000
commitf54486acc1cadf2791c3916ece66fded1e57ba0b (patch)
tree50d408c6476749d089f753d8694cdf09a0c6eefe /lib/Sema/TreeTransform.h
parent8e86b2d03e6e58ef9a58d1d3ad70726ae7a3b4fd (diff)
Move the computation of the lambda mangling information (mangling
number + context) to the point where we initially start defining the lambda, so that the linkage won't change when that information is made available. Fixes the assertion in <rdar://problem/11182962>. Plus, actually mangle the context of lambdas properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r--lib/Sema/TreeTransform.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index c759e7a07a..f16b667a65 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -7815,7 +7815,8 @@ ExprResult
TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
// Create the local class that will describe the lambda.
CXXRecordDecl *Class
- = getSema().createLambdaClosureType(E->getIntroducerRange());
+ = getSema().createLambdaClosureType(E->getIntroducerRange(),
+ /*KnownDependent=*/false);
getDerived().transformedLocalDecl(E->getLambdaClass(), Class);
// Transform the type of the lambda parameters and start the definition of
@@ -7836,11 +7837,15 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
Invalid = true;
// Build the call operator.
+ // Note: Once a lambda mangling number and context declaration have been
+ // assigned, they never change.
+ unsigned ManglingNumber = E->getLambdaClass()->getLambdaManglingNumber();
+ Decl *ContextDecl = E->getLambdaClass()->getLambdaContextDecl();
CXXMethodDecl *CallOperator
= getSema().startLambdaDefinition(Class, E->getIntroducerRange(),
MethodTy,
E->getCallOperator()->getLocEnd(),
- Params);
+ Params, ManglingNumber, ContextDecl);
getDerived().transformAttrs(E->getCallOperator(), CallOperator);
// FIXME: Instantiation-specific.
@@ -7953,14 +7958,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
return ExprError();
}
- // Note: Once a lambda mangling number and context declaration have been
- // assigned, they never change.
- unsigned ManglingNumber = E->getLambdaClass()->getLambdaManglingNumber();
- Decl *ContextDecl = E->getLambdaClass()->getLambdaContextDecl();
return getSema().ActOnLambdaExpr(E->getLocStart(), Body.take(),
- /*CurScope=*/0, ManglingNumber,
- ContextDecl,
- /*IsInstantiation=*/true);
+ /*CurScope=*/0, /*IsInstantiation=*/true);
}
template<typename Derived>