Index: bindings/ocaml/llvm/llvm.ml =================================================================== --- bindings/ocaml/llvm/llvm.ml +++ bindings/ocaml/llvm/llvm.ml @@ -477,6 +477,7 @@ = "llvm_struct_element_types" external is_packed : lltype -> bool = "llvm_is_packed" external is_opaque : lltype -> bool = "llvm_is_opaque" +external is_literal : lltype -> bool = "llvm_is_literal" (*--... Operations on pointer, vector, and array types .....................--*) Index: bindings/ocaml/llvm/llvm.mli =================================================================== --- bindings/ocaml/llvm/llvm.mli +++ bindings/ocaml/llvm/llvm.mli @@ -680,6 +680,10 @@ [false] otherwise. See the method [llvm::StructType::isOpaque]. *) val is_opaque : lltype -> bool +(** [is_literal sty] returns [true] if the structure type [sty] is literal. + [false] otherwise. See the method [llvm::StructType::isLiteral]. *) +val is_literal : lltype -> bool + (** {7 Operations on pointer, vector, and array types} *) Index: bindings/ocaml/llvm/llvm_ocaml.c =================================================================== --- bindings/ocaml/llvm/llvm_ocaml.c +++ bindings/ocaml/llvm/llvm_ocaml.c @@ -524,6 +524,11 @@ return Val_bool(LLVMIsOpaqueStruct(StructTy)); } +/* lltype -> bool */ +CAMLprim value llvm_is_literal(LLVMTypeRef StructTy) { + return Val_bool(LLVMIsLiteralStruct(StructTy)); +} + /*--... Operations on array, pointer, and vector types .....................--*/ /* lltype -> lltype array */ Index: include/llvm-c/Core.h =================================================================== --- include/llvm-c/Core.h +++ include/llvm-c/Core.h @@ -1279,6 +1279,13 @@ LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy); /** + * Determine whether a structure is literal. + * + * @see llvm::StructType::isLiteral() + */ +LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy); + +/** * @} */ Index: lib/IR/Core.cpp =================================================================== --- lib/IR/Core.cpp +++ lib/IR/Core.cpp @@ -706,6 +706,10 @@ return unwrap(StructTy)->isOpaque(); } +LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy) { + return unwrap(StructTy)->isLiteral(); +} + LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name) { return wrap(unwrap(M)->getTypeByName(Name)); }