From 351c5b32bd8b35886cc5ad8d48bac63488bd43a1 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 28 Jun 2017 15:06:34 +0000 Subject: [PATCH] Use vfs::FileSystem in ASTUnit when creating CompilerInvocation. Summary: It used to always call into the RealFileSystem before. Reviewers: bkramer, krasimir, klimek, bruno Reviewed By: klimek Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D34469 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306549 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Frontend/Utils.h | 9 +++++---- lib/Frontend/ASTUnit.cpp | 2 +- lib/Frontend/CreateInvocationFromCommandLine.cpp | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/clang/Frontend/Utils.h b/include/clang/Frontend/Utils.h index 0ee46846c8..8ccc31982d 100644 --- a/include/clang/Frontend/Utils.h +++ b/include/clang/Frontend/Utils.h @@ -184,10 +184,11 @@ createChainedIncludesSource(CompilerInstance &CI, /// /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. -std::unique_ptr -createInvocationFromCommandLine(ArrayRef Args, - IntrusiveRefCntPtr Diags = - IntrusiveRefCntPtr()); +std::unique_ptr createInvocationFromCommandLine( + ArrayRef Args, + IntrusiveRefCntPtr Diags = + IntrusiveRefCntPtr(), + IntrusiveRefCntPtr VFS = nullptr); /// Return the value of the last argument as an integer, or a default. If Diags /// is non-null, emits an error if the argument is given, but non-integral. diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 1f34f10f55..c5a911fdae 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -1638,7 +1638,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( &StoredDiagnostics, nullptr); CI = clang::createInvocationFromCommandLine( - llvm::makeArrayRef(ArgBegin, ArgEnd), Diags); + llvm::makeArrayRef(ArgBegin, ArgEnd), Diags, VFS); if (!CI) return nullptr; } diff --git a/lib/Frontend/CreateInvocationFromCommandLine.cpp b/lib/Frontend/CreateInvocationFromCommandLine.cpp index 49d459e78c..c3ce7ce2b7 100644 --- a/lib/Frontend/CreateInvocationFromCommandLine.cpp +++ b/lib/Frontend/CreateInvocationFromCommandLine.cpp @@ -31,8 +31,8 @@ using namespace llvm::opt; /// \return A CompilerInvocation, or 0 if none was built for the given /// argument vector. std::unique_ptr clang::createInvocationFromCommandLine( - ArrayRef ArgList, - IntrusiveRefCntPtr Diags) { + ArrayRef ArgList, IntrusiveRefCntPtr Diags, + IntrusiveRefCntPtr VFS) { if (!Diags.get()) { // No diagnostics engine was provided, so create our own diagnostics object // with the default options. @@ -46,7 +46,7 @@ std::unique_ptr clang::createInvocationFromCommandLine( // FIXME: We shouldn't have to pass in the path info. driver::Driver TheDriver(Args[0], llvm::sys::getDefaultTargetTriple(), - *Diags); + *Diags, VFS); // Don't check that inputs exist, they may have been remapped. TheDriver.setCheckInputsExist(false); -- 2.40.0