Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2838b2b
[clang][deps] Remove dependency on `tooling::ToolAction` (#149904)
jansvoboda11 Jul 22, 2025
ebe4d18
[clang][analyzer] Delay checking the model-path (#150133)
jansvoboda11 Sep 2, 2025
fd46f22
[clang][analyzer] Delay checking the ctu-dir (#150139)
jansvoboda11 Sep 2, 2025
64ccaf3
[clang] Delay checking of `-fopenmp-host-ir-file-path` (#150124)
jansvoboda11 Sep 2, 2025
311f7f1
[flang] Fix build after #150124
jansvoboda11 Sep 2, 2025
36fc81c
Reland "[clang] Delay normalization of `-fmodules-cache-path` (#150123)"
jansvoboda11 Sep 10, 2025
d53f86e
[clang] Use VFS for `-fopenmp-host-ir-file-path` (#156727)
jansvoboda11 Sep 11, 2025
36d7fc1
[clang] Avoid reparsing VFS overlay files for module dep collector (#…
jansvoboda11 Sep 15, 2025
55d8786
[clang] Don't fail `ExecuteCompilerInvocation()` due to caller errors…
jansvoboda11 Sep 15, 2025
7fd9a10
[clang] Only set non-empty bypass to scan VFS (#159605)
jansvoboda11 Sep 18, 2025
471dd16
Merge commit '30633f308941' from llvm.org/main into next
jansvoboda11 Sep 17, 2025
3f94fe0
Merge pull request #11450 from swiftlang/jan_svoboda/cas-fix-early-vfs
jansvoboda11 Sep 18, 2025
f757fdd
[clang] Pass VFS into `ASTUnit::LoadFromASTFile()` (#159166)
jansvoboda11 Sep 18, 2025
0606867
[llvm][clang] Pass VFS to `llvm::cl` command line handling (#159174)
jansvoboda11 Sep 18, 2025
bf1dce3
[clang][analyzer] Load config through the proper VFS (#159164)
jansvoboda11 Sep 19, 2025
5454304
[clang] Load `-fms-secure-hotpatch-functions-file=` through the VFS (…
jansvoboda11 Sep 22, 2025
5650352
[llvm] Add `vfs::FileSystem` to `PassBuilder` (#160188)
jansvoboda11 Sep 25, 2025
4895353
[llvm] Fix X86InstrInfo.cpp build after #160188
jansvoboda11 Sep 25, 2025
288a403
[clang] Load `-fbasic-block-sections=list=` through the VFS (#160785)
jansvoboda11 Sep 25, 2025
474fdd4
[llvm][clang] Use the VFS in `FileCollector` (#160788)
jansvoboda11 Sep 26, 2025
1ddf296
Fix libclang build
jansvoboda11 Sep 26, 2025
3792201
[clang] Load `-fembed-offload-object=` through the VFS (#160906)
jansvoboda11 Sep 26, 2025
e625afe
[clang] Use the VFS to create the OpenMP region entry ID (#160918)
jansvoboda11 Sep 26, 2025
6a362a6
[clang] Use the VFS to check the system framework marker (#160946)
jansvoboda11 Sep 26, 2025
06b40a3
[clang][analyzer] Use the VFS to check model files (#160950)
jansvoboda11 Sep 26, 2025
1c8b036
[clang] Use the VFS to get the unique file ID (#160936)
jansvoboda11 Sep 26, 2025
fbb26af
[clang] Use the VFS to get the OpenMP entry info (#160935)
jansvoboda11 Sep 26, 2025
f3441b0
[llvm] Use the VFS to get the real path in `FileCollector` (#160943)
jansvoboda11 Sep 29, 2025
81ea716
[clang] Use the VFS in `ModuleDependencyCollector` (#160944)
jansvoboda11 Sep 29, 2025
971a04e
[llvm] Use the underlying VFS when constructing `RedirectingFileSyste…
jansvoboda11 Sep 29, 2025
fe90297
[llvm][clang] Use the VFS in `GCOVProfilerPass` (#161260)
jansvoboda11 Sep 29, 2025
b228145
[llvm] Use the VFS to make path absolute (#161271)
jansvoboda11 Sep 30, 2025
18e6773
[llvm] Fix build after #161260
jansvoboda11 Sep 30, 2025
8f6ed3a
[clang][modules] Virtualize module cache pruning (#149113)
jansvoboda11 Sep 30, 2025
0d37b66
[clang] Invert condition refactored in #160935 (#161583)
jansvoboda11 Oct 1, 2025
b76ea70
[llvm][support] Move `make_absolute` from `sys::fs` to `sys::path` (#…
jansvoboda11 Oct 1, 2025
93cddf0
[clang] NFCI: Clean up `CompilerInstance::create{File,Source}Manager(…
jansvoboda11 Oct 2, 2025
11d20a0
[clang] Move `-fprofile-instrument-use-path=` check to driver (#159667)
jansvoboda11 Oct 6, 2025
c2250e3
[support] Use VFS in `SourceMgr` for loading includes (#162903)
jansvoboda11 Oct 15, 2025
3d9d9e7
[clang] Fix buggy FileManager setter
jansvoboda11 Oct 19, 2025
6980f6e
[clang] Experimental fix to assertion failure on Windows
jansvoboda11 Oct 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ groupReplacements(const TUReplacements &TUs, const TUDiagnostics &TUDs,
// build directories, make them absolute immediately.
SmallString<128> Path = R.getFilePath();
if (BuildDir)
llvm::sys::fs::make_absolute(*BuildDir, Path);
llvm::sys::path::make_absolute(*BuildDir, Path);
else
SM.getFileManager().makeAbsolutePath(Path);

Expand Down
5 changes: 2 additions & 3 deletions clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ bool IncludeFixerActionFactory::runInvocation(

// Create the compiler's actual diagnostics engine. We want to drop all
// diagnostics here.
Compiler.createDiagnostics(Files->getVirtualFileSystem(),
new clang::IgnoringDiagConsumer,
Compiler.createDiagnostics(new clang::IgnoringDiagConsumer,
/*ShouldOwnClient=*/true);
Compiler.createSourceManager(*Files);
Compiler.createSourceManager();

// We abort on fatal errors so don't let a large number of errors become
// fatal. A missing #include can cause thousands of errors.
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-move/Move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ std::string MakeAbsolutePath(StringRef CurrentDir, StringRef Path) {
return "";
llvm::SmallString<128> InitialDirectory(CurrentDir);
llvm::SmallString<128> AbsolutePath(Path);
llvm::sys::fs::make_absolute(InitialDirectory, AbsolutePath);
llvm::sys::path::make_absolute(InitialDirectory, AbsolutePath);
return CleanPath(std::move(AbsolutePath));
}

Expand Down
10 changes: 3 additions & 7 deletions clang-tools-extra/clangd/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,9 @@ prepareCompilerInstance(std::unique_ptr<clang::CompilerInvocation> CI,
}

auto Clang = std::make_unique<CompilerInstance>(std::move(CI));
Clang->createDiagnostics(*VFS, &DiagsClient, false);

if (auto VFSWithRemapping = createVFSFromCompilerInvocation(
Clang->getInvocation(), Clang->getDiagnostics(), VFS))
VFS = VFSWithRemapping;
Clang->createFileManager(VFS);

Clang->createVirtualFileSystem(VFS, &DiagsClient);
Clang->createDiagnostics(&DiagsClient, false);
Clang->createFileManager();
if (!Clang->createTarget())
return nullptr;

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/ConfigCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ struct FragmentCompiler {
return std::nullopt;
}
llvm::SmallString<256> AbsPath = llvm::StringRef(*Path);
llvm::sys::fs::make_absolute(FragmentDirectory, AbsPath);
llvm::sys::path::make_absolute(FragmentDirectory, AbsPath);
llvm::sys::path::native(AbsPath, Style);
return AbsPath.str().str();
}
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/SystemIncludeExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct DriverArgs {
// relative or absolute).
if (llvm::any_of(Driver,
[](char C) { return llvm::sys::path::is_separator(C); })) {
llvm::sys::fs::make_absolute(Cmd.Directory, Driver);
llvm::sys::path::make_absolute(Cmd.Directory, Driver);
}
this->Driver = Driver.str().str();
for (size_t I = 0, E = Cmd.CommandLine.size(); I < E; ++I) {
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clangd/index/SymbolCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class SymbolCollector::HeaderFileURICache {
if (R.second) {
llvm::SmallString<256> AbsPath = Path;
if (!llvm::sys::path::is_absolute(AbsPath) && !FallbackDir.empty())
llvm::sys::fs::make_absolute(FallbackDir, AbsPath);
llvm::sys::path::make_absolute(FallbackDir, AbsPath);
assert(llvm::sys::path::is_absolute(AbsPath) &&
"If the VFS can't make paths absolute, a FallbackDir must be "
"provided");
Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/clangd/tool/ClangdMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ class TestScheme : public URIScheme {
Body = Body.ltrim('/');
llvm::SmallString<16> Path(Body);
path::native(Path);
fs::make_absolute(TestScheme::TestDir, Path);
path::make_absolute(TestScheme::TestDir, Path);
return std::string(Path);
}

Expand Down Expand Up @@ -775,8 +775,8 @@ It should be used via an editor plugin rather than invoked directly. For more in
clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.
)";
llvm::cl::HideUnrelatedOptions(ClangdCategories);
llvm::cl::ParseCommandLineOptions(argc, argv, Overview,
/*Errs=*/nullptr, FlagsEnvVar);
llvm::cl::ParseCommandLineOptions(argc, argv, Overview, /*Errs=*/nullptr,
/*VFS=*/nullptr, FlagsEnvVar);
if (Test) {
if (!Sync.getNumOccurrences())
Sync = true;
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ mapInputsToAbsPaths(clang::tooling::CompilationDatabase &CDB,
}
for (const auto &Cmd : Cmds) {
llvm::SmallString<256> CDBPath(Cmd.Filename);
llvm::sys::fs::make_absolute(Cmd.Directory, CDBPath);
llvm::sys::path::make_absolute(Cmd.Directory, CDBPath);
CDBToAbsPaths[std::string(CDBPath)] = std::string(AbsPath);
}
}
Expand Down
10 changes: 6 additions & 4 deletions clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,15 @@ TEST_F(PragmaIncludeTest, ExportInUnnamedBuffer) {
*Diags, "clang"));

auto Clang = std::make_unique<CompilerInstance>(std::move(Invocation));
Clang->createDiagnostics(*VFS);
Clang->createVirtualFileSystem(VFS);
Clang->createDiagnostics();

auto *FM = Clang->createFileManager(VFS);
Clang->createFileManager();
FileManager &FM = Clang->getFileManager();
ASSERT_TRUE(Clang->ExecuteAction(*Inputs.MakeAction()));
EXPECT_THAT(
PI.getExporters(llvm::cantFail(FM->getFileRef("foo.h")), *FM),
testing::ElementsAre(llvm::cantFail(FM->getFileRef("exporter.h"))));
PI.getExporters(llvm::cantFail(FM.getFileRef("foo.h")), FM),
testing::ElementsAre(llvm::cantFail(FM.getFileRef("exporter.h"))));
}

TEST_F(PragmaIncludeTest, OutlivesFMAndSM) {
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,6 @@ def err_drv_optimization_remark_format : Error<
def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, please use [no]simd instead">;
def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">;
def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">;
def err_drv_omp_host_ir_file_not_found : Error<
"provided host compiler IR file '%0' is required to generate code for OpenMP "
"target regions but cannot be found">;
def err_drv_omp_host_target_not_supported : Error<
"target '%0' is not a supported OpenMP host target">;
def err_drv_ptrauth_not_supported : Error<
Expand Down Expand Up @@ -686,6 +683,9 @@ def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
"option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,
InGroup<OptionIgnored>;

def err_drv_profile_instrument_use_path_with_no_kind : Error<
"option '-fprofile-instrument-use-path=' requires -fprofile-instrument-use=<kind>">;

def note_drv_verify_prefix_spelling : Note<
"-verify prefixes must start with a letter and contain only alphanumeric"
" characters, hyphens, and underscores">;
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticFrontendKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ def err_target_unsupported_type_for_abi
: Error<"%0 requires %1 type support, but ABI '%2' does not support it">;
}

def err_omp_host_ir_file_not_found : Error<
"provided host compiler IR file '%0' is required to generate code for OpenMP "
"target regions but cannot be found">;
def err_alias_to_undefined : Error<
"%select{alias|ifunc}0 must point to a defined "
"%select{variable or |}1function">;
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/CodeGen/BackendUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
llvm::MemoryBufferRef Buf);

void EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
DiagnosticsEngine &Diags);
llvm::vfs::FileSystem &VFS, DiagnosticsEngine &Diags);
} // namespace clang

#endif
11 changes: 9 additions & 2 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -3399,7 +3399,8 @@ defm declspec : BoolOption<"f", "declspec",
def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
MetaVarName<"<directory>">,
HelpText<"Specify the module cache path">;
HelpText<"Specify the module cache path">,
MarshallingInfoString<HeaderSearchOpts<"ModuleCachePath">>;
def fmodules_user_build_path : Separate<["-"], "fmodules-user-build-path">, Group<i_Group>,
Flags<[]>, Visibility<[ClangOption, CC1Option]>,
MetaVarName<"<directory>">,
Expand Down Expand Up @@ -8083,6 +8084,11 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">,
HelpText<"Generate instrumented code to collect execution counts into "
"<file> (overridden by LLVM_PROFILE_FILE env var)">,
MarshallingInfoString<CodeGenOpts<"InstrProfileOutput">>;
def fprofile_instrument_use_EQ : Joined<["-"], "fprofile-instrument-use=">,
HelpText<"Enable PGO use instrumentation">, Values<"none,clang,llvm,csllvm,sample-coldcov">,
NormalizedValuesScope<"llvm::driver::ProfileInstrKind">,
NormalizedValues<["ProfileNone", "ProfileClangInstr", "ProfileIRInstr", "ProfileCSIRInstr", "ProfileIRSampleColdCov"]>,
MarshallingInfoEnum<CodeGenOpts<"ProfileUse">, "ProfileNone">;
def fprofile_instrument_use_path_EQ :
Joined<["-"], "fprofile-instrument-use-path=">,
HelpText<"Specify the profile path in PGO use compilation">,
Expand Down Expand Up @@ -8886,7 +8892,8 @@ def fopenmp_is_target_device : Flag<["-"], "fopenmp-is-target-device">,
HelpText<"Generate code only for an OpenMP target device.">;
def : Flag<["-"], "fopenmp-is-device">, Alias<fopenmp_is_target_device>;
def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
HelpText<"Path to the IR file produced by the frontend for the host.">;
HelpText<"Path to the IR file produced by the frontend for the host.">,
MarshallingInfoString<LangOpts<"OMPHostIRFile">>;

} // let Visibility = [CC1Option, FC1Option]

Expand Down
7 changes: 3 additions & 4 deletions clang/include/clang/Frontend/ASTUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,16 +706,15 @@ class ASTUnit {
/// \returns - The initialized ASTUnit or null if the AST failed to load.
static std::unique_ptr<ASTUnit> LoadFromASTFile(
StringRef Filename, const PCHContainerReader &PCHContainerRdr,
WhatToLoad ToLoad, std::shared_ptr<DiagnosticOptions> DiagOpts,
WhatToLoad ToLoad, IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
std::shared_ptr<DiagnosticOptions> DiagOpts,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
const FileSystemOptions &FileSystemOpts,
const HeaderSearchOptions &HSOpts, const LangOptions *LangOpts = nullptr,
bool OnlyLocalDecls = false,
CaptureDiagsKind CaptureDiagnostics = CaptureDiagsKind::None,
bool AllowASTWithCompilerErrors = false,
bool UserFilesAreVolatile = false,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS =
llvm::vfs::getRealFileSystem());
bool UserFilesAreVolatile = false);

private:
/// Helper function for \c LoadFromCompilerInvocation() and
Expand Down
51 changes: 37 additions & 14 deletions clang/include/clang/Frontend/CompilerInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ class CompilerInstance : public ModuleLoader {
/// The options used in this compiler instance.
std::shared_ptr<CompilerInvocation> Invocation;

/// The virtual file system instance.
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS;

/// The diagnostics engine instance.
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;

Expand Down Expand Up @@ -453,7 +456,31 @@ class CompilerInstance : public ModuleLoader {
/// @name Virtual File System
/// @{

llvm::vfs::FileSystem &getVirtualFileSystem() const;
bool hasVirtualFileSystem() const { return VFS != nullptr; }

/// Create a virtual file system instance based on the invocation.
///
/// @param BaseFS The file system that may be used when configuring the final
/// file system, and act as the underlying file system. Must not
/// be NULL.
/// @param DC If non-NULL, the diagnostic consumer to be used in case
/// configuring the file system emits diagnostics. Note that the
/// DiagnosticsEngine using the consumer won't obey the
/// --warning-suppression-mappings= flag.
void createVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem>
BaseFS = llvm::vfs::getRealFileSystem(),
DiagnosticConsumer *DC = nullptr);

/// Use the given file system.
void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
VFS = std::move(FS);
}

llvm::vfs::FileSystem &getVirtualFileSystem() const { return *VFS; }

IntrusiveRefCntPtr<llvm::vfs::FileSystem> getVirtualFileSystemPtr() const {
return VFS;
}

/// @}
/// @name File Manager
Expand Down Expand Up @@ -691,32 +718,31 @@ class CompilerInstance : public ModuleLoader {
/// Note that this routine also replaces the diagnostic client,
/// allocating one if one is not provided.
///
/// \param VFS is used for any IO needed when creating DiagnosticsEngine. It
/// doesn't replace VFS in the CompilerInstance (if any).
///
/// \param Client If non-NULL, a diagnostic client that will be
/// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
/// unit.
///
/// \param ShouldOwnClient If Client is non-NULL, specifies whether
/// the diagnostic object should take ownership of the client.
void createDiagnostics(llvm::vfs::FileSystem &VFS,
DiagnosticConsumer *Client = nullptr,
void createDiagnostics(DiagnosticConsumer *Client = nullptr,
bool ShouldOwnClient = true);

/// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
/// Create a DiagnosticsEngine object.
///
/// If no diagnostic client is provided, this creates a
/// DiagnosticConsumer that is owned by the returned diagnostic
/// object, if using directly the caller is responsible for
/// releasing the returned DiagnosticsEngine's client eventually.
///
/// \param VFS The file system used to load the suppression mappings file.
///
/// \param Opts - The diagnostic options; note that the created text
/// diagnostic object contains a reference to these options.
///
/// \param Client If non-NULL, a diagnostic client that will be
/// attached to (and, then, owned by) the returned DiagnosticsEngine
/// object.
/// object. If NULL, the returned DiagnosticsEngine will own a newly-created
/// client.
///
/// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
/// used by some diagnostics printers (for logging purposes only).
Expand All @@ -729,13 +755,10 @@ class CompilerInstance : public ModuleLoader {
const CodeGenOptions *CodeGenOpts = nullptr);

/// Create the file manager and replace any existing one with it.
///
/// \return The new file manager on success, or null on failure.
FileManager *
createFileManager(IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
void createFileManager();

/// Create the source manager and replace any existing one with it.
void createSourceManager(FileManager &FileMgr);
void createSourceManager();

/// Create the preprocessor, using the invocation, file, and source managers,
/// and replace any existing one with it.
Expand Down Expand Up @@ -1005,7 +1028,7 @@ class CompilerInstance : public ModuleLoader {

std::pair<std::shared_ptr<llvm::cas::ObjectStore>,
std::shared_ptr<llvm::cas::ActionCache>>
createCASDatabases();
getOrCreateCASDatabases();
};

} // end namespace clang
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Frontend/CompilerInvocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ IntrusiveRefCntPtr<llvm::vfs::FileSystem> createVFSFromCompilerInvocation(

IntrusiveRefCntPtr<llvm::vfs::FileSystem> createVFSFromCompilerInvocation(
const CompilerInvocation &CI, DiagnosticsEngine &Diags,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS);
IntrusiveRefCntPtr<llvm::vfs::FileSystem> BaseFS,
std::shared_ptr<llvm::cas::ObjectStore> OverrideCAS = nullptr);

IntrusiveRefCntPtr<llvm::vfs::FileSystem>
createVFSFromOverlayFiles(ArrayRef<std::string> VFSOverlayFiles,
Expand Down
5 changes: 3 additions & 2 deletions clang/include/clang/Frontend/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ class ModuleDependencyCollector : public DependencyCollector {
std::error_code copyToRoot(StringRef Src, StringRef Dst = {});

public:
ModuleDependencyCollector(std::string DestDir)
: DestDir(std::move(DestDir)) {}
ModuleDependencyCollector(std::string DestDir,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS)
: DestDir(std::move(DestDir)), Canonicalizer(std::move(VFS)) {}
~ModuleDependencyCollector() override { writeFileMap(); }

StringRef getDest() { return DestDir; }
Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Lex/HeaderSearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,9 @@ void ApplyHeaderSearchOptions(HeaderSearch &HS,
const LangOptions &Lang,
const llvm::Triple &triple);

void normalizeModuleCachePath(FileManager &FileMgr, StringRef Path,
SmallVectorImpl<char> &NormalizedPath);

} // namespace clang

#endif // LLVM_CLANG_LEX_HEADERSEARCH_H
9 changes: 8 additions & 1 deletion clang/include/clang/Serialization/ModuleCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ class ModuleCache : public RefCountedBase<ModuleCache> {
/// were validated.
virtual void updateModuleTimestamp(StringRef ModuleFilename) = 0;

/// Prune module files that haven't been accessed in a long time.
virtual void maybePrune(StringRef Path, time_t PruneInterval,
time_t PruneAfter) = 0;

/// Returns this process's view of the module cache.
virtual InMemoryModuleCache &getInMemoryModuleCache() = 0;
virtual const InMemoryModuleCache &getInMemoryModuleCache() const = 0;

// TODO: Virtualize writing/reading PCM files, pruning, etc.
// TODO: Virtualize writing/reading PCM files, etc.

virtual ~ModuleCache() = default;
};
Expand All @@ -59,6 +63,9 @@ class ModuleCache : public RefCountedBase<ModuleCache> {
/// \c CompilerInstance instances participating in building modules for single
/// translation unit in order to share the same \c InMemoryModuleCache.
IntrusiveRefCntPtr<ModuleCache> createCrossProcessModuleCache();

/// Shared implementation of `ModuleCache::maybePrune()`.
void maybePruneImpl(StringRef Path, time_t PruneInterval, time_t PruneAfter);
} // namespace clang

#endif
Loading