[llvm] [C-API] Add implicit DIBuilder CreateObjectPointerType for backwards compatability (PR #124144)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 08:36:30 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Mats Jun Larsen (junlarsen)
<details>
<summary>Changes</summary>
https://github.com/llvm/llvm-project/pull/122928 Introduces a change to the C DebugInfo API which breaks compatability with older versions. This patch proposes the same functionality through a new function instead. Another idea is maybe to expose more of the flags here instead of taking a single boolean?
I'm not that familiar with Clang development, but from how things are described in the original patch (and its parent) it seems like it should be an avoidable breakage.
I suppose the same could be said for the OCaml API.
---
Full diff: https://github.com/llvm/llvm-project/pull/124144.diff
2 Files Affected:
- (modified) llvm/include/llvm-c/DebugInfo.h (+11-3)
- (modified) llvm/lib/IR/DebugInfo.cpp (+9-3)
``````````diff
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index ac7ee5a7cc9a19..6e02313c3d2983 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -869,6 +869,14 @@ LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
unsigned PropertyAttributes,
LLVMMetadataRef Ty);
+/**
+ * Create a uniqued DIType* clone with FlagObjectPointer.
+ * \param Builder The DIBuilder.
+ * \param Type The underlying type to which this pointer points.
+ */
+LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
+ LLVMMetadataRef Type);
+
/**
* Create a uniqued DIType* clone with FlagObjectPointer. If \c Implicit
* is true, then also set FlagArtificial.
@@ -877,9 +885,9 @@ LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
* \param Implicit Indicates whether this pointer was implicitly generated
* (i.e., not spelled out in source).
*/
-LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
- LLVMMetadataRef Type,
- LLVMBool Implicit);
+LLVMMetadataRef
+LLVMDIBuilderCreateImplicitObjectPointerType(LLVMDIBuilderRef Builder,
+ LLVMMetadataRef Type);
/**
* Create debugging information entry for a qualified
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 4ce518009bd3ea..6ff0d280081fdd 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1433,10 +1433,16 @@ LLVMDIBuilderCreateObjCProperty(LLVMDIBuilderRef Builder,
}
LLVMMetadataRef LLVMDIBuilderCreateObjectPointerType(LLVMDIBuilderRef Builder,
- LLVMMetadataRef Type,
- LLVMBool Implicit) {
+ LLVMMetadataRef Type) {
return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI<DIType>(Type),
- Implicit));
+ /*Implicit=*/false));
+}
+
+LLVMMetadataRef
+LLVMDIBuilderCreateImplicitObjectPointerType(LLVMDIBuilderRef Builder,
+ LLVMMetadataRef Type) {
+ return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI<DIType>(Type),
+ /*Implicit=*/true));
}
LLVMMetadataRef
``````````
</details>
https://github.com/llvm/llvm-project/pull/124144
More information about the llvm-commits
mailing list