diff options
author | Duncan Sands <baldrick@free.fr> | 2012-09-19 20:29:39 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2012-09-19 20:29:39 +0000 |
commit | 12ccbe7a8e356bc1a52e5f7ded532e3a62379053 (patch) | |
tree | 86183476c5af950def06fea8e9cee144e2feb42b /llvm/lib/VMCore/Core.cpp | |
parent | 242ed3158a033b4568e33a337934f884f9108a37 (diff) | |
download | bcm5719-llvm-12ccbe7a8e356bc1a52e5f7ded532e3a62379053.tar.gz bcm5719-llvm-12ccbe7a8e356bc1a52e5f7ded532e3a62379053.zip |
Add support for accessing an MDNode's operands via the C binding. Patch by
Anthony Bryant.
llvm-svn: 164247
Diffstat (limited to 'llvm/lib/VMCore/Core.cpp')
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index a56f1b282ba..924367deef2 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/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)) { |