[PATCH] D58334: [LLVM-C] Add bindings to create macro debug info

Jean-Bapiste Lepesme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 17 15:44:02 PST 2019


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

The C API doesn't have the bindings to create macro debug information.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58334

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,24 @@
   return wrap(unwrapDI<DILocation>(Location)->getScope());
 }
 
+LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder,
+                                         LLVMMetadataRef ParentMacroFile,
+                                         unsigned Line, unsigned MacroType,
+                                         const char *Name, size_t NameLen,
+                                         const char *Value, size_t ValueLen) {
+  return wrap(unwrap(Builder)->createMacro(
+      unwrapDI<DIMacroFile>(ParentMacroFile), Line, MacroType, {Name, NameLen},
+      {Value, ValueLen}));
+}
+
+LLVMMetadataRef
+LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder,
+                                 LLVMMetadataRef ParentMacroFile, unsigned Line,
+                                 LLVMMetadataRef File) {
+  return wrap(unwrap(Builder)->createTempMacroFile(
+      unwrapDI<DIMacroFile>(ParentMacroFile), Line, unwrapDI<DIFile>(File)));
+}
+
 LLVMMetadataRef LLVMDIBuilderCreateEnumerator(LLVMDIBuilderRef Builder,
                                               const char *Name, size_t NameLen,
                                               int64_t Value,
Index: llvm/include/llvm-c/DebugInfo.h
===================================================================
--- llvm/include/llvm-c/DebugInfo.h
+++ llvm/include/llvm-c/DebugInfo.h
@@ -478,6 +478,37 @@
                                   unsigned NumParameterTypes,
                                   LLVMDIFlags Flags);
 
+/**
+ * Create debugging information entry for a macro.
+ * @param Builder         The DIBuilder.
+ * @param ParentMacroFile Macro parent (could be NULL).
+ * @param Line            Source line number where the macro is defined.
+ * @param MacroType       DW_MACINFO_define or DW_MACINFO_undef.
+ * @param Name            Macro name.
+ * @param NameLen         Macro name length.
+ * @param Value           Macro value.
+ * @param ValueLen        Macro value length.
+ */
+LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder,
+                                         LLVMMetadataRef ParentMacroFile,
+                                         unsigned Line, unsigned MacroType,
+                                         const char *Name, size_t NameLen,
+                                         const char *Value, size_t ValueLen);
+
+/**
+ * Create debugging information temporary entry for a macro file.
+ * List of macro node direct children will be calculated by DIBuilder,
+ * using the \p ParentMacroFile relationship.
+ * @param Builder         The DIBuilder.
+ * @param ParentMacroFile Macro parent (could be NULL).
+ * @param Line            Source line number where the macro file is included.
+ * @param File            File descriptor containing the name of the macro file.
+ */
+LLVMMetadataRef
+LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder,
+                                 LLVMMetadataRef ParentMacroFile, unsigned Line,
+                                 LLVMMetadataRef File);
+
 /**
  * Create debugging information entry for an enumerator.
  * @param Builder        The DIBuilder.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58334.187181.patch
Type: text/x-patch
Size: 3301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190217/2d010b98/attachment.bin>


More information about the llvm-commits mailing list