gargvaibhav64 updated this revision to Diff 287609. gargvaibhav64 edited the summary of this revision. gargvaibhav64 added a comment.
Resolve a typo. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86514/new/ https://reviews.llvm.org/D86514 Files: clang/include/clang/Serialization/ASTReader.h clang/lib/Serialization/ASTReader.cpp Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ clang/lib/Serialization/ASTReader.cpp @@ -3721,6 +3721,9 @@ case LATE_PARSED_TEMPLATE: LateParsedTemplates.append(Record.begin(), Record.end()); + LateParsedTemplatesModulesMap.insert( + std::make_pair(&F, std::move(LateParsedTemplates))); + LateParsedTemplates.clear(); break; case OPTIMIZE_PRAGMA_OPTIONS: @@ -8386,25 +8389,28 @@ void ASTReader::ReadLateParsedTemplates( llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>> &LPTMap) { - for (unsigned Idx = 0, N = LateParsedTemplates.size(); Idx < N; - /* In loop */) { - FunctionDecl *FD = cast<FunctionDecl>(GetDecl(LateParsedTemplates[Idx++])); + for (auto &LPT : LateParsedTemplatesModulesMap) { + ModuleFile *FMod = LPT.first; + SmallVector<uint64_t, 1> LateParsed(LPT.second); + for (unsigned Idx = 0, N = LateParsed.size(); Idx < N; + /* In loop */) { + FunctionDecl *FD = + cast<FunctionDecl>(GetLocalDecl(*FMod, LateParsed[Idx++])); - auto LT = std::make_unique<LateParsedTemplate>(); - LT->D = GetDecl(LateParsedTemplates[Idx++]); + auto LT = std::make_unique<LateParsedTemplate>(); + LT->D = GetLocalDecl(*FMod, LateParsed[Idx++]); - ModuleFile *F = getOwningModuleFile(LT->D); - assert(F && "No module"); + ModuleFile *F = getOwningModuleFile(LT->D); + assert(F && "No module"); - unsigned TokN = LateParsedTemplates[Idx++]; - LT->Toks.reserve(TokN); - for (unsigned T = 0; T < TokN; ++T) - LT->Toks.push_back(ReadToken(*F, LateParsedTemplates, Idx)); + unsigned TokN = LateParsed[Idx++]; + LT->Toks.reserve(TokN); + for (unsigned T = 0; T < TokN; ++T) + LT->Toks.push_back(ReadToken(*F, LateParsed, Idx)); - LPTMap.insert(std::make_pair(FD, std::move(LT))); + LPTMap.insert(std::make_pair(FD, std::move(LT))); + } } - - LateParsedTemplates.clear(); } void ASTReader::LoadSelector(Selector Sel) { Index: clang/include/clang/Serialization/ASTReader.h =================================================================== --- clang/include/clang/Serialization/ASTReader.h +++ clang/include/clang/Serialization/ASTReader.h @@ -903,6 +903,10 @@ // A list of late parsed template function data. SmallVector<uint64_t, 1> LateParsedTemplates; + // A list of LateParsedTemplates paired with their module files. + llvm::MapVector<ModuleFile *, SmallVector<uint64_t, 1>> + LateParsedTemplatesModulesMap; + /// The IDs of all decls to be checked for deferred diags. /// /// Sema tracks these to emit deferred diags.
Index: clang/lib/Serialization/ASTReader.cpp =================================================================== --- clang/lib/Serialization/ASTReader.cpp +++ clang/lib/Serialization/ASTReader.cpp @@ -3721,6 +3721,9 @@ case LATE_PARSED_TEMPLATE: LateParsedTemplates.append(Record.begin(), Record.end()); + LateParsedTemplatesModulesMap.insert( + std::make_pair(&F, std::move(LateParsedTemplates))); + LateParsedTemplates.clear(); break; case OPTIMIZE_PRAGMA_OPTIONS: @@ -8386,25 +8389,28 @@ void ASTReader::ReadLateParsedTemplates( llvm::MapVector<const FunctionDecl *, std::unique_ptr<LateParsedTemplate>> &LPTMap) { - for (unsigned Idx = 0, N = LateParsedTemplates.size(); Idx < N; - /* In loop */) { - FunctionDecl *FD = cast<FunctionDecl>(GetDecl(LateParsedTemplates[Idx++])); + for (auto &LPT : LateParsedTemplatesModulesMap) { + ModuleFile *FMod = LPT.first; + SmallVector<uint64_t, 1> LateParsed(LPT.second); + for (unsigned Idx = 0, N = LateParsed.size(); Idx < N; + /* In loop */) { + FunctionDecl *FD = + cast<FunctionDecl>(GetLocalDecl(*FMod, LateParsed[Idx++])); - auto LT = std::make_unique<LateParsedTemplate>(); - LT->D = GetDecl(LateParsedTemplates[Idx++]); + auto LT = std::make_unique<LateParsedTemplate>(); + LT->D = GetLocalDecl(*FMod, LateParsed[Idx++]); - ModuleFile *F = getOwningModuleFile(LT->D); - assert(F && "No module"); + ModuleFile *F = getOwningModuleFile(LT->D); + assert(F && "No module"); - unsigned TokN = LateParsedTemplates[Idx++]; - LT->Toks.reserve(TokN); - for (unsigned T = 0; T < TokN; ++T) - LT->Toks.push_back(ReadToken(*F, LateParsedTemplates, Idx)); + unsigned TokN = LateParsed[Idx++]; + LT->Toks.reserve(TokN); + for (unsigned T = 0; T < TokN; ++T) + LT->Toks.push_back(ReadToken(*F, LateParsed, Idx)); - LPTMap.insert(std::make_pair(FD, std::move(LT))); + LPTMap.insert(std::make_pair(FD, std::move(LT))); + } } - - LateParsedTemplates.clear(); } void ASTReader::LoadSelector(Selector Sel) { Index: clang/include/clang/Serialization/ASTReader.h =================================================================== --- clang/include/clang/Serialization/ASTReader.h +++ clang/include/clang/Serialization/ASTReader.h @@ -903,6 +903,10 @@ // A list of late parsed template function data. SmallVector<uint64_t, 1> LateParsedTemplates; + // A list of LateParsedTemplates paired with their module files. + llvm::MapVector<ModuleFile *, SmallVector<uint64_t, 1>> + LateParsedTemplatesModulesMap; + /// The IDs of all decls to be checked for deferred diags. /// /// Sema tracks these to emit deferred diags.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits