[OCaml][Test] Fix and enable debuginfo.ml test

`get_or_create_type_array` was used on a non-type MDNode.
Add interface for `get_or_create_array` and use that instead.

Differential Revision: https://reviews.llvm.org/D99450
This commit is contained in:
Vaivaswatha Nagaraj 2021-03-28 06:25:39 +05:30
parent dcaa0293c1
commit 11f59c5457
4 changed files with 18 additions and 1 deletions

View File

@ -369,6 +369,14 @@ CAMLprim LLVMMetadataRef llvm_dibuild_get_or_create_type_array(value Builder,
Wosize_val(Data));
}
CAMLprim LLVMMetadataRef llvm_dibuild_get_or_create_array(value Builder,
value Data) {
return LLVMDIBuilderGetOrCreateArray(DIBuilder_val(Builder),
(LLVMMetadataRef *)Op_val(Data),
Wosize_val(Data));
}
CAMLprim LLVMMetadataRef llvm_dibuild_create_subroutine_type(
value Builder, LLVMMetadataRef File, value ParameterTypes, value Flags) {

View File

@ -262,6 +262,10 @@ external dibuild_get_or_create_type_array :
lldibuilder -> data:Llvm.llmetadata array -> Llvm.llmetadata
= "llvm_dibuild_get_or_create_type_array"
external dibuild_get_or_create_array :
lldibuilder -> data:Llvm.llmetadata array -> Llvm.llmetadata
= "llvm_dibuild_get_or_create_array"
external dibuild_create_subroutine_type :
lldibuilder ->
file:Llvm.llmetadata ->

View File

@ -282,6 +282,11 @@ val dibuild_get_or_create_type_array :
(** [dibuild_get_or_create_type_array] Create a type array.
See LLVMDIBuilderGetOrCreateTypeArray. *)
val dibuild_get_or_create_array :
lldibuilder -> data:Llvm.llmetadata array -> Llvm.llmetadata
(** [dibuild_get_or_create_array] Create an array of DI Nodes.
See LLVMDIBuilderGetOrCreateArray. *)
val dibuild_create_constant_value_expression :
lldibuilder -> int -> Llvm.llmetadata
(** [dibuild_create_constant_value_expression] Create a new descriptor for

View File

@ -339,7 +339,7 @@ let test_types dibuilder file_di m_di =
~align_in_bits:0 ~elements ~class_ty:int64_ty_di
in
let elements_arr =
Llvm_debuginfo.dibuild_get_or_create_type_array dibuilder ~data:elements
Llvm_debuginfo.dibuild_get_or_create_array dibuilder ~data:elements
in
stdout_metadata elements_arr;
(* CHECK: [[ELEMENTS_PTR:<0x[0-9a-f]*>]] = !{[[ENUMERATOR1_PTR]], [[ENUMERATOR2_PTR]], [[ENUMERATOR3_PTR]]}