From 969c44481b0bd7872c04bfb2af994eafd90b63b0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 17 Jul 2007 13:34:23 +0000 Subject: [PATCH] detect invalid combination of sret and byval git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39971 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Verifier.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index a40d197aa29..cbb34f09e46 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -377,6 +377,10 @@ void Verifier::visitFunction(Function &F) { if (Attrs->paramHasAttr(Idx, ParamAttr::ByVal)) { Assert1(isa(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(FT->getParamType(Idx-1)); Assert1(isa(Ty->getElementType()),