aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-09-19 01:18:11 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-09-19 01:18:11 +0000
commit8da8a660128180a31479216111ff9b19b11c95b4 (patch)
tree7272143fc53333ebdb01ace3d1ee059af29c3abb /lib/Sema
parentbf4c7a8eb7cdfb11e00ed47422fa4ed47771c74c (diff)
Add the TypeSourceInfo for the lambda call operator to the lambda's
definition info; it needs to be there because the mangler needs to access it before we're finished defining the lambda class. PR12808. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r--lib/Sema/SemaLambda.cpp10
-rw-r--r--lib/Sema/TreeTransform.h13
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index 7cbfc364f6..489c895c99 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/lib/Sema/SemaLambda.cpp
@@ -22,13 +22,14 @@ using namespace clang;
using namespace sema;
CXXRecordDecl *Sema::createLambdaClosureType(SourceRange IntroducerRange,
+ TypeSourceInfo *Info,
bool KnownDependent) {
DeclContext *DC = CurContext;
while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
DC = DC->getParent();
// Start constructing the lambda class.
- CXXRecordDecl *Class = CXXRecordDecl::CreateLambda(Context, DC,
+ CXXRecordDecl *Class = CXXRecordDecl::CreateLambda(Context, DC, Info,
IntroducerRange.getBegin(),
KnownDependent);
DC->addDecl(Class);
@@ -369,8 +370,6 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
if (!TmplScope->decl_empty())
KnownDependent = true;
- CXXRecordDecl *Class = createLambdaClosureType(Intro.Range, KnownDependent);
-
// Determine the signature of the call operator.
TypeSourceInfo *MethodTyInfo;
bool ExplicitParams = true;
@@ -419,7 +418,10 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
if (MethodTyInfo->getType()->containsUnexpandedParameterPack())
ContainsUnexpandedParameterPack = true;
}
-
+
+ CXXRecordDecl *Class = createLambdaClosureType(Intro.Range, MethodTyInfo,
+ KnownDependent);
+
CXXMethodDecl *Method = startLambdaDefinition(Class, Intro.Range,
MethodTyInfo, EndLoc, Params);
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 3d9a6ca11b..71d95ef41f 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -7856,12 +7856,6 @@ TreeTransform<Derived>::TransformCXXTemporaryObjectExpr(
template<typename Derived>
ExprResult
TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
- // Create the local class that will describe the lambda.
- CXXRecordDecl *Class
- = getSema().createLambdaClosureType(E->getIntroducerRange(),
- /*KnownDependent=*/false);
- getDerived().transformedLocalDecl(E->getLambdaClass(), Class);
-
// Transform the type of the lambda parameters and start the definition of
// the lambda itself.
TypeSourceInfo *MethodTy
@@ -7869,6 +7863,13 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
if (!MethodTy)
return ExprError();
+ // Create the local class that will describe the lambda.
+ CXXRecordDecl *Class
+ = getSema().createLambdaClosureType(E->getIntroducerRange(),
+ MethodTy,
+ /*KnownDependent=*/false);
+ getDerived().transformedLocalDecl(E->getLambdaClass(), Class);
+
// Transform lambda parameters.
llvm::SmallVector<QualType, 4> ParamTypes;
llvm::SmallVector<ParmVarDecl *, 4> Params;