[PATCH] D58323: [LLVM-C] Add bindings to create enumerators

Jean-Bapiste Lepesme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 16 08:03:27 PST 2019


Jiboo created this revision.
Jiboo added reviewers: whitequark, CodaFi, harlanhaskins.
Jiboo added a project: LLVM.
Herald added a reviewer: deadalnix.
Herald added subscribers: llvm-commits, hiraditya.

The C API don't have the bindings to create enumerators, needed to create an enumeration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58323

Files:
  llvm/include/llvm-c/DebugInfo.h
  llvm/lib/IR/DebugInfo.cpp


Index: llvm/lib/IR/DebugInfo.cpp
===================================================================
--- llvm/lib/IR/DebugInfo.cpp
+++ llvm/lib/IR/DebugInfo.cpp
@@ -899,6 +899,14 @@
   return wrap(unwrapDI<DILocation>(Location)->getScope());
 }
 
+LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
+                                              const char *Name, size_t NameLen,
+                                              int64_t Value,
+                                              LLVMBool IsUnsigned) {
+  return wrap(unwrap(Builder)->createEnumerator({Name, NameLen}, Value,
+                                                IsUnsigned != 0));
+}
+
 LLVMMetadataRef LLVMDIBuilderCreateEnumerationType(
   LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
   size_t NameLen, LLVMMetadataRef File, unsigned LineNumber,
Index: llvm/include/llvm-c/DebugInfo.h
===================================================================
--- llvm/include/llvm-c/DebugInfo.h
+++ llvm/include/llvm-c/DebugInfo.h
@@ -478,6 +478,19 @@
                                   unsigned NumParameterTypes,
                                   LLVMDIFlags Flags);
 
+/**
+ * Create debugging information entry for an enumerator.
+ * @param Builder        The DIBuilder.
+ * @param Name           Enumerator name.
+ * @param NameLen        Length of enumerator name.
+ * @param Value          Enumerator value.
+ * @param IsUnsigned     True if the value is unsigned.
+ */
+LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
+                                              const char *Name, size_t NameLen,
+                                              int64_t Value,
+                                              LLVMBool IsUnsigned);
+
 /**
  * Create debugging information entry for an enumeration.
  * \param Builder        The DIBuilder.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58323.187139.patch
Type: text/x-patch
Size: 1882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190216/b8637b2e/attachment.bin>


More information about the llvm-commits mailing list