File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
include/clang/Serialization Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -1188,6 +1188,11 @@ class ASTReader
1188
1188
// / once recursing loading has been completed.
1189
1189
llvm::SmallVector<NamedDecl *, 16 > PendingOdrMergeChecks;
1190
1190
1191
+ // / Lambdas that need to be loaded right after the function they belong to.
1192
+ // / It is required to have the right canonical declaration for lambda class
1193
+ // / from the same module as the function.
1194
+ SmallVector<GlobalDeclID, 4 > PendingLambdas;
1195
+
1191
1196
using DataPointers =
1192
1197
std::pair<CXXRecordDecl *, struct CXXRecordDecl ::DefinitionData *>;
1193
1198
using ObjCInterfaceDataPointers =
Original file line number Diff line number Diff line change @@ -9782,7 +9782,8 @@ void ASTReader::finishPendingActions() {
9782
9782
!PendingDeducedVarTypes.empty () || !PendingIncompleteDeclChains.empty () ||
9783
9783
!PendingDeclChains.empty () || !PendingMacroIDs.empty () ||
9784
9784
!PendingDeclContextInfos.empty () || !PendingUpdateRecords.empty () ||
9785
- !PendingObjCExtensionIvarRedeclarations.empty ()) {
9785
+ !PendingObjCExtensionIvarRedeclarations.empty () ||
9786
+ !PendingLambdas.empty ()) {
9786
9787
// If any identifiers with corresponding top-level declarations have
9787
9788
// been loaded, load those declarations now.
9788
9789
using TopLevelDeclsMap =
@@ -9927,6 +9928,11 @@ void ASTReader::finishPendingActions() {
9927
9928
}
9928
9929
PendingObjCExtensionIvarRedeclarations.pop_back ();
9929
9930
}
9931
+
9932
+ // Load any pendiong lambdas.
9933
+ for (auto ID : PendingLambdas)
9934
+ GetDecl (ID);
9935
+ PendingLambdas.clear ();
9930
9936
}
9931
9937
9932
9938
// At this point, all update records for loaded decls are in place, so any
Original file line number Diff line number Diff line change @@ -1156,11 +1156,12 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) {
1156
1156
Params.push_back (readDeclAs<ParmVarDecl>());
1157
1157
FD->setParams (Reader.getContext (), Params);
1158
1158
1159
- // For the first decl read all lambdas inside, otherwise skip them.
1159
+ // For the first decl add all lambdas inside for loading them later,
1160
+ // otherwise skip them.
1160
1161
unsigned NumLambdas = Record.readInt ();
1161
1162
if (FD->isFirstDecl ()) {
1162
1163
for (unsigned I = 0 ; I != NumLambdas; ++I)
1163
- readDecl ( );
1164
+ Reader. PendingLambdas . push_back (Record. readDeclID () );
1164
1165
} else {
1165
1166
(void )Record.readIntArray (NumLambdas);
1166
1167
}
Original file line number Diff line number Diff line change @@ -23,7 +23,6 @@ struct B {
23
23
});
24
24
}
25
25
};
26
-
27
26
// expected-no-diagnostics
28
27
29
28
// --- main.cpp
You can’t perform that action at this time.
0 commit comments