Skip to content
Snippets Groups Projects
Commit 31d56bd2 authored by rarbore2's avatar rarbore2
Browse files

Create temporary LLVM IR files in a fresh temporary directory.

parent 500fc3d2
No related branches found
No related tags found
1 merge request!102Create temporary LLVM IR files in a fresh temporary directory.
......@@ -650,6 +650,7 @@ dependencies = [
"postcard",
"serde",
"take_mut",
"tempfile",
]
[[package]]
......@@ -1392,6 +1393,19 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]]
name = "tempfile"
version = "3.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b"
dependencies = [
"cfg-if",
"fastrand",
"once_cell",
"rustix",
"windows-sys 0.59.0",
]
[[package]]
name = "time"
version = "0.3.36"
......
......@@ -7,6 +7,7 @@ edition = "2021"
[dependencies]
ordered-float = "*"
bitvec = "*"
tempfile = "*"
either = "*"
itertools = "*"
take_mut = "*"
......
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::env::temp_dir;
use std::fs::File;
use std::io::Write;
use std::iter::zip;
......@@ -8,6 +7,8 @@ use std::process::{Command, Stdio};
use serde::Deserialize;
use tempfile::TempDir;
use hercules_cg::*;
use hercules_ir::*;
......@@ -960,7 +961,8 @@ impl PassManager {
println!("{}", rust_rt);
// Write the LLVM IR into a temporary file.
let mut tmp_path = temp_dir();
let tmp_dir = TempDir::new().unwrap();
let mut tmp_path = tmp_dir.path().to_path_buf();
tmp_path.push(format!("{}.ll", module_name));
println!("{}", tmp_path.display());
let mut file = File::create(&tmp_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment