diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-09-16 08:21:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-16 08:21:06 -0700 |
commit | 30633f30894129919050f24fdd1f8f6bc46beae0 (patch) | |
tree | 169acbfe0c6a7fdb7a3b135f16b248f3d79a6110 /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 9865f7ec2bb15f3d8aa25c7e9305393422597dc5 (diff) | |
download | llvm-30633f30894129919050f24fdd1f8f6bc46beae0.zip llvm-30633f30894129919050f24fdd1f8f6bc46beae0.tar.gz llvm-30633f30894129919050f24fdd1f8f6bc46beae0.tar.bz2 |
[clang] Initialize the file system explicitly (#158381)
This PR is a part of the effort to make the VFS used in the compiler
more explicit and consistent.
Instead of creating the VFS deep within the compiler (in
`CompilerInstance::createFileManager()`), clients are now required to
explicitly call `CompilerInstance::createVirtualFileSystem()` and
provide the base VFS from the outside.
This PR also helps in breaking up the dependency cycle where creating a
properly configured `DiagnosticsEngine` requires a properly configured
VFS, but creating properly configuring a VFS requires the
`DiagnosticsEngine`.
Both `CompilerInstance::create{FileManager,Diagnostics}()` now just use
the VFS already in `CompilerInstance` instead of taking one as a
parameter, making the VFS consistent across the instance sub-object.
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 0f96fa9..940be42 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2210,7 +2210,9 @@ protected: const char *clang_args[] = {"clang", pcm_path}; clang::CompilerInstance compiler(clang::createInvocation(clang_args)); - compiler.createDiagnostics(*FileSystem::Instance().GetVirtualFileSystem()); + compiler.setVirtualFileSystem( + FileSystem::Instance().GetVirtualFileSystem()); + compiler.createDiagnostics(); // Pass empty deleter to not attempt to free memory that was allocated // outside of the current scope, possibly statically. |