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.
This commit is contained in:
varkor 2017-12-15 19:25:05 +00:00
parent 50f6c3ece0
commit a399326ca2

View File

@ -613,7 +613,10 @@ impl ThinModule {
self.data().len(), self.data().len(),
self.shared.module_names[self.idx].as_ptr(), 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 { let mtrans = ModuleTranslation {
source: ModuleSource::Translated(ModuleLlvm { source: ModuleSource::Translated(ModuleLlvm {
llmod, llmod,