diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h --- a/llvm/include/llvm-c/Core.h +++ b/llvm/include/llvm-c/Core.h @@ -2631,6 +2631,13 @@ */ void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC); +/** + * Obtain the function type of a function. + * + * @see llvm::Function::getFunctionType() + */ +unsigned LLVMGetFunctionType(LLVMValueRef Fn); + /** * Obtain the name of the garbage collector to use during code * generation. diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2410,6 +2410,10 @@ static_cast(CC)); } +LLVMTypeRef LLVMGetFunctionType(LLVMValueRef Fn) { + return wrap(unwrap(Fn)->getFunctionType()); +} + const char *LLVMGetGC(LLVMValueRef Fn) { Function *F = unwrap(Fn); return F->hasGC()? F->getGC().c_str() : nullptr;