[LLVM-C][OCaml] Make LLVMMetadataKind consistent between C and OCaml (#132268)

- Move LLVMDISubrangeTypeMetadataKind to end of LLVMMetadataKind enum.
Inserting a new enum constant in the middle of the enum breaks the ABI for
that enum. Commit e298fc2 introduced this issue, which was revealed because
the OCaml binding tests failed.
- Bring OCaml bindings up to date with LLVMMetadataKind enum.
This commit is contained in:
Alan 2025-03-23 21:20:56 -04:00 committed by GitHub
parent 9d92d4b01c
commit b32cf75699
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 1 deletions

View File

@ -139,6 +139,11 @@ module MetadataKind = struct
| DIMacroMetadataKind
| DIMacroFileMetadataKind
| DICommonBlockMetadataKind
| DIStringTypeMetadataKind
| DIGenericSubrangeMetadataKind
| DIArgListMetadataKind
| DIAssignIDMetadataKind
| DISubrangeTypeMetadataKind
end
(** The amount of debug information to emit. *)

View File

@ -143,6 +143,11 @@ module MetadataKind : sig
| DIMacroMetadataKind
| DIMacroFileMetadataKind
| DICommonBlockMetadataKind
| DIStringTypeMetadataKind
| DIGenericSubrangeMetadataKind
| DIArgListMetadataKind
| DIAssignIDMetadataKind
| DISubrangeTypeMetadataKind
end
(** The amount of debug information to emit. *)

View File

@ -158,6 +158,8 @@ typedef enum {
/**
* The kind of metadata nodes.
*/
// NOTE: New entries should always be appended instead of matching the order
// in Metadata.def.
enum {
LLVMMDStringMetadataKind,
LLVMConstantAsMetadataMetadataKind,
@ -172,7 +174,6 @@ enum {
LLVMDIEnumeratorMetadataKind,
LLVMDIBasicTypeMetadataKind,
LLVMDIDerivedTypeMetadataKind,
LLVMDISubrangeTypeMetadataKind,
LLVMDICompositeTypeMetadataKind,
LLVMDISubroutineTypeMetadataKind,
LLVMDIFileMetadataKind,
@ -196,6 +197,7 @@ enum {
LLVMDIGenericSubrangeMetadataKind,
LLVMDIArgListMetadataKind,
LLVMDIAssignIDMetadataKind,
LLVMDISubrangeTypeMetadataKind,
};
typedef unsigned LLVMMetadataKind;