diff options
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Function.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index dd78196..1374d55 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -105,6 +105,8 @@ ParamAttrsList::getParamAttrsText(uint16_t Attrs) { Result += "sret "; if (Attrs & ParamAttr::ByVal) Result += "byval "; + if (Attrs & ParamAttr::Nest) + Result += "nest "; return Result; } diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index ffca88b..de4050d 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -361,6 +361,7 @@ void Verifier::visitFunction(Function &F) { if (const ParamAttrsList *Attrs = FT->getParamAttrs()) { unsigned Idx = 1; + bool SawNest = false; Assert1(!Attrs->paramHasAttr(0, ParamAttr::ByVal), "Attribute ByVal should not apply to functions!", &F); @@ -368,6 +369,8 @@ void Verifier::visitFunction(Function &F) { "Attribute SRet should not apply to functions!", &F); Assert1(!Attrs->paramHasAttr(0, ParamAttr::InReg), "Attribute InReg should not apply to functions!", &F); + Assert1(!Attrs->paramHasAttr(0, ParamAttr::Nest), + "Attribute Nest should not apply to functions!", &F); for (FunctionType::param_iterator I = FT->param_begin(), E = FT->param_end(); I != E; ++I, ++Idx) { @@ -391,6 +394,20 @@ void Verifier::visitFunction(Function &F) { "Attribute ByVal should only apply to pointer to structs!", &F); } + if (Attrs->paramHasAttr(Idx, ParamAttr::Nest)) { + Assert1(!SawNest, "More than one parameter has attribute Nest!", &F); + SawNest = true; + + Assert1(isa<PointerType>(FT->getParamType(Idx-1)), + "Attribute Nest should only apply to Pointer type!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::ByVal), + "Attributes Nest and ByVal are incompatible!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::InReg), + "Attributes Nest and InReg are incompatible!", &F); + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::StructRet), + "Attributes Nest and StructRet are incompatible!", &F); + } + Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoReturn), "Attribute NoReturn should only be applied to function", &F); Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoUnwind), |