Make output match actual condition tested. Thanks, Duncan.
[oota-llvm.git] / lib / VMCore / Verifier.cpp
index 4e3a16e8ee9b93f5c45bd2ae1ba6f892d0665c10..ffca88bfabc307a67c3f4ffc196f4298434698f4 100644 (file)
@@ -362,8 +362,12 @@ void Verifier::visitFunction(Function &F) {
   if (const ParamAttrsList *Attrs = FT->getParamAttrs()) {
     unsigned Idx = 1;
 
-    Assert(!Attrs->paramHasAttr(0, ParamAttr::ByVal),
-           "Attribute ByVal should not apply to functions!");
+    Assert1(!Attrs->paramHasAttr(0, ParamAttr::ByVal),
+            "Attribute ByVal should not apply to functions!", &F);
+    Assert1(!Attrs->paramHasAttr(0, ParamAttr::StructRet),
+            "Attribute SRet should not apply to functions!", &F);
+    Assert1(!Attrs->paramHasAttr(0, ParamAttr::InReg),
+            "Attribute InReg should not apply to functions!", &F);
 
     for (FunctionType::param_iterator I = FT->param_begin(), 
          E = FT->param_end(); I != E; ++I, ++Idx) {
@@ -377,11 +381,20 @@ 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()),
                 "Attribute ByVal should only apply to pointer to structs!", &F);
       }
+
+      Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoReturn), 
+             "Attribute NoReturn should only be applied to function", &F);
+      Assert1(!Attrs->paramHasAttr(Idx, ParamAttr::NoUnwind),
+             "Attribute NoUnwind should only be applied to function", &F);
     }
   }
 
@@ -1109,7 +1122,7 @@ void Verifier::VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, ...) {
           break;
       }
     } else if (TypeID == Type::VectorTyID) {
-      // If this is a packed argument, verify the number and type of elements.
+      // If this is a vector argument, verify the number and type of elements.
       const VectorType *PTy = cast<VectorType>(Ty);
       int ElemTy = va_arg(VA, int);
       if (ElemTy != PTy->getElementType()->getTypeID()) {