diff options
author | Duncan Sands <baldrick@free.fr> | 2008-01-21 21:37:41 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-01-21 21:37:41 +0000 |
commit | 92a56b54996d1529580fc5254072720b3d8445cc (patch) | |
tree | d264ebd91a8db1c7914efce0dbc82e24b4b5f917 /llvm/lib/VMCore/ParameterAttributes.cpp | |
parent | eab81cd03f515a4f4236d7dd93a6317e953224cb (diff) | |
download | bcm5719-llvm-92a56b54996d1529580fc5254072720b3d8445cc.tar.gz bcm5719-llvm-92a56b54996d1529580fc5254072720b3d8445cc.zip |
It turns out that in C++ it is legal to declare functions
that return an opaque type by value, as long as you don't
call it or provide a body (you can take the address of it).
So it is wrong to insist that sret parameters not be an
opaque*. And I guess it is really up to codegen to complain
if someone tries to call such a function. I'm also removing
the analogous check from byval parameters, since I don't
see why we shouldn't allow them as long as no-one tries to
call the function or give it a body.
llvm-svn: 46216
Diffstat (limited to 'llvm/lib/VMCore/ParameterAttributes.cpp')
-rw-r--r-- | llvm/lib/VMCore/ParameterAttributes.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/ParameterAttributes.cpp b/llvm/lib/VMCore/ParameterAttributes.cpp index 0cafd307b2f..b099c8fed86 100644 --- a/llvm/lib/VMCore/ParameterAttributes.cpp +++ b/llvm/lib/VMCore/ParameterAttributes.cpp @@ -200,14 +200,9 @@ uint16_t ParamAttr::typeIncompatible (const Type *Ty) { // Attributes that only apply to integers. Incompatible |= SExt | ZExt; - if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) { - if (!PTy->getElementType()->isSized()) - // The byval and sret attributes only apply to pointers to sized types. - Incompatible |= ByVal | StructRet; - } else { + if (!isa<PointerType>(Ty)) // Attributes that only apply to pointers. Incompatible |= ByVal | Nest | NoAlias | StructRet; - } return Incompatible; } |