fix missing C interface + fix bug (causes uncaught exceptions) in OCaml interface
David Monniaux
David.Monniaux at imag.fr
Fri May 31 23:45:16 PDT 2013
llvm-c/Core.h has a family of LLVMIsAXXX functions, which were not
updated when ConstantDataSequential and subclasses were added. Thus,
there are no functions to check for membership in
ConstantDataSequential, ConstantDataArray and ConstantDataVector.
The OCaml interface consequently does not know about these in
ValueKind.t, and thus classify_value fails (with an exception, thus
generally crashing the client program) when asked to classify any value
from a subclass of ConstantDataSequential.
Solution: add the missing functions and cases in classify_value.
diff -r -u llvm-3.2.src/bindings/ocaml/llvm/llvm.ml
llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm.ml
--- llvm-3.2.src/bindings/ocaml/llvm/llvm.ml 2011-12-28
19:51:08.000000000 +0100
+++ llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm.ml 2013-05-31
18:21:28.145628186 +0200
@@ -216,6 +216,8 @@
| BlockAddress
| ConstantAggregateZero
| ConstantArray
+ | ConstantDataArray
+ | ConstantDataVector
| ConstantExpr
| ConstantFP
| ConstantInt
diff -r -u llvm-3.2.src/bindings/ocaml/llvm/llvm.mli
llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm.mli
--- llvm-3.2.src/bindings/ocaml/llvm/llvm.mli 2012-10-08
18:39:34.000000000 +0200
+++ llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm.mli 2013-05-31
18:21:12.005279432 +0200
@@ -268,6 +268,8 @@
| BlockAddress
| ConstantAggregateZero
| ConstantArray
+ | ConstantDataArray
+ | ConstantDataVector
| ConstantExpr
| ConstantFP
| ConstantInt
diff -r -u llvm-3.2.src/bindings/ocaml/llvm/llvm_ocaml.c
llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm_ocaml.c
--- llvm-3.2.src/bindings/ocaml/llvm/llvm_ocaml.c 2012-09-02
16:42:56.000000000 +0200
+++ llvm-3.2-fixed_bindings/bindings/ocaml/llvm/llvm_ocaml.c
2013-05-31 18:20:11.091963286 +0200
@@ -25,6 +25,8 @@
#include <stdlib.h>
#include <string.h>
+/* DEBUG */
+#include <stdio.h>
/* Can't use the recommended caml_named_value mechanism for backwards
compatibility reasons. This is largely equivalent. */
@@ -416,6 +418,8 @@
BlockAddress,
ConstantAggregateZero,
ConstantArray,
+ ConstantDataArray,
+ ConstantDataVector,
ConstantExpr,
ConstantFP,
ConstantInt,
@@ -441,6 +445,8 @@
DEFINE_CASE(Val, BlockAddress);
DEFINE_CASE(Val, ConstantAggregateZero);
DEFINE_CASE(Val, ConstantArray);
+ DEFINE_CASE(Val, ConstantDataArray);
+ DEFINE_CASE(Val, ConstantDataVector);
DEFINE_CASE(Val, ConstantExpr);
DEFINE_CASE(Val, ConstantFP);
DEFINE_CASE(Val, ConstantInt);
diff -r -u llvm-3.2.src/include/llvm-c/Core.h
llvm-3.2-fixed_bindings/include/llvm-c/Core.h
--- llvm-3.2.src/include/llvm-c/Core.h 2012-10-15 22:35:56.000000000
+0200
+++ llvm-3.2-fixed_bindings/include/llvm-c/Core.h 2013-05-31
18:11:24.744595688 +0200
@@ -1010,6 +1010,9 @@
macro(BlockAddress) \
macro(ConstantAggregateZero) \
macro(ConstantArray) \
+ macro(ConstantDataSequential) \
+ macro(ConstantDataArray) \
+ macro(ConstantDataVector) \
macro(ConstantExpr) \
macro(ConstantFP) \
macro(ConstantInt) \
--
David Monniaux
Directeur de recherche au CNRS, laboratoire VERIMAG
http://www-verimag.imag.fr/~monniaux/
More information about the llvm-commits
mailing list