From 8a816716db5d7f88efb2c1a1e93ede38cb3cf4fb Mon Sep 17 00:00:00 2001 From: Mats Larsen Date: Fri, 24 Jan 2025 01:32:23 +0900 Subject: [PATCH] [C-API] Add implicit DIBuilder CreateObjectPointerType for backwards compatability 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. 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. --- llvm/include/llvm-c/DebugInfo.h | 14 +++++++++++--- llvm/lib/IR/DebugInfo.cpp | 12 +++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h index ac7ee5a7cc9a1..6e02313c3d298 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 4ce518009bd3e..6ff0d280081fd 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(Type), - Implicit)); + /*Implicit=*/false)); +} + +LLVMMetadataRef +LLVMDIBuilderCreateImplicitObjectPointerType(LLVMDIBuilderRef Builder, + LLVMMetadataRef Type) { + return wrap(unwrap(Builder)->createObjectPointerType(unwrapDI(Type), + /*Implicit=*/true)); } LLVMMetadataRef