aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-09-19 20:29:39 +0000
committerDuncan Sands <baldrick@free.fr>2012-09-19 20:29:39 +0000
commit4caf5281bf9cbdbc13758a6f2b965b0e9ef233d3 (patch)
tree79e5a6b1c684dd9bb1f4815fda986dccb326ecba /lib
parent6c9176aeec549adb4bbdd499664c4304ee151f68 (diff)
Add support for accessing an MDNode's operands via the C binding. Patch by
Anthony Bryant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164247 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Core.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index a56f1b282b..924367deef 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -568,6 +568,19 @@ const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len) {
return 0;
}
+unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V)
+{
+ return cast<MDNode>(unwrap(V))->getNumOperands();
+}
+
+void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest)
+{
+ const MDNode *N = cast<MDNode>(unwrap(V));
+ const unsigned numOperands = N->getNumOperands();
+ for (unsigned i = 0; i < numOperands; i++)
+ Dest[i] = wrap(N->getOperand(i));
+}
+
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char* name)
{
if (NamedMDNode *N = unwrap(M)->getNamedMetadata(name)) {