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 | 29ca2a36358dcc28dfa8dd9c8033b8c6b0384a60 (patch) | |
tree | 5feff6902c72e4e71331820990312336ccc86cd6 /lib/VMCore | |
parent | 4b69a206bfe0a610015a34c96ff306825d32fc0f (diff) | |
download | external_llvm-29ca2a36358dcc28dfa8dd9c8033b8c6b0384a60.zip external_llvm-29ca2a36358dcc28dfa8dd9c8033b8c6b0384a60.tar.gz external_llvm-29ca2a36358dcc28dfa8dd9c8033b8c6b0384a60.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/ParameterAttributes.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/VMCore/ParameterAttributes.cpp b/lib/VMCore/ParameterAttributes.cpp index 0cafd30..b099c8f 100644 --- a/lib/VMCore/ParameterAttributes.cpp +++ b/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; } |