Make sure people don't make functiontypes with an invalid return type

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14654 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-07-06 23:25:19 +00:00
parent d18a31d2fa
commit edfc49de13

View File

@ -402,6 +402,8 @@ FunctionType::FunctionType(const Type *Result,
const std::vector<const Type*> &Params,
bool IsVarArgs) : DerivedType(FunctionTyID),
isVarArgs(IsVarArgs) {
assert((Result->isFirstClassType() || Result == Type::VoidTy) &&
"LLVM functions cannot return aggregates");
bool isAbstract = Result->isAbstract();
ContainedTys.reserve(Params.size()+1);
ContainedTys.push_back(PATypeHandle(Result, this));