1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Diagnose uses of unsized types with the byval attribute in the

verifier. See PR2711 for details.

llvm-svn: 55414
This commit is contained in:
Dan Gohman 2008-08-27 14:48:06 +00:00
parent 6d6043d2fc
commit be3a88eac3
2 changed files with 13 additions and 1 deletions

View File

@ -421,6 +421,17 @@ void Verifier::VerifyAttrs(ParameterAttributes Attrs, const Type *Ty,
ParameterAttributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
Assert1(!TypeI, "Wrong type for attribute " +
ParamAttr::getAsString(TypeI), V);
ParameterAttributes ByValI = Attrs & ParamAttr::ByVal;
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
Assert1(!ByValI || PTy->getElementType()->isSized(),
"Attribute " + ParamAttr::getAsString(ByValI) +
" does not support unsized types!", V);
} else {
Assert1(!ByValI,
"Attribute " + ParamAttr::getAsString(ByValI) +
" only applies to parameters with pointer type!", V);
}
}
// VerifyFunctionAttrs - Check parameter attributes against a function type.

View File

@ -1,3 +1,4 @@
; RUN: llvm-as %s -o /dev/null -f
; RUN: not llvm-as < %s >& /dev/null
; PR2711
%s = type opaque
declare void @h(%s* byval %num)