forked from OSchip/llvm-project
[clang][NFC] Pass the ASTContext to CXXRecordDecl::setCaptures
In general Decl::getASTContext() is relatively expensive and here the changes are non-invasive. NFC.
This commit is contained in:
parent
ad793ed903
commit
1ae63b4179
|
@ -1025,7 +1025,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the captures for this lambda closure type.
|
/// Set the captures for this lambda closure type.
|
||||||
void setCaptures(ArrayRef<LambdaCapture> Captures);
|
void setCaptures(ASTContext &Context, ArrayRef<LambdaCapture> Captures);
|
||||||
|
|
||||||
/// For a closure type, retrieve the mapping from captured
|
/// For a closure type, retrieve the mapping from captured
|
||||||
/// variables and \c this to the non-static data members that store the
|
/// variables and \c this to the non-static data members that store the
|
||||||
|
|
|
@ -1900,7 +1900,8 @@ Error ASTNodeImporter::ImportDefinition(
|
||||||
else
|
else
|
||||||
return ToCaptureOrErr.takeError();
|
return ToCaptureOrErr.takeError();
|
||||||
}
|
}
|
||||||
cast<CXXRecordDecl>(To)->setCaptures(ToCaptures);
|
cast<CXXRecordDecl>(To)->setCaptures(Importer.getToContext(),
|
||||||
|
ToCaptures);
|
||||||
}
|
}
|
||||||
|
|
||||||
Error Result = ImportDeclContext(From, /*ForceImport=*/true);
|
Error Result = ImportDeclContext(From, /*ForceImport=*/true);
|
||||||
|
|
|
@ -1383,8 +1383,8 @@ void CXXRecordDecl::finishedDefaultedOrDeletedMember(CXXMethodDecl *D) {
|
||||||
data().DeclaredNonTrivialSpecialMembers |= SMKind;
|
data().DeclaredNonTrivialSpecialMembers |= SMKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXXRecordDecl::setCaptures(ArrayRef<LambdaCapture> Captures) {
|
void CXXRecordDecl::setCaptures(ASTContext &Context,
|
||||||
ASTContext &Context = getASTContext();
|
ArrayRef<LambdaCapture> Captures) {
|
||||||
CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
|
CXXRecordDecl::LambdaDefinitionData &Data = getLambdaData();
|
||||||
|
|
||||||
// Copy captures.
|
// Copy captures.
|
||||||
|
|
|
@ -1624,8 +1624,9 @@ FieldDecl *Sema::BuildCaptureField(RecordDecl *RD,
|
||||||
|
|
||||||
// Build the non-static data member.
|
// Build the non-static data member.
|
||||||
FieldDecl *Field =
|
FieldDecl *Field =
|
||||||
FieldDecl::Create(Context, RD, Loc, Loc, nullptr, FieldType, TSI, nullptr,
|
FieldDecl::Create(Context, RD, /*StartLoc=*/Loc, /*IdLoc=*/Loc,
|
||||||
false, ICIS_NoInit);
|
/*Id=*/nullptr, FieldType, TSI, /*BW=*/nullptr,
|
||||||
|
/*Mutable=*/false, ICIS_NoInit);
|
||||||
// If the variable being captured has an invalid type, mark the class as
|
// If the variable being captured has an invalid type, mark the class as
|
||||||
// invalid as well.
|
// invalid as well.
|
||||||
if (!FieldType->isDependentType()) {
|
if (!FieldType->isDependentType()) {
|
||||||
|
@ -1785,7 +1786,7 @@ ExprResult Sema::BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||||
CUDACheckLambdaCapture(CallOperator, From);
|
CUDACheckLambdaCapture(CallOperator, From);
|
||||||
}
|
}
|
||||||
|
|
||||||
Class->setCaptures(Captures);
|
Class->setCaptures(Context, Captures);
|
||||||
|
|
||||||
// C++11 [expr.prim.lambda]p6:
|
// C++11 [expr.prim.lambda]p6:
|
||||||
// The closure type for a lambda-expression with no lambda-capture
|
// The closure type for a lambda-expression with no lambda-capture
|
||||||
|
|
Loading…
Reference in New Issue