detect invalid combination of sret and byval
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 17 Jul 2007 13:34:23 +0000 (13:34 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 17 Jul 2007 13:34:23 +0000 (13:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39971 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index a40d197aa29ceb4b077e968a208a40e7d4b4d804..cbb34f09e46dd0063a1bb555244e6741ad867500 100644 (file)
@@ -377,6 +377,10 @@ void Verifier::visitFunction(Function &F) {
       if (Attrs->paramHasAttr(Idx, ParamAttr::ByVal)) {
         Assert1(isa<PointerType>(FT->getParamType(Idx-1)),
                 "Attribute ByVal should only apply to pointer to structs!", &F);
+
+        Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::StructRet),
+                "Attributes ByVal and StructRet are incompatible!", &F);
+
         const PointerType *Ty =
             cast<PointerType>(FT->getParamType(Idx-1));
         Assert1(isa<StructType>(Ty->getElementType()),