Skip to content

Commit 3e9c363

Browse files
committed
[clang] NFCI: Use FileEntryRef in SourceManager::setFileIsTransient()
1 parent de85739 commit 3e9c363

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

clang/include/clang/Basic/SourceManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
10061006
OptionalFileEntryRef bypassFileContentsOverride(FileEntryRef File);
10071007

10081008
/// Specify that a file is transient.
1009-
void setFileIsTransient(const FileEntry *SourceFile);
1009+
void setFileIsTransient(FileEntryRef SourceFile);
10101010

10111011
/// Specify that all files that are read during this compilation are
10121012
/// transient.

clang/lib/Basic/SourceManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ SourceManager::bypassFileContentsOverride(FileEntryRef File) {
725725
return BypassFile;
726726
}
727727

728-
void SourceManager::setFileIsTransient(const FileEntry *File) {
729-
getOrCreateContentCache(File->getLastRef()).IsTransient = true;
728+
void SourceManager::setFileIsTransient(FileEntryRef File) {
729+
getOrCreateContentCache(File).IsTransient = true;
730730
}
731731

732732
std::optional<StringRef>

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
742742
// Set up embedding for any specified files. Do this before we load any
743743
// source files, including the primary module map for the compilation.
744744
for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) {
745-
if (auto FE = CI.getFileManager().getFile(F, /*openFile*/true))
745+
if (auto FE = CI.getFileManager().getOptionalFileRef(F, /*openFile*/true))
746746
CI.getSourceManager().setFileIsTransient(*FE);
747747
else
748748
CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F;

0 commit comments

Comments
 (0)