aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-04-06 20:59:48 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-04-06 20:59:48 +0000
commit15d9a4c49c3198d77ea74e03f71133737d2e91da (patch)
tree5563651a21ceb3270fd5567d455ce15c4e16b77c /llvm/lib/IR/Function.cpp
parentc437888f5af7ab582bfb10a2159c06e07b7cbe57 (diff)
downloadllvm-15d9a4c49c3198d77ea74e03f71133737d2e91da.zip
llvm-15d9a4c49c3198d77ea74e03f71133737d2e91da.tar.gz
llvm-15d9a4c49c3198d77ea74e03f71133737d2e91da.tar.bz2
[opaque pointer type] Avoid using PointerType::getElementType when parsing IR
A few calls are left in for error checking - but I'm commenting those out & trying to build some IR tests (aiming for Argument Promotion to start with). When I get any of these tests passing I may add flag to disable the checking so I can add tests that pass with the assertion in place. llvm-svn: 234206
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp7
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);