Skip to content

Commit 961535d

Browse files
authored
Merge pull request #62759 from DougGregor/loaded-module-trace-no-crash
2 parents 0c54362 + aa969c7 commit 961535d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/FrontendTool/LoadedModuleTrace.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,12 @@ static void computeSwiftModuleTraceInfo(
629629
// filename available.
630630
if (isSwiftinterface) {
631631
// FIXME: Use PrettyStackTrace instead.
632-
SmallVector<char, 0> errMsg;
633-
llvm::raw_svector_ostream err(errMsg);
634-
err << "Unexpected path for swiftinterface file:\n" << depPath << "\n";
635-
err << "The module <-> path mapping we have is:\n";
632+
llvm::errs() << "WARNING: unexpected path for swiftinterface file:\n"
633+
<< depPath << "\n"
634+
<< "The module <-> path mapping we have is:\n";
636635
for (auto &m : pathToModuleDecl)
637-
err << m.second->getName() << " <-> " << m.first << '\n';
638-
llvm::report_fatal_error(errMsg);
636+
llvm::errs() << m.second->getName() << " <-> " << m.first << '\n';
637+
continue;
639638
}
640639

641640
// Skip cached modules in the prebuilt cache. We will add the corresponding
@@ -710,8 +709,11 @@ bool swift::emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
710709
llvm::DenseMap<StringRef, ModuleDecl *> pathToModuleDecl;
711710
for (const auto &module : ctxt.getLoadedModules()) {
712711
ModuleDecl *loadedDecl = module.second;
713-
if (!loadedDecl)
714-
llvm::report_fatal_error("Expected loaded modules to be non-null.");
712+
if (!loadedDecl) {
713+
llvm::errs() << "WARNING: Unable to load module '" << module.first
714+
<< ".\n";
715+
continue;
716+
}
715717
if (loadedDecl == mainModule)
716718
continue;
717719
if (loadedDecl->getModuleFilename().empty()) {

0 commit comments

Comments
 (0)