forked from OSchip/llvm-project
Check that sret is only used on pointers to types
with a size, like byval. llvm-svn: 46207
This commit is contained in:
parent
a59f396cba
commit
262e54eb7b
|
@ -202,8 +202,8 @@ uint16_t ParamAttr::typeIncompatible (const Type *Ty) {
|
||||||
|
|
||||||
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
|
if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
|
||||||
if (!PTy->getElementType()->isSized())
|
if (!PTy->getElementType()->isSized())
|
||||||
// The byval attribute only applies to pointers to types with a size.
|
// The byval and sret attributes only apply to pointers to sized types.
|
||||||
Incompatible |= ParamAttr::ByVal;
|
Incompatible |= ByVal | StructRet;
|
||||||
} else {
|
} else {
|
||||||
// Attributes that only apply to pointers.
|
// Attributes that only apply to pointers.
|
||||||
Incompatible |= ByVal | Nest | NoAlias | StructRet;
|
Incompatible |= ByVal | Nest | NoAlias | StructRet;
|
||||||
|
|
Loading…
Reference in New Issue