@@ -1413,9 +1413,14 @@ performModuleScanImpl(
14131413 instance->getInvocation ().getFrontendOptions ().ParallelDependencyScan );
14141414
14151415 auto initError = scanner.initializeWorkerClangScanningTool ();
1416- // TODO: fix error check!
1417- if (initError)
1418- llvm::consumeError (std::move (initError));
1416+ if (initError) {
1417+ llvm::handleAllErrors (
1418+ std::move (initError), [&](const llvm::StringError &E) {
1419+ instance->getDiags ().diagnose (
1420+ SourceLoc (), diag::clang_dependency_scan_error, E.getMessage ());
1421+ });
1422+ return std::make_error_code (std::errc::invalid_argument);
1423+ }
14191424
14201425 // Identify imports of the main module and add an entry for it
14211426 // to the dependency graph.
@@ -1432,8 +1437,15 @@ performModuleScanImpl(
14321437 return std::make_error_code (std::errc::not_supported);
14331438
14341439 auto finError = scanner.finalizeWorkerClangScanningTool ();
1435- if (finError)
1436- llvm::consumeError (std::move (finError));
1440+ if (finError) {
1441+ llvm::handleAllErrors (std::move (finError), [&](const llvm::StringError &E) {
1442+ instance->getDiags ().diagnose (
1443+ SourceLoc (), diag::clang_dependency_scan_error, E.getMessage ());
1444+ });
1445+ // TODO:it is not expected that the finialization fails. Maybe we should
1446+ // turn this into an assert.
1447+ return std::make_error_code (std::errc::not_supported);
1448+ }
14371449
14381450 auto topologicallySortedModuleList =
14391451 computeTopologicalSortOfExplicitDependencies (allModules, cache);
0 commit comments