summaryrefslogtreecommitdiffstats
path: root/lib/Tooling/Tooling.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-10-09 13:03:25 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-10-09 13:03:25 +0000
commit47928a9602f4bc13c065bad2f7f940bee2711e63 (patch)
tree6fc4797d8fe68cc121e90b1de77705a3e0352ce1 /lib/Tooling/Tooling.cpp
parent034e609feabe73e07a23e4adfdcfd1cd92b8887d (diff)
[VFS] Wire up driver VFS through tooling.
Sadly I don't currently have a way to tests this as the driver is always initialized with the default triple and finding system headers is system specific. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Tooling/Tooling.cpp')
-rw-r--r--lib/Tooling/Tooling.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Tooling/Tooling.cpp b/lib/Tooling/Tooling.cpp
index b44371c09b..220b62558b 100644
--- a/lib/Tooling/Tooling.cpp
+++ b/lib/Tooling/Tooling.cpp
@@ -46,10 +46,11 @@ FrontendActionFactory::~FrontendActionFactory() {}
// it to be based on the same framework.
/// \brief Builds a clang driver initialized for running clang tools.
-static clang::driver::Driver *newDriver(clang::DiagnosticsEngine *Diagnostics,
- const char *BinaryName) {
+static clang::driver::Driver *newDriver(
+ clang::DiagnosticsEngine *Diagnostics, const char *BinaryName,
+ IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
clang::driver::Driver *CompilerDriver = new clang::driver::Driver(
- BinaryName, llvm::sys::getDefaultTargetTriple(), *Diagnostics);
+ BinaryName, llvm::sys::getDefaultTargetTriple(), *Diagnostics, VFS);
CompilerDriver->setTitle("clang_based_tool");
return CompilerDriver;
}
@@ -238,7 +239,7 @@ bool ToolInvocation::run() {
DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
const std::unique_ptr<clang::driver::Driver> Driver(
- newDriver(&Diagnostics, BinaryName));
+ newDriver(&Diagnostics, BinaryName, Files->getVirtualFileSystem()));
// Since the input might only be virtual, don't check whether it exists.
Driver->setCheckInputsExist(false);
const std::unique_ptr<clang::driver::Compilation> Compilation(