detect invalid combination of sret and byval

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2007-07-17 13:34:23 +00:00
parent 6bd7ada32d
commit 969c44481b

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()),