[llvm] [LLVM-C][OCaml] Update OCaml bindings to match LLVMMetadataKind in C API (PR #132268)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 23 18:16:00 PDT 2025
https://github.com/alan-j-hu updated https://github.com/llvm/llvm-project/pull/132268
>From d4c9d9b8613e77ca0dee5e4284be37ea6be548d6 Mon Sep 17 00:00:00 2001
From: Alan Hu <ahulambda at gmail.com>
Date: Thu, 20 Mar 2025 14:17:24 -0400
Subject: [PATCH] [LLVM-C][OCaml] Make LLVMMetadataKind enum consistent with
OCaml bindings
- 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.
---
llvm/bindings/ocaml/debuginfo/llvm_debuginfo.ml | 5 +++++
llvm/bindings/ocaml/debuginfo/llvm_debuginfo.mli | 5 +++++
llvm/include/llvm-c/DebugInfo.h | 4 +++-
3 files changed, 13 insertions(+), 1 deletion(-)
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