]> granicus.if.org Git - clang/commitdiff
[Tooling] Avoid diagnosing missing input files in an edge-case where it's incorrect.
authorSam McCall <sam.mccall@gmail.com>
Fri, 9 Nov 2018 11:49:22 +0000 (11:49 +0000)
committerSam McCall <sam.mccall@gmail.com>
Fri, 9 Nov 2018 11:49:22 +0000 (11:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346485 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Tooling/Tooling.cpp

index f143f7fe71f5fd79ac3e80bb573930bb34df3500..cfdb32f0ae62feb62dacf2e92ff3cc115e59c6ea 100644 (file)
@@ -303,6 +303,12 @@ bool ToolInvocation::run() {
 
   const std::unique_ptr<driver::Driver> Driver(
       newDriver(&Diagnostics, BinaryName, Files->getVirtualFileSystem()));
+  // The "input file not found" diagnostics from the driver are useful.
+  // The driver is only aware of the VFS working directory, but some clients
+  // change this at the FileManager level instead.
+  // In this case the checks have false positives, so skip them.
+  if (!Files->getFileSystemOpts().WorkingDir.empty())
+    Driver->setCheckInputsExist(false);
   const std::unique_ptr<driver::Compilation> Compilation(
       Driver->BuildCompilation(llvm::makeArrayRef(Argv)));
   if (!Compilation)