Author: reid Date: Mon Jul 23 18:09:55 2007 New Revision: 40453 URL: http://llvm.org/viewvc/llvm-project?rev=40453&view=rev Log: Add better verification of attributes on function types. It is not permitted to use sret or inreg on the function. It is equally illegal to use noreturn or nounwind on a parameter; they only go with the function. This patch enforces these rules.
Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=40453&r1=40452&r2=40453&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Jul 23 18:09:55 2007 @@ -364,6 +364,10 @@ Assert(!Attrs->paramHasAttr(0, ParamAttr::ByVal), "Attribute ByVal should not apply to functions!"); + Assert(!Attrs->paramHasAttr(0, ParamAttr::StructRet), + "Attribute SRet should not apply to functions!"); + Assert(!Attrs->paramHasAttr(0, ParamAttr::InReg), + "Attribute SRet should not apply to functions!"); for (FunctionType::param_iterator I = FT->param_begin(), E = FT->param_end(); I != E; ++I, ++Idx) { @@ -386,6 +390,11 @@ Assert1(isa<StructType>(Ty->getElementType()), "Attribute ByVal should only apply to pointer to structs!", &F); } + + if (Attrs->paramHasAttr(Idx, ParamAttr::NoReturn)) + Assert1(0, "Attribute NoReturn should only be applied to function", &F); + if (Attrs->paramHasAttr(Idx, ParamAttr::NoUnwind)) + Assert1(0, "Attribute NoUnwind should only be applied to function", &F); } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits