Skip to content

Commit b732f1e

Browse files
committed
[clang][deps] Share FileManager between modules (llvm#115065)
The `FileManager` sharing between module-building `CompilerInstance`s was disabled a while ago due to `FileEntry::getName()` being unreliable. Now that we use `FileEntryRef::getNameAsRequested()` in places where it matters, re-enabling `FileManager` is sound and improves performance of `clang-scan-deps` by ~6.2%. (cherry picked from commit a6637ae)
1 parent 9b960d6 commit b732f1e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ class DependencyScanningAction : public tooling::ToolAction {
469469

470470
ScanInstance.getFrontendOpts().GenerateGlobalModuleIndex = false;
471471
ScanInstance.getFrontendOpts().UseGlobalModuleIndex = false;
472-
ScanInstance.getFrontendOpts().ModulesShareFileManager = false;
472+
// This will prevent us compiling individual modules asynchronously since
473+
// FileManager is not thread-safe, but it does improve performance for now.
474+
ScanInstance.getFrontendOpts().ModulesShareFileManager = true;
473475
ScanInstance.getHeaderSearchOpts().ModuleFormat = "raw";
474476
ScanInstance.getHeaderSearchOpts().ModulesIncludeVFSUsage =
475477
any(OptimizeArgs & ScanningOptimizations::VFS);

0 commit comments

Comments
 (0)