Skip to content

Commit 02158c2

Browse files
committed
add get_functions method
1 parent 8989977 commit 02158c2

File tree

1 file changed

+12
-0
lines changed
  • compiler/rustc_codegen_llvm/src/llvm

1 file changed

+12
-0
lines changed

compiler/rustc_codegen_llvm/src/llvm/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -414,3 +414,15 @@ pub(crate) fn set_dso_local<'ll>(v: &'ll Value) {
414414
LLVMRustSetDSOLocal(v, true);
415415
}
416416
}
417+
418+
pub(crate) fn get_functions(module: &Module) -> Vec<&Value> {
419+
let mut functions = Vec::new();
420+
let mut func = unsafe { LLVMGetFirstFunction(module) };
421+
422+
while let Some(f) = func {
423+
functions.push(f);
424+
func = unsafe { LLVMGetNextFunction(f) };
425+
}
426+
427+
functions
428+
}

0 commit comments

Comments
 (0)