Skip to content

Commit

Permalink
Silence warnings in OCaml bindings
Browse files Browse the repository at this point in the history
* LLVMDisposeMessage lives in llvm-c/Core.h, include this file where necessary
* LLVMAddTargetData has been removed, follow suit in the bindings

Differential Revision: http://reviews.llvm.org/D18633


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265001 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Jeroen Ketema committed Mar 31, 2016
1 parent 0bfce38 commit 12c0e3a
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 20 deletions.
1 change: 1 addition & 0 deletions bindings/ocaml/analysis/analysis_ocaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
|* *|
\*===----------------------------------------------------------------------===*/

#include "llvm-c/Core.h"
#include "llvm-c/Analysis.h"
#include "caml/alloc.h"
#include "caml/mlvalues.h"
Expand Down
1 change: 1 addition & 0 deletions bindings/ocaml/executionengine/executionengine_ocaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <string.h>
#include <assert.h>
#include "llvm-c/Core.h"
#include "llvm-c/ExecutionEngine.h"
#include "llvm-c/Target.h"
#include "caml/alloc.h"
Expand Down
3 changes: 0 additions & 3 deletions bindings/ocaml/target/llvm_target.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ module DataLayout = struct

external of_string : string -> t = "llvm_datalayout_of_string"
external as_string : t -> string = "llvm_datalayout_as_string"
external add_to_pass_manager : [<Llvm.PassManager.any]
Llvm.PassManager.t -> t -> unit
= "llvm_datalayout_add_to_pass_manager"
external byte_order : t -> Endian.t = "llvm_datalayout_byte_order"
external pointer_size : t -> int = "llvm_datalayout_pointer_size"
external intptr_type : Llvm.llcontext -> t -> Llvm.lltype
Expand Down
6 changes: 0 additions & 6 deletions bindings/ocaml/target/llvm_target.mli
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ module DataLayout : sig
See the method [llvm::DataLayout::getStringRepresentation]. *)
val as_string : t -> string

(** [add_to_pass_manager pm dl] adds the data layout [dl] to
the pass manager [pm].
See the method [llvm::PassManagerBase::add]. *)
val add_to_pass_manager : [<Llvm.PassManager.any] Llvm.PassManager.t ->
t -> unit

(** Returns the byte order of a target, either [Endian.Big] or
[Endian.Little].
See the method [llvm::DataLayout::isLittleEndian]. *)
Expand Down
8 changes: 1 addition & 7 deletions bindings/ocaml/target/target_ocaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
|* *|
\*===----------------------------------------------------------------------===*/

#include "llvm-c/Core.h"
#include "llvm-c/Target.h"
#include "llvm-c/TargetMachine.h"
#include "caml/alloc.h"
Expand Down Expand Up @@ -64,13 +65,6 @@ CAMLprim value llvm_datalayout_as_string(value TD) {
return Copy;
}

/* [<Llvm.PassManager.any] Llvm.PassManager.t -> DataLayout.t -> unit */
CAMLprim value llvm_datalayout_add_to_pass_manager(LLVMPassManagerRef PM,
value DL) {
LLVMAddTargetData(DataLayout_val(DL), PM);
return Val_unit;
}

/* DataLayout.t -> Endian.t */
CAMLprim value llvm_datalayout_byte_order(value DL) {
return Val_int(LLVMByteOrder(DataLayout_val(DL)));
Expand Down
5 changes: 1 addition & 4 deletions test/Bindings/OCaml/target.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ let test_target_data () =
assert_equal (DL.preferred_align sty dl) 8;
assert_equal (DL.preferred_align_of_global (declare_global sty "g" m) dl) 8;
assert_equal (DL.element_at_offset sty (Int64.of_int 1) dl) 0;
assert_equal (DL.offset_of_element sty 1 dl) (Int64.of_int 4);

let pm = PassManager.create () in
ignore (DL.add_to_pass_manager pm dl)
assert_equal (DL.offset_of_element sty 1 dl) (Int64.of_int 4)


(*===-- Target ------------------------------------------------------------===*)
Expand Down

0 comments on commit 12c0e3a

Please sign in to comment.