improved on diagnosing misplacement of sentinel attributes.
No change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71894 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index f5b6595..42a177a 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -712,12 +712,12 @@
     }
     
     if (!cast<FunctionProtoType>(FT)->isVariadic()) {
-      S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic);
+      S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
       return;
     }    
   } else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(d)) {
     if (!MD->isVariadic()) {
-      S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic);
+      S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0;
       return;
     }
   } else if (isa<BlockDecl>(d)) {
@@ -730,7 +730,8 @@
       const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(d) 
         : Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType();
       if (!cast<FunctionProtoType>(FT)->isVariadic()) {
-        S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic);
+        int m = Ty->isFunctionPointerType() ? 0 : 1;
+        S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << m;
         return;
       }
     }
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8aaa8b1..0d72a75 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5068,7 +5068,7 @@
     // Check for a valid sentinel attribute on this block.
     if (CurBlock->TheDecl->getAttr<SentinelAttr>()) {
       Diag(ParamInfo.getAttributes()->getLoc(), 
-           diag::warn_attribute_sentinel_not_variadic);
+           diag::warn_attribute_sentinel_not_variadic) << 1;
       // FIXME: remove the attribute.
     }
     QualType RetTy = T.getTypePtr()->getAsFunctionType()->getResultType();
@@ -5115,7 +5115,7 @@
   // Check for a valid sentinel attribute on this block.
   if (!CurBlock->isVariadic && CurBlock->TheDecl->getAttr<SentinelAttr>()) {
     Diag(ParamInfo.getAttributes()->getLoc(), 
-         diag::warn_attribute_sentinel_not_variadic);
+         diag::warn_attribute_sentinel_not_variadic) << 1;
     // FIXME: remove the attribute.
   }