Allow parameter attributes on varargs function parameters.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 11 Jan 2008 02:13:09 +0000 (02:13 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 11 Jan 2008 02:13:09 +0000 (02:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45850 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Verifier.cpp

index 0f7852d411e923e9fabfb0eefa812a2f66a8e4c5..8b300ff07f91f26b046077375aca109bd2ca060d 100644 (file)
@@ -390,10 +390,9 @@ void Verifier::VerifyParamAttrs(const FunctionType *FT,
   if (!Attrs)
     return;
 
-  // Note that when calling a varargs function, the following test disallows
-  // parameter attributes for the arguments corresponding to the varargs part.
-  Assert1(Attrs->size() &&
-          Attrs->getParamIndex(Attrs->size()-1) <= FT->getNumParams(),
+  Assert1(FT->isVarArg() ||
+          (Attrs->size() &&
+           Attrs->getParamIndex(Attrs->size()-1) <= FT->getNumParams()),
           "Attributes after end of type!", V);
 
   bool SawNest = false;