[all-commits] [llvm/llvm-project] 2571a0: [OCaml] Handle nullptr in Llvm.global_initializer

Timotej Kapus via All-commits all-commits at lists.llvm.org
Wed Mar 17 06:41:28 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2571a0936719b50facfee492ccbaf4916272be36
      https://github.com/llvm/llvm-project/commit/2571a0936719b50facfee492ccbaf4916272be36
  Author: Timotej Kapus <kapust at fb.com>
  Date:   2021-03-17 (Wed, 17 Mar 2021)

  Changed paths:
    M llvm/bindings/ocaml/llvm/llvm.ml
    M llvm/bindings/ocaml/llvm/llvm.mli
    M llvm/bindings/ocaml/llvm/llvm_ocaml.c
    M llvm/test/Bindings/OCaml/core.ml
    M llvm/test/Bindings/OCaml/irreader.ml

  Log Message:
  -----------
  [OCaml] Handle nullptr in Llvm.global_initializer

LLVMGetInitializer returns nullptr in case there is no initializer.
There is not much that can be done with nullptr in OCaml, not even
test if it is null. Also, there does not seem to be a C or OCaml API
to test if there is an initializer. So this diff changes
Llvm.global_initializer to return an option.

Reviewed By: whitequark

Differential Revision: https://reviews.llvm.org/D65195




More information about the All-commits mailing list