Allow the byval attribute for pointers to any type with
authorDuncan Sands <baldrick@free.fr>
Sun, 13 Jan 2008 21:19:12 +0000 (21:19 +0000)
committerDuncan Sands <baldrick@free.fr>
Sun, 13 Jan 2008 21:19:12 +0000 (21:19 +0000)
a size, not just structs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45938 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/ParameterAttributes.cpp

index 77a2a6e7fe3317ff91faa08e141d210a2df8a6ca..b48e0cecde35616a595768af8ee808191ee6a50e 100644 (file)
@@ -194,8 +194,8 @@ uint16_t ParamAttr::typeIncompatible (const Type *Ty) {
     Incompatible |= SExt | ZExt;
 
   if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
-    if (!isa<StructType>(PTy->getElementType()))
-      // Attributes that only apply to pointers to structs.
+    if (!PTy->getElementType()->isSized())
+      // The byval attribute only applies to pointers to types with a size.
       Incompatible |= ParamAttr::ByVal;
   } else {
     // Attributes that only apply to pointers.