tighten up return type check
authorChris Lattner <sabre@nondot.org>
Mon, 5 Jan 2009 07:58:59 +0000 (07:58 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 5 Jan 2009 07:58:59 +0000 (07:58 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61677 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Function.cpp

index f83fe435cd0e2243695e97074e6a001d26353f2c..8210350d71544f863e0f920b6b36a20b9ffdc2bc 100644 (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.