tighten up return type check

llvm-svn: 61677
This commit is contained in:
Chris Lattner 2009-01-05 07:58:59 +00:00
parent 998fa0a2a2
commit 654695b7b5
1 changed files with 2 additions and 4 deletions

View File

@ -161,12 +161,10 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
const std::string &name, Module *ParentModule)
: GlobalValue(PointerType::getUnqual(Ty),
Value::FunctionVal, 0, 0, Linkage, name) {
assert(FunctionType::isValidReturnType(getReturnType()) &&
!isa<OpaqueType>(getReturnType()) && "invalid return type");
SymTab = new ValueSymbolTable();
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy
|| isa<StructType>(getReturnType()))
&& "LLVM functions cannot return aggregate values!");
// If the function has arguments, mark them as lazily built.
if (Ty->getNumParams())
SubclassData = 1; // Set the "has lazy arguments" bit.