[OCaml] Add OCaml API for LLVMIsCleanup

Summary: Expose test for whether or not a landingpad is a cleanup.

Reviewers: whitequark

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 342438
This commit is contained in:
whitequark 2018-09-18 01:48:01 +00:00
parent 02da196c8c
commit 1db8dc65ea
3 changed files with 10 additions and 0 deletions

View File

@ -1187,6 +1187,7 @@ external build_invoke : llvalue -> llvalue array -> llbasicblock ->
= "llvm_build_invoke_bc" "llvm_build_invoke_nat"
external build_landingpad : lltype -> llvalue -> int -> string -> llbuilder ->
llvalue = "llvm_build_landingpad"
external is_cleanup : llvalue -> bool = "llvm_is_cleanup"
external set_cleanup : llvalue -> bool -> unit = "llvm_set_cleanup"
external add_clause : llvalue -> llvalue -> unit = "llvm_add_clause"
external build_resume : llvalue -> llbuilder -> llvalue = "llvm_build_resume"

View File

@ -2093,6 +2093,10 @@ val build_invoke : llvalue -> llvalue array -> llbasicblock ->
val build_landingpad : lltype -> llvalue -> int -> string -> llbuilder ->
llvalue
(** [is_cleanup lp] returns [true] if [landingpad] instruction lp is a cleanup.
See the method [llvm::LandingPadInst::isCleanup]. *)
val is_cleanup : llvalue -> bool
(** [set_cleanup lp] sets the cleanup flag in the [landingpad]instruction.
See the method [llvm::LandingPadInst::setCleanup]. *)
val set_cleanup : llvalue -> bool -> unit

View File

@ -1914,6 +1914,11 @@ CAMLprim value llvm_add_clause(LLVMValueRef LandingPadInst, LLVMValueRef ClauseV
return Val_unit;
}
/* llvalue -> bool */
CAMLprim value llvm_is_cleanup(LLVMValueRef LandingPadInst)
{
return Val_bool(LLVMIsCleanup(LandingPadInst));
}
/* llvalue -> bool -> unit */
CAMLprim value llvm_set_cleanup(LLVMValueRef LandingPadInst, value flag)