Skip to content

Commit f8ba0df

Browse files
authored
[clang][deps] Remove dependency on llvm targets from lib DependencyScanning (#129774)
In d64eccf we split the object file reader from the writer and removed the dependency on clangCodeGen from the dependency scanner. However, we were still initializing all the llvm targets, which was needed for writing object file pcms but not reading them. This caused us to link more llvm target code than necessary. Shrinks clangd by nearly 50% for me. rdar://144790713
1 parent 9925359 commit f8ba0df

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

clang/lib/Tooling/DependencyScanning/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
set(LLVM_LINK_COMPONENTS
2-
${LLVM_TARGETS_TO_BUILD}
32
Core
43
Option
54
Support

clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "clang/Tooling/DependencyScanning/DependencyScanningService.h"
10-
#include "llvm/Support/TargetSelect.h"
1110

1211
using namespace clang;
1312
using namespace tooling;
@@ -17,10 +16,4 @@ DependencyScanningService::DependencyScanningService(
1716
ScanningMode Mode, ScanningOutputFormat Format,
1817
ScanningOptimizations OptimizeArgs, bool EagerLoadModules, bool TraceVFS)
1918
: Mode(Mode), Format(Format), OptimizeArgs(OptimizeArgs),
20-
EagerLoadModules(EagerLoadModules), TraceVFS(TraceVFS) {
21-
// Initialize targets for object file support.
22-
llvm::InitializeAllTargets();
23-
llvm::InitializeAllTargetMCs();
24-
llvm::InitializeAllAsmPrinters();
25-
llvm::InitializeAllAsmParsers();
26-
}
19+
EagerLoadModules(EagerLoadModules), TraceVFS(TraceVFS) {}

0 commit comments

Comments
 (0)