[clang] fb137ad - [clang][deps] NFC: Respect working directory on construction
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 4 12:47:35 PDT 2022
Author: Jan Svoboda
Date: 2022-10-04T12:47:22-07:00
New Revision: fb137adc9b3fa47989fac5cb8a346f0a3a2733bd
URL: https://github.com/llvm/llvm-project/commit/fb137adc9b3fa47989fac5cb8a346f0a3a2733bd
DIFF: https://github.com/llvm/llvm-project/commit/fb137adc9b3fa47989fac5cb8a346f0a3a2733bd.diff
LOG: [clang][deps] NFC: Respect working directory on construction
This patch provides `FileManager` with the CWD on construction in the worker, rather than later in the action.
Depends on D134976.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D134977
Added:
Modified:
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
Removed:
################################################################################
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index 33dc5797b77db..2da3de34a1850 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -191,7 +191,6 @@ class DependencyScanningAction : public tooling::ToolAction {
ScanInstance.getFrontendOpts().UseGlobalModuleIndex = false;
ScanInstance.getFrontendOpts().ModulesShareFileManager = false;
- FileMgr->getFileSystemOpts().WorkingDir = std::string(WorkingDirectory);
ScanInstance.setFileManager(FileMgr);
ScanInstance.createSourceManager(*FileMgr);
@@ -370,12 +369,6 @@ static bool forEachDriverJob(
for (const std::string &Arg : Args)
Argv.push_back(Arg.c_str());
- // 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 (!FM.getFileSystemOpts().WorkingDir.empty())
- Driver->setCheckInputsExist(false);
const std::unique_ptr<driver::Compilation> Compilation(
Driver->BuildCompilation(llvm::makeArrayRef(Argv)));
if (!Compilation)
@@ -395,8 +388,9 @@ bool DependencyScanningWorker::computeDependencies(
// Reset what might have been modified in the previous worker invocation.
RealFS->setCurrentWorkingDirectory(WorkingDirectory);
- auto FileMgr =
- llvm::makeIntrusiveRefCnt<FileManager>(FileSystemOptions(), RealFS);
+ FileSystemOptions FSOpts;
+ FSOpts.WorkingDir = WorkingDirectory.str();
+ auto FileMgr = llvm::makeIntrusiveRefCnt<FileManager>(FSOpts, RealFS);
Optional<std::vector<std::string>> ModifiedCommandLine;
if (ModuleName) {
More information about the cfe-commits
mailing list