diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml --- a/llvm/bindings/ocaml/llvm/llvm.ml +++ b/llvm/bindings/ocaml/llvm/llvm.ml @@ -508,8 +508,9 @@ external pointer_type : lltype -> lltype = "llvm_pointer_type" external qualified_pointer_type : lltype -> int -> lltype = "llvm_qualified_pointer_type" -external pointer_type_in_context : llcontext -> int -> lltype - = "llvm_pointer_type_in_context" +external pointer_type2 : llcontext -> lltype = "llvm_pointer_type2" +external qualified_pointer_type2 : llcontext -> int -> lltype + = "llvm_qualified_pointer_type2" external vector_type : lltype -> int -> lltype = "llvm_vector_type" external element_type : lltype -> lltype = "LLVMGetElementType" diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli --- a/llvm/bindings/ocaml/llvm/llvm.mli +++ b/llvm/bindings/ocaml/llvm/llvm.mli @@ -721,15 +721,20 @@ See the method [llvm::PointerType::getUnqual]. *) val pointer_type : lltype -> lltype -(** [qualified_pointer_type ty as] returns the pointer type referencing objects - of type [ty] in address space [as]. +(** [qualified_pointer_type ty a] returns the pointer type referencing objects + of type [ty] in address space [a]. See the method [llvm::PointerType::get]. *) val qualified_pointer_type : lltype -> int -> lltype -(** [pointer_type_in_context context as] returns the opaque pointer type - referencing objects in address space [as]. +(** [pointer_type2 context] returns the pointer type in the default + address space (0). + See the method [llvm::PointerType::getUnqual]. *) +val pointer_type2 : llcontext -> lltype + +(** [qualified_pointer_type2 context a] returns the pointer type referencing + objects in address space [a]. See the method [llvm::PointerType::get]. *) -val pointer_type_in_context : llcontext -> int -> lltype +val qualified_pointer_type2 : llcontext -> int -> lltype (** [vector_type ty n] returns the array type containing [n] elements of the primitive type [ty]. See the method [llvm::ArrayType::get]. *) diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c --- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c +++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c @@ -581,8 +581,13 @@ return LLVMPointerType(ElementTy, Int_val(AddressSpace)); } +/* llcontext -> lltype */ +LLVMTypeRef llvm_pointer_type2(LLVMContextRef C, value AddressSpace) { + return LLVMPointerTypeInContext(C, 0); +} + /* llcontext -> int -> lltype */ -LLVMTypeRef llvm_pointer_type_in_context(LLVMContextRef C, value AddressSpace) { +LLVMTypeRef llvm_qualified_pointer_type2(LLVMContextRef C, value AddressSpace) { return LLVMPointerTypeInContext(C, Int_val(AddressSpace)); } diff --git a/llvm/test/Bindings/OCaml/core.ml b/llvm/test/Bindings/OCaml/core.ml --- a/llvm/test/Bindings/OCaml/core.ml +++ b/llvm/test/Bindings/OCaml/core.ml @@ -43,8 +43,9 @@ (*===-- Pointer types ----------------------------------------------------===*) let test_pointer_types () = - insist (address_space (pointer_type_in_context context 0) = 0); - insist (address_space (pointer_type_in_context context 1) = 1) + insist (address_space (pointer_type2 context) = 0); + insist (address_space (qualified_pointer_type2 context 0) = 0); + insist (address_space (qualified_pointer_type2 context 1) = 1) (*===-- Conversion --------------------------------------------------------===*)