[OCaml] Initialize local roots prior to raising.
[oota-llvm.git] / bindings / ocaml / llvm / llvm_ocaml.c
index b43b3750734195d2d3755ff64bcbfeff66ea4e02..d8682880033b1880b8b4e1de6e7a8f4cea351716 100644 (file)
@@ -1590,11 +1590,12 @@ CAMLprim value llvm_position_builder(value Pos, value B) {
 }
 
 /* llbuilder -> llbasicblock */
-CAMLprim LLVMBasicBlockRef llvm_insertion_block(value B) {
+CAMLprim value llvm_insertion_block(value B) {
+  CAMLparam0();
   LLVMBasicBlockRef InsertBlock = LLVMGetInsertBlock(Builder_val(B));
   if (!InsertBlock)
-    raise_not_found();
-  return InsertBlock;
+    caml_raise_not_found();
+  CAMLreturn((value) InsertBlock);
 }
 
 /* llvalue -> string -> llbuilder -> unit */