more codegen

This commit is contained in:
nora 2023-05-24 21:49:56 +02:00
parent ee0b311261
commit db219d3d74
7 changed files with 214 additions and 15 deletions

View file

@ -10,7 +10,7 @@ use object::{
type Result<T, E = analysis::Error> = std::result::Result<T, E>;
pub fn generate<'cx>(lcx: &LoweringCx<'cx>, ir: &Ir<'cx>) -> Result<()> {
pub fn generate<'cx>(lcx: &'cx LoweringCx<'cx>, ir: &Ir<'cx>) -> Result<()> {
let mut obj = Object::new(
object::BinaryFormat::Elf,
object::Architecture::X86_64,
@ -61,11 +61,11 @@ pub fn generate<'cx>(lcx: &LoweringCx<'cx>, ir: &Ir<'cx>) -> Result<()> {
"linking with `cc` failed"
)));
} else {
std::fs::remove_file("main.o").map_err(|err| {
analysis::Error::new_without_span(format!(
"failed to remove temporary file main.o: {err}"
))
})?;
// std::fs::remove_file("main.o").map_err(|err| {
// analysis::Error::new_without_span(format!(
// "failed to remove temporary file main.o: {err}"
// ))
// })?;
}
Ok(())