summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DebugInfo.cpp
diff options
context:
space:
mode:
authorRobert Widmann <devteam.codafi@gmail.com>2018-10-01 13:15:09 +0000
committerRobert Widmann <devteam.codafi@gmail.com>2018-10-01 13:15:09 +0000
commitabda7ee8e75bb79630edd0e213033a55178da64d (patch)
tree7f059517689fdab26bfdb2b26c1299882531cea7 /llvm/lib/IR/DebugInfo.cpp
parenta982236e590b097d303d1b8248a8cca45193b095 (diff)
downloadbcm5719-llvm-abda7ee8e75bb79630edd0e213033a55178da64d.tar.gz
bcm5719-llvm-abda7ee8e75bb79630edd0e213033a55178da64d.zip
[LLVM-C] Add an accessor for the kind of a Metadata Node
Summary: Allows for retrieving the type of a metadata node. Has the added benefit of ensuring that the C and C++ kind APIs stay in sync as a failure to add a corresponding LLVMMetadataKind will result in the switch in the accessor being semantically malformed. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D52693 llvm-svn: 343469
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r--llvm/lib/IR/DebugInfo.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 003a48ca816..e5d7e37c033 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -1354,3 +1354,14 @@ LLVMMetadataRef LLVMGetSubprogram(LLVMValueRef Func) {
void LLVMSetSubprogram(LLVMValueRef Func, LLVMMetadataRef SP) {
unwrap<Function>(Func)->setSubprogram(unwrap<DISubprogram>(SP));
}
+
+LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata) {
+ switch(unwrap(Metadata)->getMetadataID()) {
+#define HANDLE_METADATA_LEAF(CLASS) \
+ case Metadata::CLASS##Kind: \
+ return (LLVMMetadataKind)LLVM##CLASS##MetadataKind;
+#include "llvm/IR/Metadata.def"
+ default:
+ return (LLVMMetadataKind)LLVMGenericDINodeMetadataKind;
+ }
+}
OpenPOWER on IntegriCloud