Skip to content

Commit

Permalink
[clang] NFCI: Use FileEntryRef in additional module maps
Browse files Browse the repository at this point in the history
  • Loading branch information
jansvoboda11 committed Sep 28, 2023
1 parent 0faee97 commit de85739
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4096,11 +4096,11 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,
return OutOfDate;
}

llvm::SmallPtrSet<const FileEntry *, 1> AdditionalStoredMaps;
llvm::SmallPtrSet<FileEntryRef, 1> AdditionalStoredMaps;
for (unsigned I = 0, N = Record[Idx++]; I < N; ++I) {
// FIXME: we should use input files rather than storing names.
std::string Filename = ReadPath(F, Record, Idx);
auto SF = FileMgr.getFile(Filename, false, false);
auto SF = FileMgr.getOptionalFileRef(Filename, false, false);
if (!SF) {
if (!canRecoverFromOutOfDate(F.FileName, ClientLoadCapabilities))
Error("could not find file '" + Filename +"' referenced by AST file");
Expand All @@ -4126,10 +4126,10 @@ ASTReader::ReadModuleMapFileBlock(RecordData &Record, ModuleFile &F,

// Check any additional module map files that are in the pcm, but not
// found in header search. Cases that match are already removed.
for (const FileEntry *ModMap : AdditionalStoredMaps) {
for (FileEntryRef ModMap : AdditionalStoredMaps) {
if (!canRecoverFromOutOfDate(F.FileName, ClientLoadCapabilities))
Diag(diag::err_module_different_modmap)
<< F.ModuleName << /*not new*/1 << ModMap->getName();
<< F.ModuleName << /*not new*/1 << ModMap.getName();
return OutOfDate;
}
}
Expand Down
12 changes: 6 additions & 6 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,13 +1383,13 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
if (auto *AdditionalModMaps =
Map.getAdditionalModuleMapFiles(WritingModule)) {
Record.push_back(AdditionalModMaps->size());
SmallVector<const FileEntry *, 1> ModMaps(AdditionalModMaps->begin(),
AdditionalModMaps->end());
llvm::sort(ModMaps, [](const FileEntry *A, const FileEntry *B) {
return A->getName() < B->getName();
SmallVector<FileEntryRef, 1> ModMaps(AdditionalModMaps->begin(),
AdditionalModMaps->end());
llvm::sort(ModMaps, [](FileEntryRef A, FileEntryRef B) {
return A.getName() < B.getName();
});
for (const FileEntry *F : ModMaps)
AddPath(F->getName(), Record);
for (FileEntryRef F : ModMaps)
AddPath(F.getName(), Record);
} else {
Record.push_back(0);
}
Expand Down

0 comments on commit de85739

Please sign in to comment.