[llvm] b32cf75 - [LLVM-C][OCaml] Make LLVMMetadataKind consistent between C and OCaml (#132268)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 23 18:20:59 PDT 2025
Author: Alan
Date: 2025-03-23T21:20:56-04:00
New Revision: b32cf756994cbab83e50b9d84df03d5ee03f31f8
URL: https://github.com/llvm/llvm-project/commit/b32cf756994cbab83e50b9d84df03d5ee03f31f8
DIFF: https://github.com/llvm/llvm-project/commit/b32cf756994cbab83e50b9d84df03d5ee03f31f8.diff
LOG: [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.
Added:
Modified:
llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
llvm/include/llvm-c/DebugInfo.h
Removed:
################################################################################
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
index 1b882d94a30b6..b5c8128c4c090 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml
@@ -139,6 +139,11 @@ module MetadataKind = struct
| DIMacroMetadataKind
| DIMacroFileMetadataKind
| DICommonBlockMetadataKind
+ | DIStringTypeMetadataKind
+ | DIGenericSubrangeMetadataKind
+ | DIArgListMetadataKind
+ | DIAssignIDMetadataKind
+ | DISubrangeTypeMetadataKind
end
(** The amount of debug information to emit. *)
diff --git a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
index 5c619a2646f5f..8a36a2b7d81b1 100644
--- a/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
+++ b/llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli
@@ -143,6 +143,11 @@ module MetadataKind : sig
| DIMacroMetadataKind
| DIMacroFileMetadataKind
| DICommonBlockMetadataKind
+ | DIStringTypeMetadataKind
+ | DIGenericSubrangeMetadataKind
+ | DIArgListMetadataKind
+ | DIAssignIDMetadataKind
+ | DISubrangeTypeMetadataKind
end
(** The amount of debug information to emit. *)
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 9d0875a4ed8d8..30bbaa4d34161 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -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;
More information about the llvm-commits
mailing list