[llvm] r221149 - [OCaml] Fix mismatched CAMLparam/CAMLreturn.

Peter Zotov whitequark at whitequark.org
Mon Nov 3 03:47:14 PST 2014


Author: whitequark
Date: Mon Nov  3 05:47:14 2014
New Revision: 221149

URL: http://llvm.org/viewvc/llvm-project?rev=221149&view=rev
Log:
[OCaml] Fix mismatched CAMLparam/CAMLreturn.

Also, revert r221142--it was an incorrect fix to this bug
which fixed tests by accident.

Modified:
    llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c

Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=221149&r1=221148&r2=221149&view=diff
==============================================================================
--- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
+++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Mon Nov  3 05:47:14 2014
@@ -750,7 +750,7 @@ CAMLprim value llvm_float_of_const(LLVMV
   if (LLVMIsAConstantFP(Const)) {
     Result = LLVMConstRealGetDouble(Const, &LosesInfo);
     if (LosesInfo)
-        return Val_int(0);
+        CAMLreturn(Val_int(0));
 
     Option = alloc(1, 0);
     Field(Option, 0) = caml_copy_double(Result);
@@ -1590,12 +1590,11 @@ CAMLprim value llvm_position_builder(val
 }
 
 /* llbuilder -> llbasicblock */
-CAMLprim value llvm_insertion_block(value B) {
-  CAMLparam0();
+CAMLprim LLVMBasicBlockRef llvm_insertion_block(value B) {
   LLVMBasicBlockRef InsertBlock = LLVMGetInsertBlock(Builder_val(B));
   if (!InsertBlock)
     caml_raise_not_found();
-  CAMLreturn((value) InsertBlock);
+  return InsertBlock;
 }
 
 /* llvalue -> string -> llbuilder -> unit */





More information about the llvm-commits mailing list