[NFC][Py Reformat] Added more commits to .git-blame-ignore-revs
[llvm-project.git] / llvm / bindings / ocaml / debuginfo / llvm_debuginfo.ml
bloba6d74ed0eb817dcce1a6d9ea4031cdf6d72b9569
1 (*===-- llvm_debuginfo.ml - LLVM OCaml Interface --------------*- OCaml -*-===*
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 *===----------------------------------------------------------------------===*)
9 type lldibuilder
11 (** Source languages known by DWARF. *)
12 module DWARFSourceLanguageKind = struct
13 type t =
14 | C89
15 | C
16 | Ada83
17 | C_plus_plus
18 | Cobol74
19 | Cobol85
20 | Fortran77
21 | Fortran90
22 | Pascal83
23 | Modula2
24 (* New in DWARF v3: *)
25 | LLVMJava
26 | C99
27 | Ada95
28 | Fortran95
29 | PLI
30 | ObjC
31 | ObjC_plus_plus
32 | UPC
33 | D
34 (* New in DWARF v4: *)
35 | LLVMPython
36 (* New in DWARF v5: *)
37 | LLVMOpenCL
38 | Go
39 | Modula3
40 | Haskell
41 | C_plus_plus_03
42 | C_plus_plus_11
43 | OCaml
44 | Rust
45 | C11
46 | Swift
47 | Julia
48 | Dylan
49 | C_plus_plus_14
50 | Fortran03
51 | Fortran08
52 | RenderScript
53 | BLISS
54 (* Vendor extensions: *)
55 | LLVMMips_Assembler
56 | GOOGLE_RenderScript
57 | BORLAND_Delphi
58 end
60 module DIFlag = struct
61 type t =
62 | Zero
63 | Private
64 | Protected
65 | Public
66 | FwdDecl
67 | AppleBlock
68 | ReservedBit4
69 | Virtual
70 | Artificial
71 | Explicit
72 | Prototyped
73 | ObjcClassComplete
74 | ObjectPointer
75 | Vector
76 | StaticMember
77 | LValueReference
78 | RValueReference
79 | Reserved
80 | SingleInheritance
81 | MultipleInheritance
82 | VirtualInheritance
83 | IntroducedVirtual
84 | BitField
85 | NoReturn
86 | TypePassByValue
87 | TypePassByReference
88 | EnumClass
89 | FixedEnum
90 | Thunk
91 | NonTrivial
92 | BigEndian
93 | LittleEndian
94 | IndirectVirtualBase
95 | Accessibility
96 | PtrToMemberRep
97 end
99 type lldiflags
101 external diflags_get : DIFlag.t -> lldiflags = "llvm_diflags_get"
103 external diflags_set : lldiflags -> DIFlag.t -> lldiflags = "llvm_diflags_set"
105 external diflags_test : lldiflags -> DIFlag.t -> bool = "llvm_diflags_test"
107 (** The kind of metadata nodes. *)
108 module MetadataKind = struct
109 type t =
110 | MDStringMetadataKind
111 | ConstantAsMetadataMetadataKind
112 | LocalAsMetadataMetadataKind
113 | DistinctMDOperandPlaceholderMetadataKind
114 | MDTupleMetadataKind
115 | DILocationMetadataKind
116 | DIExpressionMetadataKind
117 | DIGlobalVariableExpressionMetadataKind
118 | GenericDINodeMetadataKind
119 | DISubrangeMetadataKind
120 | DIEnumeratorMetadataKind
121 | DIBasicTypeMetadataKind
122 | DIDerivedTypeMetadataKind
123 | DICompositeTypeMetadataKind
124 | DISubroutineTypeMetadataKind
125 | DIFileMetadataKind
126 | DICompileUnitMetadataKind
127 | DISubprogramMetadataKind
128 | DILexicalBlockMetadataKind
129 | DILexicalBlockFileMetadataKind
130 | DINamespaceMetadataKind
131 | DIModuleMetadataKind
132 | DITemplateTypeParameterMetadataKind
133 | DITemplateValueParameterMetadataKind
134 | DIGlobalVariableMetadataKind
135 | DILocalVariableMetadataKind
136 | DILabelMetadataKind
137 | DIObjCPropertyMetadataKind
138 | DIImportedEntityMetadataKind
139 | DIMacroMetadataKind
140 | DIMacroFileMetadataKind
141 | DICommonBlockMetadataKind
144 (** The amount of debug information to emit. *)
145 module DWARFEmissionKind = struct
146 type t = None | Full | LineTablesOnly
149 external debug_metadata_version : unit -> int = "llvm_debug_metadata_version"
151 external get_module_debug_metadata_version : Llvm.llmodule -> int
152 = "llvm_get_module_debug_metadata_version"
154 external dibuilder : Llvm.llmodule -> lldibuilder = "llvm_dibuilder"
156 external dibuild_finalize : lldibuilder -> unit = "llvm_dibuild_finalize"
158 (* See LLVMDIBuilderCreateCompileUnit for argument details. *)
159 external dibuild_create_compile_unit :
160 lldibuilder ->
161 DWARFSourceLanguageKind.t ->
162 file_ref:Llvm.llmetadata ->
163 producer:string ->
164 is_optimized:bool ->
165 flags:string ->
166 runtime_ver:int ->
167 split_name:string ->
168 DWARFEmissionKind.t ->
169 dwoid:int ->
170 di_inlining:bool ->
171 di_profiling:bool ->
172 sys_root:string ->
173 sdk:string ->
174 Llvm.llmetadata
175 = "llvm_dibuild_create_compile_unit_bytecode" "llvm_dibuild_create_compile_unit_native"
177 external dibuild_create_file :
178 lldibuilder -> filename:string -> directory:string -> Llvm.llmetadata
179 = "llvm_dibuild_create_file"
181 external dibuild_create_module :
182 lldibuilder ->
183 parent_ref:Llvm.llmetadata ->
184 name:string ->
185 config_macros:string ->
186 include_path:string ->
187 sys_root:string ->
188 Llvm.llmetadata
189 = "llvm_dibuild_create_module_bytecode" "llvm_dibuild_create_module_native"
191 external dibuild_create_namespace :
192 lldibuilder ->
193 parent_ref:Llvm.llmetadata ->
194 name:string ->
195 export_symbols:bool ->
196 Llvm.llmetadata = "llvm_dibuild_create_namespace"
198 external dibuild_create_function :
199 lldibuilder ->
200 scope:Llvm.llmetadata ->
201 name:string ->
202 linkage_name:string ->
203 file:Llvm.llmetadata ->
204 line_no:int ->
205 ty:Llvm.llmetadata ->
206 is_local_to_unit:bool ->
207 is_definition:bool ->
208 scope_line:int ->
209 flags:lldiflags ->
210 is_optimized:bool ->
211 Llvm.llmetadata
212 = "llvm_dibuild_create_function_bytecode" "llvm_dibuild_create_function_native"
214 external dibuild_create_lexical_block :
215 lldibuilder ->
216 scope:Llvm.llmetadata ->
217 file:Llvm.llmetadata ->
218 line:int ->
219 column:int ->
220 Llvm.llmetadata = "llvm_dibuild_create_lexical_block"
222 external dibuild_create_debug_location_helper :
223 Llvm.llcontext ->
224 line:int ->
225 column:int ->
226 scope:Llvm.llmetadata ->
227 inlined_at:Llvm.llmetadata ->
228 Llvm.llmetadata = "llvm_dibuild_create_debug_location"
230 external llmetadata_null : unit -> Llvm.llmetadata = "llvm_metadata_null"
232 let dibuild_create_debug_location ?(inlined_at = llmetadata_null ()) llctx ~line
233 ~column ~scope =
234 dibuild_create_debug_location_helper llctx ~line ~column ~scope ~inlined_at
236 external di_location_get_line : location:Llvm.llmetadata -> int
237 = "llvm_di_location_get_line"
239 external di_location_get_column : location:Llvm.llmetadata -> int
240 = "llvm_di_location_get_column"
242 external di_location_get_scope : location:Llvm.llmetadata -> Llvm.llmetadata
243 = "llvm_di_location_get_scope"
245 external di_location_get_inlined_at :
246 location:Llvm.llmetadata -> Llvm.llmetadata option
247 = "llvm_di_location_get_inlined_at"
249 external di_scope_get_file : scope:Llvm.llmetadata -> Llvm.llmetadata option
250 = "llvm_di_scope_get_file"
252 external di_file_get_directory : file:Llvm.llmetadata -> string
253 = "llvm_di_file_get_directory"
255 external di_file_get_filename : file:Llvm.llmetadata -> string
256 = "llvm_di_file_get_filename"
258 external di_file_get_source : file:Llvm.llmetadata -> string
259 = "llvm_di_file_get_source"
261 external dibuild_get_or_create_type_array :
262 lldibuilder -> data:Llvm.llmetadata array -> Llvm.llmetadata
263 = "llvm_dibuild_get_or_create_type_array"
265 external dibuild_get_or_create_array :
266 lldibuilder -> data:Llvm.llmetadata array -> Llvm.llmetadata
267 = "llvm_dibuild_get_or_create_array"
269 external dibuild_create_subroutine_type :
270 lldibuilder ->
271 file:Llvm.llmetadata ->
272 param_types:Llvm.llmetadata array ->
273 lldiflags ->
274 Llvm.llmetadata = "llvm_dibuild_create_subroutine_type"
276 external dibuild_create_enumerator :
277 lldibuilder -> name:string -> value:int -> is_unsigned:bool -> Llvm.llmetadata
278 = "llvm_dibuild_create_enumerator"
280 external dibuild_create_enumeration_type :
281 lldibuilder ->
282 scope:Llvm.llmetadata ->
283 name:string ->
284 file:Llvm.llmetadata ->
285 line_number:int ->
286 size_in_bits:int ->
287 align_in_bits:int ->
288 elements:Llvm.llmetadata array ->
289 class_ty:Llvm.llmetadata ->
290 Llvm.llmetadata
291 = "llvm_dibuild_create_enumeration_type_bytecode" "llvm_dibuild_create_enumeration_type_native"
293 external dibuild_create_union_type :
294 lldibuilder ->
295 scope:Llvm.llmetadata ->
296 name:string ->
297 file:Llvm.llmetadata ->
298 line_number:int ->
299 size_in_bits:int ->
300 align_in_bits:int ->
301 lldiflags ->
302 elements:Llvm.llmetadata array ->
303 run_time_language:int ->
304 unique_id:string ->
305 Llvm.llmetadata
306 = "llvm_dibuild_create_union_type_bytecode" "llvm_dibuild_create_union_type_native"
308 external dibuild_create_array_type :
309 lldibuilder ->
310 size:int ->
311 align_in_bits:int ->
312 ty:Llvm.llmetadata ->
313 subscripts:Llvm.llmetadata array ->
314 Llvm.llmetadata = "llvm_dibuild_create_array_type"
316 external dibuild_create_vector_type :
317 lldibuilder ->
318 size:int ->
319 align_in_bits:int ->
320 ty:Llvm.llmetadata ->
321 subscripts:Llvm.llmetadata array ->
322 Llvm.llmetadata = "llvm_dibuild_create_array_type"
324 external dibuild_create_unspecified_type :
325 lldibuilder -> name:string -> Llvm.llmetadata
326 = "llvm_dibuild_create_unspecified_type"
328 external dibuild_create_basic_type :
329 lldibuilder ->
330 name:string ->
331 size_in_bits:int ->
332 encoding:int ->
333 lldiflags ->
334 Llvm.llmetadata = "llvm_dibuild_create_basic_type"
336 external dibuild_create_pointer_type :
337 lldibuilder ->
338 pointee_ty:Llvm.llmetadata ->
339 size_in_bits:int ->
340 align_in_bits:int ->
341 address_space:int ->
342 name:string ->
343 Llvm.llmetadata
344 = "llvm_dibuild_create_pointer_type_bytecode" "llvm_dibuild_create_pointer_type_native"
346 external dibuild_create_struct_type :
347 lldibuilder ->
348 scope:Llvm.llmetadata ->
349 name:string ->
350 file:Llvm.llmetadata ->
351 line_number:int ->
352 size_in_bits:int ->
353 align_in_bits:int ->
354 lldiflags ->
355 derived_from:Llvm.llmetadata ->
356 elements:Llvm.llmetadata array ->
357 DWARFSourceLanguageKind.t ->
358 vtable_holder:Llvm.llmetadata ->
359 unique_id:string ->
360 Llvm.llmetadata
361 = "llvm_dibuild_create_struct_type_bytecode" "llvm_dibuild_create_struct_type_native"
363 external dibuild_create_member_type :
364 lldibuilder ->
365 scope:Llvm.llmetadata ->
366 name:string ->
367 file:Llvm.llmetadata ->
368 line_number:int ->
369 size_in_bits:int ->
370 align_in_bits:int ->
371 offset_in_bits:int ->
372 lldiflags ->
373 ty:Llvm.llmetadata ->
374 Llvm.llmetadata
375 = "llvm_dibuild_create_member_type_bytecode" "llvm_dibuild_create_member_type_native"
377 external dibuild_create_static_member_type :
378 lldibuilder ->
379 scope:Llvm.llmetadata ->
380 name:string ->
381 file:Llvm.llmetadata ->
382 line_number:int ->
383 ty:Llvm.llmetadata ->
384 lldiflags ->
385 const_val:Llvm.llvalue ->
386 align_in_bits:int ->
387 Llvm.llmetadata
388 = "llvm_dibuild_create_static_member_type_bytecode" "llvm_dibuild_create_static_member_type_native"
390 external dibuild_create_member_pointer_type :
391 lldibuilder ->
392 pointee_type:Llvm.llmetadata ->
393 class_type:Llvm.llmetadata ->
394 size_in_bits:int ->
395 align_in_bits:int ->
396 lldiflags ->
397 Llvm.llmetadata
398 = "llvm_dibuild_create_member_pointer_type_bytecode" "llvm_dibuild_create_member_pointer_type_native"
400 external dibuild_create_object_pointer_type :
401 lldibuilder -> Llvm.llmetadata -> Llvm.llmetadata
402 = "llvm_dibuild_create_object_pointer_type"
404 external dibuild_create_qualified_type :
405 lldibuilder -> tag:int -> Llvm.llmetadata -> Llvm.llmetadata
406 = "llvm_dibuild_create_qualified_type"
408 external dibuild_create_reference_type :
409 lldibuilder -> tag:int -> Llvm.llmetadata -> Llvm.llmetadata
410 = "llvm_dibuild_create_reference_type"
412 external dibuild_create_null_ptr_type : lldibuilder -> Llvm.llmetadata
413 = "llvm_dibuild_create_null_ptr_type"
415 external dibuild_create_typedef :
416 lldibuilder ->
417 ty:Llvm.llmetadata ->
418 name:string ->
419 file:Llvm.llmetadata ->
420 line_no:int ->
421 scope:Llvm.llmetadata ->
422 align_in_bits:int ->
423 Llvm.llmetadata
424 = "llvm_dibuild_create_typedef_bytecode" "llvm_dibuild_create_typedef_native"
426 external dibuild_create_inheritance :
427 lldibuilder ->
428 ty:Llvm.llmetadata ->
429 base_ty:Llvm.llmetadata ->
430 base_offset:int ->
431 vb_ptr_offset:int ->
432 lldiflags ->
433 Llvm.llmetadata
434 = "llvm_dibuild_create_inheritance_bytecode" "llvm_dibuild_create_inheritance_native"
436 external dibuild_create_forward_decl :
437 lldibuilder ->
438 tag:int ->
439 name:string ->
440 scope:Llvm.llmetadata ->
441 file:Llvm.llmetadata ->
442 line:int ->
443 runtime_lang:int ->
444 size_in_bits:int ->
445 align_in_bits:int ->
446 unique_identifier:string ->
447 Llvm.llmetadata
448 = "llvm_dibuild_create_forward_decl_bytecode" "llvm_dibuild_create_forward_decl_native"
450 external dibuild_create_replaceable_composite_type :
451 lldibuilder ->
452 tag:int ->
453 name:string ->
454 scope:Llvm.llmetadata ->
455 file:Llvm.llmetadata ->
456 line:int ->
457 runtime_lang:int ->
458 size_in_bits:int ->
459 align_in_bits:int ->
460 lldiflags ->
461 unique_identifier:string ->
462 Llvm.llmetadata
463 = "llvm_dibuild_create_replaceable_composite_type_bytecode" "llvm_dibuild_create_replaceable_composite_type_native"
465 external dibuild_create_bit_field_member_type :
466 lldibuilder ->
467 scope:Llvm.llmetadata ->
468 name:string ->
469 file:Llvm.llmetadata ->
470 line_num:int ->
471 size_in_bits:int ->
472 offset_in_bits:int ->
473 storage_offset_in_bits:int ->
474 lldiflags ->
475 ty:Llvm.llmetadata ->
476 Llvm.llmetadata
477 = "llvm_dibuild_create_bit_field_member_type_bytecode" "llvm_dibuild_create_bit_field_member_type_native"
479 external dibuild_create_class_type :
480 lldibuilder ->
481 scope:Llvm.llmetadata ->
482 name:string ->
483 file:Llvm.llmetadata ->
484 line_number:int ->
485 size_in_bits:int ->
486 align_in_bits:int ->
487 offset_in_bits:int ->
488 lldiflags ->
489 derived_from:Llvm.llmetadata ->
490 elements:Llvm.llmetadata array ->
491 vtable_holder:Llvm.llmetadata ->
492 template_params_node:Llvm.llmetadata ->
493 unique_identifier:string ->
494 Llvm.llmetadata
495 = "llvm_dibuild_create_class_type_bytecode" "llvm_dibuild_create_class_type_native"
497 external dibuild_create_artificial_type :
498 lldibuilder -> ty:Llvm.llmetadata -> Llvm.llmetadata
499 = "llvm_dibuild_create_artificial_type"
501 external di_type_get_name : Llvm.llmetadata -> string = "llvm_di_type_get_name"
503 external di_type_get_size_in_bits : Llvm.llmetadata -> int
504 = "llvm_di_type_get_size_in_bits"
506 external di_type_get_offset_in_bits : Llvm.llmetadata -> int
507 = "llvm_di_type_get_offset_in_bits"
509 external di_type_get_align_in_bits : Llvm.llmetadata -> int
510 = "llvm_di_type_get_align_in_bits"
512 external di_type_get_line : Llvm.llmetadata -> int = "llvm_di_type_get_line"
514 external di_type_get_flags : Llvm.llmetadata -> lldiflags
515 = "llvm_di_type_get_flags"
517 external get_subprogram : Llvm.llvalue -> Llvm.llmetadata option
518 = "llvm_get_subprogram"
520 external set_subprogram : Llvm.llvalue -> Llvm.llmetadata -> unit
521 = "llvm_set_subprogram"
523 external di_subprogram_get_line : Llvm.llmetadata -> int
524 = "llvm_di_subprogram_get_line"
526 external instr_get_debug_loc : Llvm.llvalue -> Llvm.llmetadata option
527 = "llvm_instr_get_debug_loc"
529 external instr_set_debug_loc_helper : Llvm.llvalue -> Llvm.llmetadata -> unit
530 = "llvm_instr_set_debug_loc"
532 let instr_set_debug_loc i mopt =
533 match mopt with
534 | None -> instr_set_debug_loc_helper i (llmetadata_null ())
535 | Some m -> instr_set_debug_loc_helper i m
537 external dibuild_create_constant_value_expression :
538 lldibuilder -> int -> Llvm.llmetadata
539 = "llvm_dibuild_create_constant_value_expression"
541 external dibuild_create_global_variable_expression :
542 lldibuilder ->
543 scope:Llvm.llmetadata ->
544 name:string ->
545 linkage:string ->
546 file:Llvm.llmetadata ->
547 line:int ->
548 ty:Llvm.llmetadata ->
549 is_local_to_unit:bool ->
550 expr:Llvm.llmetadata ->
551 decl:Llvm.llmetadata ->
552 align_in_bits:int ->
553 Llvm.llmetadata
554 = "llvm_dibuild_create_global_variable_expression_bytecode" "llvm_dibuild_create_global_variable_expression_native"
556 external di_global_variable_expression_get_variable :
557 Llvm.llmetadata -> Llvm.llmetadata option
558 = "llvm_di_global_variable_expression_get_variable"
560 external di_variable_get_line : Llvm.llmetadata -> int
561 = "llvm_di_variable_get_line"
563 external di_variable_get_file : Llvm.llmetadata -> Llvm.llmetadata option
564 = "llvm_di_variable_get_file"
566 external get_metadata_kind : Llvm.llmetadata -> MetadataKind.t
567 = "llvm_get_metadata_kind"
569 external dibuild_create_auto_variable :
570 lldibuilder ->
571 scope:Llvm.llmetadata ->
572 name:string ->
573 file:Llvm.llmetadata ->
574 line:int ->
575 ty:Llvm.llmetadata ->
576 always_preserve:bool ->
577 lldiflags ->
578 align_in_bits:int ->
579 Llvm.llmetadata
580 = "llvm_dibuild_create_auto_variable_bytecode" "llvm_dibuild_create_auto_variable_native"
582 external dibuild_create_parameter_variable :
583 lldibuilder ->
584 scope:Llvm.llmetadata ->
585 name:string ->
586 argno:int ->
587 file:Llvm.llmetadata ->
588 line:int ->
589 ty:Llvm.llmetadata ->
590 always_preserve:bool ->
591 lldiflags ->
592 Llvm.llmetadata
593 = "llvm_dibuild_create_parameter_variable_bytecode" "llvm_dibuild_create_parameter_variable_native"
595 external dibuild_insert_declare_before :
596 lldibuilder ->
597 storage:Llvm.llvalue ->
598 var_info:Llvm.llmetadata ->
599 expr:Llvm.llmetadata ->
600 location:Llvm.llmetadata ->
601 instr:Llvm.llvalue ->
602 Llvm.llvalue
603 = "llvm_dibuild_insert_declare_before_bytecode" "llvm_dibuild_insert_declare_before_native"
605 external dibuild_insert_declare_at_end :
606 lldibuilder ->
607 storage:Llvm.llvalue ->
608 var_info:Llvm.llmetadata ->
609 expr:Llvm.llmetadata ->
610 location:Llvm.llmetadata ->
611 block:Llvm.llbasicblock ->
612 Llvm.llvalue
613 = "llvm_dibuild_insert_declare_at_end_bytecode" "llvm_dibuild_insert_declare_at_end_native"
615 external dibuild_expression :
616 lldibuilder ->
617 Int64.t array ->
618 Llvm.llmetadata
619 = "llvm_dibuild_expression"