Make output match actual condition tested. Thanks, Duncan.
[oota-llvm.git] / lib / VMCore / Verifier.cpp
index a40d197aa29ceb4b077e968a208a40e7d4b4d804..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);
     }
   }