[PATCH] D46166: [LLVM-C] Add accessor to retrieve DINode's tag

Robert Widmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 26 18:48:17 PDT 2018


CodaFi created this revision.
CodaFi added reviewers: whitequark, harlanhaskins.
Herald added a reviewer: deadalnix.
Herald added subscribers: llvm-commits, JDevlieghere, aprantl.

Add LLVMDIMetadataGetTag to retrieve any DINode's DWARF tag.


Repository:
  rL LLVM

https://reviews.llvm.org/D46166

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


Index: lib/IR/DebugInfo.cpp
===================================================================
--- lib/IR/DebugInfo.cpp
+++ lib/IR/DebugInfo.cpp
@@ -1158,6 +1158,10 @@
   return wrap(unwrap(Builder)->getOrCreateArray({DataValue, Length}).get());
 }
 
+unsigned LLVMDIMetadataGetTag(LLVMMetadataRef Node) {
+  return unwrapDI<DINode>(Node)->getTag();
+}
+
 LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func) {
   return wrap(unwrap<Function>(Func)->getSubprogram());
 }
Index: include/llvm-c/DebugInfo.h
===================================================================
--- include/llvm-c/DebugInfo.h
+++ include/llvm-c/DebugInfo.h
@@ -883,6 +883,12 @@
     size_t NameLen, unsigned ArgNo, LLVMMetadataRef File, unsigned LineNo,
     LLVMMetadataRef Ty, LLVMBool AlwaysPreserve, LLVMDIFlags Flags);
 
+/**
+ * Retrieve the DWARF tag associated with a given metadata node.
+ * \param Node    The DINode.
+ */
+unsigned LLVMDIMetadataGetTag(LLVMMetadataRef Node);
+
 /**
  * Get the metadata of the subprogram attached to a function.
  *


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46166.144260.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180427/29283250/attachment.bin>


More information about the llvm-commits mailing list