[Dependency Scanning] Ensure INITIALIZE_LLVM() is invoked on scanner creation to populate LLVM's target data store.

This commit is contained in:
Artem Chikin
2021-01-07 09:07:43 -08:00
parent 94b727fb2b
commit cc400bf759

View File

@@ -14,6 +14,7 @@
//
//===----------------------------------------------------------------------===//
#include "swift/Basic/LLVMInitialize.h"
#include "swift/DependencyScan/DependencyScanImpl.h"
#include "swift/DependencyScan/DependencyScanningTool.h"
#include "swift/DependencyScan/StringUtils.h"
@@ -104,6 +105,7 @@ void swiftscan_dependency_set_dispose(swiftscan_dependency_set_t *set) {
//=== Scanner Functions ---------------------------------------------------===//
swiftscan_scanner_t swiftscan_scanner_create(void) {
INITIALIZE_LLVM();
return wrap(new DependencyScanningTool());
}
@@ -153,13 +155,16 @@ swiftscan_batch_scan_result_create(swiftscan_scanner_t scanner,
auto ResultGraphs = new swiftscan_dependency_graph_t[BatchScanResult.size()];
for (size_t i = 0; i < BatchScanResult.size(); ++i) {
auto &ResultOrErr = BatchScanResult[i];
if (ResultOrErr.getError())
if (ResultOrErr.getError()) {
ResultGraphs[i] = nullptr;
continue;
}
ResultGraphs[i] = ResultOrErr.get();
}
Result->results = ResultGraphs;
Result->count = BatchScanResult.size();
return Result;
}