Skip to content

Commit a6637ae

Browse files
authored
[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%.
1 parent df0a56c commit a6637ae

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
@@ -335,7 +335,9 @@ class DependencyScanningAction : public tooling::ToolAction {
335335

336336
ScanInstance.getFrontendOpts().GenerateGlobalModuleIndex = false;
337337
ScanInstance.getFrontendOpts().UseGlobalModuleIndex = false;
338-
ScanInstance.getFrontendOpts().ModulesShareFileManager = false;
338+
// This will prevent us compiling individual modules asynchronously since
339+
// FileManager is not thread-safe, but it does improve performance for now.
340+
ScanInstance.getFrontendOpts().ModulesShareFileManager = true;
339341
ScanInstance.getHeaderSearchOpts().ModuleFormat = "raw";
340342
ScanInstance.getHeaderSearchOpts().ModulesIncludeVFSUsage =
341343
any(OptimizeArgs & ScanningOptimizations::VFS);

0 commit comments

Comments
 (0)