Skip to content

[NFC] Don't crash when we see an empty filename for a module. #30099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,16 @@ static bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
llvm::report_fatal_error("Expected loaded modules to be non-null.");
if (loadedDecl == mainModule)
continue;
if (loadedDecl->getModuleFilename().empty())
llvm::report_fatal_error(
"Don't know how to handle modules with empty names."
" One potential reason for getting an empty module name might"
" be that the module could not be deserialized correctly.");
if (loadedDecl->getModuleFilename().empty()) {
// FIXME: rdar://problem/59853077
// Ideally, this shouldn't happen. As a temporary workaround, avoid
// crashing with a message while we investigate the problem.
llvm::errs() << "WARNING: Module '" << loadedDecl->getName().str()
<< "' has an empty filename. This is probably an "
<< "invariant violation.\n"
<< "Please report it as a compiler bug.\n";
continue;
}
pathToModuleDecl.insert(
std::make_pair(loadedDecl->getModuleFilename(), loadedDecl));
}
Expand Down