diff options
| author | Dan Gohman <gohman@apple.com> | 2008-08-27 14:48:06 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2008-08-27 14:48:06 +0000 |
| commit | 6d618724b5c18ac6863ac0beb1704c9e8e253fb7 (patch) | |
| tree | bf38b7c7af05116a0d3aa77a7953693a0b2ec09e /llvm/lib | |
| parent | 4051bf47ec8e38e04b96f3ce0fc9cb82fef80241 (diff) | |
| download | bcm5719-llvm-6d618724b5c18ac6863ac0beb1704c9e8e253fb7.tar.gz bcm5719-llvm-6d618724b5c18ac6863ac0beb1704c9e8e253fb7.zip | |
Diagnose uses of unsized types with the byval attribute in the
verifier. See PR2711 for details.
llvm-svn: 55414
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/VMCore/Verifier.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 299a0f4043c..84f94991689 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -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. |

