Adds recognition of sentinel attribute on block declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71788 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 6a7bca0..2bc7461 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5038,7 +5038,12 @@
 
     CurBlock->hasPrototype = true;
     CurBlock->isVariadic = false;
-    
+    // Check for a valid sentinel attribute on this block.
+    if (CurBlock->TheDecl->getAttr<SentinelAttr>()) {
+      Diag(ParamInfo.getAttributes()->getLoc(), 
+           diag::warn_attribute_sentinel_not_variadic);
+      // FIXME: remove the attribute.
+    }
     QualType RetTy = T.getTypePtr()->getAsFunctionType()->getResultType();
     
     // Do not allow returning a objc interface by-value.
@@ -5080,6 +5085,13 @@
     if ((*AI)->getIdentifier())
       PushOnScopeChains(*AI, CurBlock->TheScope);
 
+  // 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);
+    // FIXME: remove the attribute.
+  }
+  
   // Analyze the return type.
   QualType T = GetTypeForDeclarator(ParamInfo, CurScope);
   QualType RetTy = T->getAsFunctionType()->getResultType();