aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2007-07-17 13:34:23 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2007-07-17 13:34:23 +0000
commit969c44481b0bd7872c04bfb2af994eafd90b63b0 (patch)
tree3f1f9480aa5e15df76d0304dde3b013a2000744c
parent6bd7ada32d120c7c10dee5f5ca6f18d128cf8520 (diff)
detect invalid combination of sret and byval
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39971 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Verifier.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index a40d197aa2..cbb34f09e4 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<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()),