mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-29 15:04:57 +00:00
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. llvm-svn: 40453
This commit is contained in:
parent
f4eead2a50
commit
6286ca1d69
@ -364,6 +364,10 @@ void Verifier::visitFunction(Function &F) {
|
||||
|
||||
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 @@ void Verifier::visitFunction(Function &F) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user