[llvm-commits] [llvm] r46216 - /llvm/trunk/lib/VMCore/ParameterAttributes.cpp

Duncan Sands baldrick at free.fr
Mon Jan 21 13:37:42 PST 2008


Author: baldrick
Date: Mon Jan 21 15:37:41 2008
New Revision: 46216

URL: http://llvm.org/viewvc/llvm-project?rev=46216&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/VMCore/ParameterAttributes.cpp

Modified: llvm/trunk/lib/VMCore/ParameterAttributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ParameterAttributes.cpp?rev=46216&r1=46215&r2=46216&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/ParameterAttributes.cpp (original)
+++ llvm/trunk/lib/VMCore/ParameterAttributes.cpp Mon Jan 21 15:37:41 2008
@@ -200,14 +200,9 @@
     // 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;
 }





More information about the llvm-commits mailing list