diff options
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
| -rw-r--r-- | llvm/lib/IR/Function.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 33e1526..8275cc6 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -215,9 +215,7 @@ LLVMContext &Function::getContext() const { return getType()->getContext(); } -FunctionType *Function::getFunctionType() const { - return cast<FunctionType>(getType()->getElementType()); -} +FunctionType *Function::getFunctionType() const { return Ty; } bool Function::isVarArg() const { return getFunctionType()->isVarArg(); @@ -242,7 +240,8 @@ void Function::eraseFromParent() { Function::Function(FunctionType *Ty, LinkageTypes Linkage, const Twine &name, Module *ParentModule) : GlobalObject(PointerType::getUnqual(Ty), Value::FunctionVal, nullptr, 0, - Linkage, name) { + Linkage, name), + Ty(Ty) { assert(FunctionType::isValidReturnType(getReturnType()) && "invalid return type"); setIsMaterializable(false); |
