mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:29:51 +00:00
[NFC][OCaml] Simplify llvm_global_initializer using ptr_to_option
This diff uses ptr_to_option to convert a nullable C pointer to an OCaml option instead of the redundant implementation in llvm_global_initializer. Differential Revision: https://reviews.llvm.org/D99391
This commit is contained in:
parent
1622731c2d
commit
511d90318d
@ -1349,14 +1349,7 @@ CAMLprim value llvm_delete_global(LLVMValueRef GlobalVar) {
|
||||
|
||||
/* llvalue -> llvalue option */
|
||||
CAMLprim value llvm_global_initializer(LLVMValueRef GlobalVar) {
|
||||
CAMLparam0();
|
||||
LLVMValueRef Init;
|
||||
if ((Init = LLVMGetInitializer(GlobalVar))) {
|
||||
value Option = alloc(1, 0);
|
||||
Field(Option, 0) = (value) Init;
|
||||
CAMLreturn(Option);
|
||||
}
|
||||
CAMLreturn(Val_int(0));
|
||||
return ptr_to_option(LLVMGetInitializer(GlobalVar));
|
||||
}
|
||||
|
||||
/* llvalue -> llvalue -> unit */
|
||||
|
Loading…
Reference in New Issue
Block a user