mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +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:
@@ -24,7 +24,7 @@ class CompileBenchmark {
|
||||
CompileBenchmark()
|
||||
: installation_(InstallPaths::MakeForBazelRunfiles(GetExePath())),
|
||||
driver_(fs_, &installation_, llvm::outs(), llvm::errs()) {
|
||||
AddPreludeFilesToVfs(installation_, &fs_);
|
||||
AddPreludeFilesToVfs(installation_, fs_);
|
||||
}
|
||||
|
||||
// Setup a set of source files in the VFS for the driver. Each string input is
|
||||
@@ -35,8 +35,8 @@ class CompileBenchmark {
|
||||
llvm::OwningArrayRef<std::string> file_names(sources.size());
|
||||
for (ssize_t i : llvm::seq<ssize_t>(sources.size())) {
|
||||
file_names[i] = llvm::formatv("file_{0}.carbon", i).str();
|
||||
fs_.addFile(file_names[i], /*ModificationTime=*/0,
|
||||
llvm::MemoryBuffer::getMemBuffer(sources[i]));
|
||||
fs_->addFile(file_names[i], /*ModificationTime=*/0,
|
||||
llvm::MemoryBuffer::getMemBuffer(sources[i]));
|
||||
}
|
||||
return file_names;
|
||||
}
|
||||
@@ -45,7 +45,8 @@ class CompileBenchmark {
|
||||
auto gen() -> SourceGen& { return gen_; }
|
||||
|
||||
private:
|
||||
llvm::vfs::InMemoryFileSystem fs_;
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> fs_ =
|
||||
new llvm::vfs::InMemoryFileSystem;
|
||||
const InstallPaths installation_;
|
||||
Driver driver_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user