Some early declarations to support sentinel attribute on
message dispatches (and function calls later). No change in
functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71683 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 2e617f5..8c38c2b 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -1274,6 +1274,8 @@
   bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, 
                                         ObjCMethodDecl *Getter,
                                         SourceLocation Loc);
+  void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
+                             Expr **Args, unsigned NumArgs);
 
   // Primary Expressions.
   virtual SourceRange getExprRange(ExprTy *E) const;
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index d2e84c1..f1da408 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -88,6 +88,15 @@
   return false;
 }
 
+/// DiagnoseSentinelCalls - This routine checks on method dispatch calls
+/// (and other functions in future), which have been declared with sentinel 
+/// attribute. It warns if call does not have the sentinel argument.
+///
+void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
+                                 Expr **Args, unsigned NumArgs)
+{
+}
+
 SourceRange Sema::getExprRange(ExprTy *E) const {
   Expr *Ex = (Expr *)E;
   return Ex? Ex->getSourceRange() : SourceRange();
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index de6b69f..0073fd9 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -626,6 +626,8 @@
     return true;
   }
   
+  if (Method)
+    DiagnoseSentinelCalls(Method, receiverLoc, ArgExprs, NumArgs);
   if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
                                 lbrac, rbrac, returnType))
     return true;