mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 09:34:42 +01:00
Propagate llvm::vfs::FileSystem from driver_env to Clang (#4537)
As discussed in #4530 . This required switching to using `llvm::IntrusiveRefCntPtr` in a number of places. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include "llvm/Support/LLVMDriver.h"
|
||||
#include "llvm/Support/Path.h"
|
||||
#include "llvm/Support/Program.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
#include "llvm/TargetParser/Host.h"
|
||||
|
||||
// Defined in:
|
||||
@@ -42,9 +41,12 @@ auto clang_main(int Argc, char** Argv, const llvm::ToolContext& ToolContext)
|
||||
namespace Carbon {
|
||||
|
||||
ClangRunner::ClangRunner(const InstallPaths* install_paths,
|
||||
llvm::StringRef target, llvm::raw_ostream* vlog_stream)
|
||||
llvm::StringRef target,
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
||||
llvm::raw_ostream* vlog_stream)
|
||||
: installation_(install_paths),
|
||||
target_(target),
|
||||
fs_(std::move(fs)),
|
||||
vlog_stream_(vlog_stream),
|
||||
diagnostic_ids_(new clang::DiagnosticIDs()) {}
|
||||
|
||||
@@ -123,10 +125,10 @@ auto ClangRunner::Run(llvm::ArrayRef<llvm::StringRef> args) -> bool {
|
||||
clang::DiagnosticsEngine diagnostics(
|
||||
diagnostic_ids_, diagnostic_options.get(), &diagnostic_client,
|
||||
/*ShouldOwnClient=*/false);
|
||||
auto vfs = llvm::vfs::getRealFileSystem();
|
||||
clang::ProcessWarningOptions(diagnostics, *diagnostic_options, *vfs);
|
||||
clang::ProcessWarningOptions(diagnostics, *diagnostic_options, *fs_);
|
||||
|
||||
clang::driver::Driver driver(clang_path, target_, diagnostics);
|
||||
clang::driver::Driver driver(clang_path, target_, diagnostics,
|
||||
"clang LLVM compiler", fs_);
|
||||
|
||||
// Configure the install directory to find other tools and data files.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user