llvm.org GIT mirror llvm / 39dfc2c
Diagnose uses of unsized types with the byval attribute in the verifier. See PR2711 for details. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55414 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 12 years ago
2 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
420420 ParameterAttributes TypeI = Attrs & ParamAttr::typeIncompatible(Ty);
421421 Assert1(!TypeI, "Wrong type for attribute " +
422422 ParamAttr::getAsString(TypeI), V);
423
424 ParameterAttributes ByValI = Attrs & ParamAttr::ByVal;
425 if (const PointerType *PTy = dyn_cast(Ty)) {
426 Assert1(!ByValI || PTy->getElementType()->isSized(),
427 "Attribute " + ParamAttr::getAsString(ByValI) +
428 " does not support unsized types!", V);
429 } else {
430 Assert1(!ByValI,
431 "Attribute " + ParamAttr::getAsString(ByValI) +
432 " only applies to parameters with pointer type!", V);
433 }
423434 }
424435
425436 // VerifyFunctionAttrs - Check parameter attributes against a function type.
None ; RUN: llvm-as %s -o /dev/null -f
0 ; RUN: not llvm-as < %s >& /dev/null
1 ; PR2711
12 %s = type opaque
23 declare void @h(%s* byval %num)