From 58cb4e0217d1f4f5919c5bf2ec9a44e2018b61f0 Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Tue, 12 Aug 2014 02:55:40 +0000 Subject: [PATCH] [LLVM-C] Expose User::getOperandUse as LLVMGetOperandUse. Patch by Gabriel Radanne llvm-svn: 215419 --- include/llvm-c/Core.h | 7 +++++++ lib/IR/Core.cpp | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h index 69ed08dff1f..e5d5f3f99bd 100644 --- a/include/llvm-c/Core.h +++ b/include/llvm-c/Core.h @@ -1377,6 +1377,13 @@ LLVMValueRef LLVMGetUsedValue(LLVMUseRef U); */ LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index); +/** + * Obtain the use of an operand at a specific index in a llvm::User value. + * + * @see llvm::User::getOperandUse() + */ +LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index); + /** * Set an operand at a specific index in a llvm::User value. * diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index 8bc0bb92e60..2b2ccb96cc2 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -603,6 +603,11 @@ LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index) { return wrap(cast(V)->getOperand(Index)); } +LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index) { + Value *V = unwrap(Val); + return wrap(&cast(V)->getOperandUse(Index)); +} + void LLVMSetOperand(LLVMValueRef Val, unsigned Index, LLVMValueRef Op) { unwrap(Val)->setOperand(Index, unwrap(Op)); }