Refactor the deprecated and unavailable checks into a new
DiagnoseUseOfDeprecatedDecl method.  This ensures that they
are treated consistently.  This gets us 'unavailable' support
on a few new types of decls, and makes sure we consistently
silence deprecated when the caller is also deprecated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64612 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 7c2d3b6..362d8dc 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -275,7 +275,7 @@
   //
   virtual TypeTy *getTypeName(IdentifierInfo &II, SourceLocation NameLoc, 
                               Scope *S, const CXXScopeSpec *SS);
-  virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup) {
+  virtual DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup){
     return ActOnDeclarator(S, D, LastInGroup, false);
   }
   DeclTy *ActOnDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup,
@@ -1046,6 +1046,15 @@
   //===--------------------------------------------------------------------===//
   // Expression Parsing Callbacks: SemaExpr.cpp.
 
+  /// DiagnoseUseOfDeprecatedDecl - If the specified decl is deprecated or
+  // unavailable, emit the corresponding diagnostics. 
+  inline void DiagnoseUseOfDeprecatedDecl(NamedDecl *D, SourceLocation Loc) {
+    if (D->hasAttrs())
+      DiagnoseUseOfDeprecatedDeclImpl(D, Loc);
+  }
+  void DiagnoseUseOfDeprecatedDeclImpl(NamedDecl *D, SourceLocation Loc);
+
+  
   // Primary Expressions.
   virtual OwningExprResult ActOnIdentifierExpr(Scope *S, SourceLocation Loc,
                                                IdentifierInfo &II,
@@ -1218,6 +1227,8 @@
   virtual ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, StmtTy *Body,
                                         Scope *CurScope);
 
+  //===---------------------------- C++ Features --------------------------===//
+
   // Act on C++ namespaces
   virtual DeclTy *ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc,
                                         IdentifierInfo *Ident,