[llvm-commits] [llvm] r61677 - /llvm/trunk/lib/VMCore/Function.cpp

Chris Lattner sabre at nondot.org
Sun Jan 4 23:58:59 PST 2009


Author: lattner
Date: Mon Jan  5 01:58:59 2009
New Revision: 61677

URL: http://llvm.org/viewvc/llvm-project?rev=61677&view=rev
Log:
tighten up return type check

Modified:
    llvm/trunk/lib/VMCore/Function.cpp

Modified: llvm/trunk/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=61677&r1=61676&r2=61677&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Function.cpp (original)
+++ llvm/trunk/lib/VMCore/Function.cpp Mon Jan  5 01:58:59 2009
@@ -161,12 +161,10 @@
                    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.





More information about the llvm-commits mailing list