[llvm] Add debuginfo C support for a SetType, Subrangetype, dynamic array type and replace arrays (PR #135607)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 04:32:18 PDT 2025


================
@@ -702,6 +701,77 @@ LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Builder, uint64_t Size,
                              LLVMMetadataRef *Subscripts,
                              unsigned NumSubscripts);
 
+/**
+ * Create debugging information entry for a set.
+ * \param Builder        The DIBuilder.
+ * \param Scope          The scope in which the set is defined.
+ * \param Name           A name that uniquely identifies this set.
+ * \param NameLen        The length of the C string passed to \c Name.
+ * \param File           File where the set is located.
+ * \param Line           Line number of the declaration.
+ * \param SizeInBits     Set size.
+ * \param AlignInBits    Set alignment.
+ * \param BaseTy         The base type of the set.
+ */
+LLVMMetadataRef LLVMDIBuilderCreateSetType(
+    LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
+    size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
+    uint64_t SizeInBits, uint32_t AlignInBits, LLVMMetadataRef BaseTy);
+
+/**
+ * Create a descriptor for a subrange with dynamic bounds.
+ * \param Builder    The DIBuilder.
+ * \param Scope      The scope in which the subrange is defined.
+ * \param Name       A name that uniquely identifies this subrange.
+ * \param NameLen    The length of the C string passed to \c Name.
+ * \param LineNo     Line number.
+ * \param File       File where the subrange is located.
+ * \param SizeInBits Member size.
+ * \param AlignInBits Member alignment.
+ * \param Flags      Flags.
+ * \param BaseTy     The base type of the subrange. eg integer or enumeration
+ * \param LowerBound Lower bound of the subrange.
+ * \param UpperBound Upper bound of the subrange.
+ * \param Stride     Stride of the subrange.
+ * \param Bias       Bias of the subrange.
----------------
OCHyams wrote:

IMO it's still worth explaining which types that are accepted here for these various parameters. Unlike `LLVMDIBuilderCreateDynamicArrayType` they won't assert if the wrong type is passed in; they're checked by the verifier. So the user should still get a helpful message eventually, but it's not the best API-usage experience.

That said, none of the other C-API functions here look like they try very hard to explain the expected inputs, so it's not the end of the world to keep as is. However in future it's good practice to ensure you have responded to or actioned all comments (github does sometimes make it very easy to miss things!).

https://github.com/llvm/llvm-project/pull/135607


More information about the llvm-commits mailing list