]> granicus.if.org Git - clang/commitdiff
Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.
authorIlya Biryukov <ibiryukov@google.com>
Wed, 28 Jun 2017 15:06:34 +0000 (15:06 +0000)
committerIlya Biryukov <ibiryukov@google.com>
Wed, 28 Jun 2017 15:06:34 +0000 (15:06 +0000)
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
lib/Frontend/ASTUnit.cpp
lib/Frontend/CreateInvocationFromCommandLine.cpp

index 0ee46846c804e5a6d5a5449e04e7acdc7ca818d9..8ccc31982dabd47abac89a5c8d263f50cb264eb7 100644 (file)
@@ -184,10 +184,11 @@ createChainedIncludesSource(CompilerInstance &CI,
 ///
 /// \return A CompilerInvocation, or 0 if none was built for the given
 /// argument vector.
-std::unique_ptr<CompilerInvocation>
-createInvocationFromCommandLine(ArrayRef<const char *> Args,
-                                IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
-                                    IntrusiveRefCntPtr<DiagnosticsEngine>());
+std::unique_ptr<CompilerInvocation> createInvocationFromCommandLine(
+    ArrayRef<const char *> Args,
+    IntrusiveRefCntPtr<DiagnosticsEngine> Diags =
+        IntrusiveRefCntPtr<DiagnosticsEngine>(),
+    IntrusiveRefCntPtr<vfs::FileSystem> 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.
index 1f34f10f55af6f0b9cbe9ec3c920a9652a777e51..c5a911fdae08fec41d0092d451ef703c3fb2415f 100644 (file)
@@ -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;
   }
index 49d459e78c45d2f6c471d7af58fb5299dd6f4e72..c3ce7ce2b7420ef30244a686393978b6b57d3393 100644 (file)
@@ -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<CompilerInvocation> clang::createInvocationFromCommandLine(
-    ArrayRef<const char *> ArgList,
-    IntrusiveRefCntPtr<DiagnosticsEngine> Diags) {
+    ArrayRef<const char *> ArgList, IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
+    IntrusiveRefCntPtr<vfs::FileSystem> 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<CompilerInvocation> 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);