[PATCH] D65195: [OCaml] Handle nullptr in Llvm.global_initializer

Josh Berdine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 08:19:57 PDT 2021


jberdine added inline comments.


================
Comment at: llvm/bindings/ocaml/llvm/llvm_ocaml.c:1341
+  LLVMValueRef Init;
+  if ((Init = LLVMGetInitializer(GlobalVar))) {
+    value Option = alloc(1, 0);
----------------
vaivaswatha wrote:
> `ptr_to_option` was recently introduced and is defined in this same file above. So you could just do something like this: https://github.com/llvm/llvm-project/blob/main/llvm/bindings/ocaml/debuginfo/debuginfo_ocaml.c#L839
Good call, I will send such a simplification.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65195/new/

https://reviews.llvm.org/D65195



More information about the llvm-commits mailing list