@@ -3696,7 +3696,9 @@ ASTReader::ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities) {
3696
3696
}
3697
3697
3698
3698
case LATE_PARSED_TEMPLATE:
3699
- LateParsedTemplates.append (Record.begin (), Record.end ());
3699
+ LateParsedTemplates.emplace_back (
3700
+ std::piecewise_construct, std::forward_as_tuple (&F),
3701
+ std::forward_as_tuple (Record.begin (), Record.end ()));
3700
3702
break ;
3701
3703
3702
3704
case OPTIMIZE_PRAGMA_OPTIONS:
@@ -8393,25 +8395,28 @@ void ASTReader::ReadPendingInstantiations(
8393
8395
void ASTReader::ReadLateParsedTemplates (
8394
8396
llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>>
8395
8397
&LPTMap) {
8396
- for (unsigned Idx = 0 , N = LateParsedTemplates.size (); Idx < N;
8397
- /* In loop */ ) {
8398
- FunctionDecl *FD = cast<FunctionDecl>(GetDecl (LateParsedTemplates[Idx++]));
8398
+ for (auto &LPT : LateParsedTemplates) {
8399
+ ModuleFile *FMod = LPT.first ;
8400
+ RecordDataImpl &LateParsed = LPT.second ;
8401
+ for (unsigned Idx = 0 , N = LateParsed.size (); Idx < N;
8402
+ /* In loop */ ) {
8403
+ FunctionDecl *FD =
8404
+ cast<FunctionDecl>(GetLocalDecl (*FMod, LateParsed[Idx++]));
8399
8405
8400
- auto LT = std::make_unique<LateParsedTemplate>();
8401
- LT->D = GetDecl (LateParsedTemplates [Idx++]);
8406
+ auto LT = std::make_unique<LateParsedTemplate>();
8407
+ LT->D = GetLocalDecl (*FMod, LateParsed [Idx++]);
8402
8408
8403
- ModuleFile *F = getOwningModuleFile (LT->D );
8404
- assert (F && " No module" );
8409
+ ModuleFile *F = getOwningModuleFile (LT->D );
8410
+ assert (F && " No module" );
8405
8411
8406
- unsigned TokN = LateParsedTemplates [Idx++];
8407
- LT->Toks .reserve (TokN);
8408
- for (unsigned T = 0 ; T < TokN; ++T)
8409
- LT->Toks .push_back (ReadToken (*F, LateParsedTemplates , Idx));
8412
+ unsigned TokN = LateParsed [Idx++];
8413
+ LT->Toks .reserve (TokN);
8414
+ for (unsigned T = 0 ; T < TokN; ++T)
8415
+ LT->Toks .push_back (ReadToken (*F, LateParsed , Idx));
8410
8416
8411
- LPTMap.insert (std::make_pair (FD, std::move (LT)));
8417
+ LPTMap.insert (std::make_pair (FD, std::move (LT)));
8418
+ }
8412
8419
}
8413
-
8414
- LateParsedTemplates.clear ();
8415
8420
}
8416
8421
8417
8422
void ASTReader::LoadSelector (Selector Sel) {
0 commit comments