Skip to content

Commit

Permalink
Auto merge of #46750 - varkor:imp-llmod, r=estebank
Browse files Browse the repository at this point in the history
Improve error messages on LLVM bitcode parsing failure

The LLVM error causing the parse failure is now printed, in the style
of the other thin LTO error messages. This prevents a flood of
assertion failure messages if the bitcode can’t be parsed.
  • Loading branch information
bors committed Dec 16, 2017
2 parents 3bee2b4 + a399326 commit 1b1c792
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc_trans/back/lto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,10 @@ impl ThinModule {
self.data().len(),
self.shared.module_names[self.idx].as_ptr(),
);
assert!(!llmod.is_null());
if llmod.is_null() {
let msg = format!("failed to parse bitcode for thin LTO module");
return Err(write::llvm_err(&diag_handler, msg));
}
let mtrans = ModuleTranslation {
source: ModuleSource::Translated(ModuleLlvm {
llmod,
Expand Down

0 comments on commit 1b1c792

Please sign in to comment.