Show files produced by --emit foo in json artifact notifications

This commit is contained in:
Michael Baikov
2024-04-06 11:22:21 -04:00
parent 43a0686f8d
commit c8390cdbfa
7 changed files with 140 additions and 1 deletions

View File

@@ -113,6 +113,24 @@ pub struct CompiledModule {
pub llvm_ir: Option<PathBuf>, // --emit=llvm-ir, llvm-bc is in bytecode
}
impl CompiledModule {
/// Call `emit` function with every artifact type currently compiled
pub fn for_each_output(&self, mut emit: impl FnMut(&Path, OutputType)) {
if let Some(path) = self.object.as_deref() {
emit(path, OutputType::Object);
}
if let Some(path) = self.bytecode.as_deref() {
emit(path, OutputType::Bitcode);
}
if let Some(path) = self.llvm_ir.as_deref() {
emit(path, OutputType::LlvmAssembly);
}
if let Some(path) = self.assembly.as_deref() {
emit(path, OutputType::Assembly);
}
}
}
pub struct CachedModuleCodegen {
pub name: String,
pub source: WorkProduct,