mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-04 10:30:30 +00:00
Check return types of functions
llvm-svn: 10146
This commit is contained in:
parent
c4b71b53c7
commit
f987c67a53
@ -1395,6 +1395,9 @@ FunctionHeaderH : TypesV Name '(' ArgList ')' {
|
||||
UnEscapeLexed($2);
|
||||
std::string FunctionName($2);
|
||||
|
||||
if (!(*$1)->isFirstClassType() && *$1 != Type::VoidTy)
|
||||
ThrowException("LLVM functions cannot return aggregate types!");
|
||||
|
||||
std::vector<const Type*> ParamTypeList;
|
||||
if ($4) { // If there are arguments...
|
||||
for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = $4->begin();
|
||||
|
@ -95,6 +95,9 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
|
||||
ArgumentList.setParent(this);
|
||||
SymTab = new SymbolTable();
|
||||
|
||||
assert((getReturnType()->isFirstClassType() ||getReturnType() == Type::VoidTy)
|
||||
&& "LLVM functions cannot return aggregate values!");
|
||||
|
||||
// Create the arguments vector, all arguments start out unnamed.
|
||||
for (unsigned i = 0, e = Ty->getNumParams(); i != e; ++i) {
|
||||
assert(Ty->getParamType(i) != Type::VoidTy &&
|
||||
|
@ -241,6 +241,9 @@ void Verifier::visitFunction(Function &F) {
|
||||
Assert2(FT->getNumParams() == NumArgs,
|
||||
"# formal arguments must match # of arguments for function type!",
|
||||
&F, FT);
|
||||
Assert1(F.getReturnType()->isFirstClassType() ||
|
||||
F.getReturnType() == Type::VoidTy,
|
||||
"Functions cannot return aggregate values!", &F);
|
||||
|
||||
// Check that the argument values match the function type for this function...
|
||||
unsigned i = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user