Skip to content

Commit cc400bf

Browse files
committed
[Dependency Scanning] Ensure INITIALIZE_LLVM() is invoked on scanner creation to populate LLVM's target data store.
1 parent 94b727f commit cc400bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/libSwiftScan/libSwiftScan.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17+
#include "swift/Basic/LLVMInitialize.h"
1718
#include "swift/DependencyScan/DependencyScanImpl.h"
1819
#include "swift/DependencyScan/DependencyScanningTool.h"
1920
#include "swift/DependencyScan/StringUtils.h"
@@ -104,6 +105,7 @@ void swiftscan_dependency_set_dispose(swiftscan_dependency_set_t *set) {
104105
//=== Scanner Functions ---------------------------------------------------===//
105106

106107
swiftscan_scanner_t swiftscan_scanner_create(void) {
108+
INITIALIZE_LLVM();
107109
return wrap(new DependencyScanningTool());
108110
}
109111

@@ -153,13 +155,16 @@ swiftscan_batch_scan_result_create(swiftscan_scanner_t scanner,
153155
auto ResultGraphs = new swiftscan_dependency_graph_t[BatchScanResult.size()];
154156
for (size_t i = 0; i < BatchScanResult.size(); ++i) {
155157
auto &ResultOrErr = BatchScanResult[i];
156-
if (ResultOrErr.getError())
158+
if (ResultOrErr.getError()) {
157159
ResultGraphs[i] = nullptr;
160+
continue;
161+
}
158162

159163
ResultGraphs[i] = ResultOrErr.get();
160164
}
161165

162166
Result->results = ResultGraphs;
167+
Result->count = BatchScanResult.size();
163168
return Result;
164169
}
165170

0 commit comments

Comments
 (0)