detect invalid combination of sret and byval

llvm-svn: 39971
This commit is contained in:
Rafael Espindola 2007-07-17 13:34:23 +00:00
parent bea1390e68
commit 6389ef9854
1 changed files with 4 additions and 0 deletions

View File

@ -377,6 +377,10 @@ void Verifier::visitFunction(Function &F) {
if (Attrs->paramHasAttr(Idx, ParamAttr::ByVal)) {
Assert1(isa<PointerType>(FT->getParamType(Idx-1)),
"Attribute ByVal should only apply to pointer to structs!", &F);
Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::StructRet),
"Attributes ByVal and StructRet are incompatible!", &F);
const PointerType *Ty =
cast<PointerType>(FT->getParamType(Idx-1));
Assert1(isa<StructType>(Ty->getElementType()),