improve error message

This commit is contained in:
Folkert 2022-07-17 17:22:47 +02:00
parent 8cec4c41f8
commit 03fec5f21c
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -261,8 +261,12 @@ fn create_llvm_module<'a>(
// Verify the module
if let Err(errors) = env.module.verify() {
env.module.print_to_file("/tmp/test.ll").unwrap();
panic!("Errors defining module:\n\n{}", errors.to_string());
let path = "/tmp/test.ll";
env.module.print_to_file(path).unwrap();
panic!(
"Errors defining module:\n\n{}\n\nI have written the full module to `{path}`",
errors.to_string()
);
}
// Uncomment this to see the module's optimized LLVM instruction output: