From 262e54eb7b397b09c3ce183a2256bf895e7dca76 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 21 Jan 2008 11:28:49 +0000 Subject: [PATCH] Check that sret is only used on pointers to types with a size, like byval. llvm-svn: 46207 --- llvm/lib/VMCore/ParameterAttributes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/VMCore/ParameterAttributes.cpp b/llvm/lib/VMCore/ParameterAttributes.cpp index 4b63cfb2da7c..0cafd307b2f0 100644 --- a/llvm/lib/VMCore/ParameterAttributes.cpp +++ b/llvm/lib/VMCore/ParameterAttributes.cpp @@ -202,8 +202,8 @@ uint16_t ParamAttr::typeIncompatible (const Type *Ty) { if (const PointerType *PTy = dyn_cast(Ty)) { if (!PTy->getElementType()->isSized()) - // The byval attribute only applies to pointers to types with a size. - Incompatible |= ParamAttr::ByVal; + // The byval and sret attributes only apply to pointers to sized types. + Incompatible |= ByVal | StructRet; } else { // Attributes that only apply to pointers. Incompatible |= ByVal | Nest | NoAlias | StructRet;