diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index 2f846502d6f33..431f97f30525b 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -1006,7 +1006,7 @@ class SourceManager : public RefCountedBase { OptionalFileEntryRef bypassFileContentsOverride(FileEntryRef File); /// Specify that a file is transient. - void setFileIsTransient(const FileEntry *SourceFile); + void setFileIsTransient(FileEntryRef SourceFile); /// Specify that all files that are read during this compilation are /// transient. diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 757b7ea68bb14..a630743e0d73e 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -725,8 +725,8 @@ SourceManager::bypassFileContentsOverride(FileEntryRef File) { return BypassFile; } -void SourceManager::setFileIsTransient(const FileEntry *File) { - getOrCreateContentCache(File->getLastRef()).IsTransient = true; +void SourceManager::setFileIsTransient(FileEntryRef File) { + getOrCreateContentCache(File).IsTransient = true; } std::optional diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index ada86b0a01566..2da1a89b39ba4 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -742,7 +742,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, // Set up embedding for any specified files. Do this before we load any // source files, including the primary module map for the compilation. for (const auto &F : CI.getFrontendOpts().ModulesEmbedFiles) { - if (auto FE = CI.getFileManager().getFile(F, /*openFile*/true)) + if (auto FE = CI.getFileManager().getOptionalFileRef(F, /*openFile*/true)) CI.getSourceManager().setFileIsTransient(*FE); else CI.getDiagnostics().Report(diag::err_modules_embed_file_not_found) << F;