[PATCH] D86514: Correctly parse LateParsedTemplates in case of multiple dependent modules
Vassil Vassilev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 4 04:39:58 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2c9dbcda4f71: [modules] Correctly parse LateParsedTemplates in case of dependent modules. (authored by gargvaibhav64, committed by v.g.vassilev).
Repository:
rG LLVM Github Monorepo
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
@@ -3722,7 +3722,9 @@
}
case LATE_PARSED_TEMPLATE:
- LateParsedTemplates.append(Record.begin(), Record.end());
+ LateParsedTemplates.emplace_back(
+ std::piecewise_construct, std::forward_as_tuple(&F),
+ std::forward_as_tuple(Record.begin(), Record.end()));
break;
case OPTIMIZE_PRAGMA_OPTIONS:
@@ -8389,25 +8391,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 : LateParsedTemplates) {
+ ModuleFile *FMod = LPT.first;
+ RecordDataImpl &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
@@ -900,8 +900,9 @@
/// Delete expressions to analyze at the end of translation unit.
SmallVector<uint64_t, 8> DelayedDeleteExprs;
- // A list of late parsed template function data.
- SmallVector<uint64_t, 1> LateParsedTemplates;
+ // A list of late parsed template function data with their module files.
+ SmallVector<std::pair<ModuleFile *, SmallVector<uint64_t, 1>>, 4>
+ LateParsedTemplates;
/// The IDs of all decls to be checked for deferred diags.
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86514.289915.patch
Type: text/x-patch
Size: 2860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200904/81a99e13/attachment.bin>
More information about the cfe-commits
mailing list