From 00374d1830d1adae1326446243166b380bbbae53 Mon Sep 17 00:00:00 2001
From: Ted Kremenek <kremenek@apple.com>
Date: Wed, 18 Dec 2013 23:30:06 +0000
Subject: [PATCH] Implemented delayed processing of 'unavailable' checking,
 just like with 'deprecated'.

Fixes <rdar://problem/15584219> and <rdar://problem/12241361>.

This change looks large, but all it does is reuse and consolidate
the delayed diagnostic logic for deprecation warnings with unavailability
warnings.  By doing so, it showed various inconsistencies between the
diagnostics, which were close, but not consistent.  It also revealed
some missing "note:"'s in the deprecated diagnostics that were showing
up in the unavailable diagnostics, etc.

This change also changes the wording of the core deprecation diagnostics.
Instead of saying "function has been explicitly marked deprecated"
we now saw "'X' has been been explicitly marked deprecated".  It
turns out providing a bit more context is useful, and often we
got the actual term wrong or it was not very precise
 (e.g., "function" instead of "destructor").  By just saying the name
of the thing that is deprecated/deleted/unavailable we define
this issue away.  This diagnostic can likely be further wordsmithed
to be shorter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197627 91177308-0d34-0410-b5e6-96231b3b80d8
---
 include/clang/Basic/DiagnosticSemaKinds.td    |   4 +-
 include/clang/Sema/DelayedDiagnostic.h        |  20 ++-
 include/clang/Sema/Sema.h                     |  13 +-
 lib/Sema/DelayedDiagnostic.cpp                |  13 +-
 lib/Sema/SemaDeclAttr.cpp                     | 153 +++++++++++++-----
 lib/Sema/SemaExpr.cpp                         |  34 ++--
 test/ARCMT/checking.m                         |   6 +-
 test/Analysis/retain-release.m                |   2 +-
 .../dcl.attr/dcl.attr.deprecated/p1.cpp       |  14 +-
 test/CXX/special/class.copy/p33-0x.cpp        |   2 +-
 test/CXX/special/class.inhctor/p4.cpp         |   4 +-
 test/CXX/special/class.temporary/p1.cpp       |   2 +-
 test/Headers/ms-intrin.cpp                    |   6 +-
 test/Parser/MicrosoftExtensions.c             |   6 +-
 test/Sema/MicrosoftExtensions.c               |   6 +-
 test/Sema/attr-availability-ios.c             |   8 +-
 test/Sema/attr-availability-macosx.c          |   4 +-
 test/Sema/attr-availability.c                 |   4 +-
 test/Sema/attr-cleanup.c                      |   2 +-
 test/Sema/attr-deprecated-message.c           |   8 +-
 test/Sema/attr-deprecated.c                   |  24 +--
 test/Sema/attr-unavailable-message.c          |  12 +-
 test/Sema/typeof-use-deprecated.c             |  12 +-
 test/SemaCXX/aggregate-initialization.cpp     |   2 +-
 test/SemaCXX/attr-deprecated.cpp              |  48 +++---
 test/SemaCXX/attr-unavailable.cpp             |  21 ++-
 test/SemaCXX/cxx0x-delegating-ctors.cpp       |   2 +-
 test/SemaCXX/deleted-function.cpp             |   6 +-
 test/SemaCXX/for-range-dereference.cpp        |   2 +-
 test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp  |   2 +-
 test/SemaCXX/rval-references-examples.cpp     |   2 +-
 .../arc-unavailable-system-function.m         |   2 +-
 test/SemaObjC/attr-availability.m             |   6 +-
 test/SemaObjC/attr-deprecated.m               |  20 +--
 test/SemaObjC/class-unavail-warning.m         |   2 +-
 test/SemaObjC/property-deprecated-warning.m   |  12 +-
 .../property-noninherited-availability-attr.m |   5 +-
 test/SemaObjC/protocol-attribute.m            |   2 +-
 test/SemaObjC/special-dep-unavail-warning.m   |  14 +-
 .../warn-deprecated-implementations.m         |   2 +-
 .../warn-forward-class-attr-deprecated.m      |   2 +-
 .../warn-protocol-method-deprecated.m         |   4 +-
 test/SemaObjCXX/arc-system-header.mm          |   2 +-
 43 files changed, 300 insertions(+), 217 deletions(-)

diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index fc7a0082ff7..91a19aaf882 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3527,8 +3527,8 @@ def err_unavailable : Error<"%0 is unavailable">;
 def err_unavailable_message : Error<"%0 is unavailable: %1">;
 def warn_unavailable_fwdclass_message : Warning<
     "%0 maybe unavailable because receiver type is unknown">;
-def note_unavailable_here : Note<
-  "%select{declaration|function}0 has been explicitly marked "
+def note_availability_specified_here : Note<
+  "%0 has been explicitly marked "
   "%select{unavailable|deleted|deprecated}1 here">;
 def note_implicitly_deleted : Note<
   "explicitly defaulted function was implicitly deleted here">;
diff --git a/include/clang/Sema/DelayedDiagnostic.h b/include/clang/Sema/DelayedDiagnostic.h
index 4f4a87fe11f..0a3b9f59261 100644
--- a/include/clang/Sema/DelayedDiagnostic.h
+++ b/include/clang/Sema/DelayedDiagnostic.h
@@ -113,7 +113,7 @@ private:
 /// the complete parsing of the current declaration.
 class DelayedDiagnostic {
 public:
-  enum DDKind { Deprecation, Access, ForbiddenType };
+  enum DDKind { Deprecation, Unavailable, Access, ForbiddenType };
 
   unsigned char Kind; // actually a DDKind
   bool Triggered;
@@ -122,11 +122,13 @@ public:
 
   void Destroy();
 
-  static DelayedDiagnostic makeDeprecation(SourceLocation Loc,
-           const NamedDecl *D,
-           const ObjCInterfaceDecl *UnknownObjCClass,
-           const ObjCPropertyDecl  *ObjCProperty,
-           StringRef Msg);
+  static DelayedDiagnostic makeAvailability(Sema::AvailabilityDiagnostic AD,
+                                            SourceLocation Loc,
+                                            const NamedDecl *D,
+                                            const ObjCInterfaceDecl *UnknownObjCClass,
+                                            const ObjCPropertyDecl  *ObjCProperty,
+                                            StringRef Msg);
+
 
   static DelayedDiagnostic makeAccess(SourceLocation Loc,
                                       const AccessedEntity &Entity) {
@@ -162,12 +164,14 @@ public:
   }
 
   const NamedDecl *getDeprecationDecl() const {
-    assert(Kind == Deprecation && "Not a deprecation diagnostic.");
+    assert((Kind == Deprecation || Kind == Unavailable) &&
+           "Not a deprecation diagnostic.");
     return DeprecationData.Decl;
   }
 
   StringRef getDeprecationMessage() const {
-    assert(Kind == Deprecation && "Not a deprecation diagnostic.");
+    assert((Kind == Deprecation || Kind == Unavailable) &&
+           "Not a deprecation diagnostic.");
     return StringRef(DeprecationData.Message,
                            DeprecationData.MessageLen);
   }
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 75e1a341ed4..8533972d4fe 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -3083,12 +3083,15 @@ public:
 
   void redelayDiagnostics(sema::DelayedDiagnosticPool &pool);
 
-  void EmitDeprecationWarning(NamedDecl *D, StringRef Message,
-                              SourceLocation Loc,
-                              const ObjCInterfaceDecl *UnknownObjCClass,
-                              const ObjCPropertyDecl  *ObjCProperty);
+  enum AvailabilityDiagnostic { AD_Deprecation, AD_Unavailable };
+
+  void EmitAvailabilityWarning(AvailabilityDiagnostic AD,
+                               NamedDecl *D, StringRef Message,
+                               SourceLocation Loc,
+                               const ObjCInterfaceDecl *UnknownObjCClass,
+                               const ObjCPropertyDecl  *ObjCProperty);
 
-  void HandleDelayedDeprecationCheck(sema::DelayedDiagnostic &DD, Decl *Ctx);
+  void HandleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx);
 
   bool makeUnavailableInSystemHeader(SourceLocation loc,
                                      StringRef message);
diff --git a/lib/Sema/DelayedDiagnostic.cpp b/lib/Sema/DelayedDiagnostic.cpp
index 31004328855..533b7ef3e87 100644
--- a/lib/Sema/DelayedDiagnostic.cpp
+++ b/lib/Sema/DelayedDiagnostic.cpp
@@ -19,13 +19,22 @@
 using namespace clang;
 using namespace sema;
 
-DelayedDiagnostic DelayedDiagnostic::makeDeprecation(SourceLocation Loc,
+DelayedDiagnostic
+DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD,
+                                    SourceLocation Loc,
                                     const NamedDecl *D,
                                     const ObjCInterfaceDecl *UnknownObjCClass,
                                     const ObjCPropertyDecl  *ObjCProperty,
                                     StringRef Msg) {
   DelayedDiagnostic DD;
-  DD.Kind = Deprecation;
+  switch (AD) {
+    case Sema::AD_Deprecation:
+      DD.Kind = Deprecation;
+      break;
+    case Sema::AD_Unavailable:
+      DD.Kind = Unavailable;
+      break;
+  }
   DD.Triggered = false;
   DD.Loc = Loc;
   DD.DeprecationData.Decl = D;
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 5e9bd2cf49b..b44506c0a3f 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -4477,9 +4477,11 @@ void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
 
       switch (diag.Kind) {
       case DelayedDiagnostic::Deprecation:
-        // Don't bother giving deprecation diagnostics if the decl is invalid.
+      case DelayedDiagnostic::Unavailable:
+        // Don't bother giving deprecation/unavailable diagnostics if
+        // the decl is invalid.
         if (!decl->isInvalidDecl())
-          HandleDelayedDeprecationCheck(diag, decl);
+          HandleDelayedAvailabilityCheck(diag, decl);
         break;
 
       case DelayedDiagnostic::Access:
@@ -4514,61 +4516,124 @@ static bool isDeclDeprecated(Decl *D) {
   return false;
 }
 
+static bool isDeclUnavailable(Decl *D) {
+  do {
+    if (D->isUnavailable())
+      return true;
+    // A category implicitly has the availability of the interface.
+    if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(D))
+      return CatD->getClassInterface()->isUnavailable();
+  } while ((D = cast_or_null<Decl>(D->getDeclContext())));
+  return false;
+}
+
 static void
-DoEmitDeprecationWarning(Sema &S, const NamedDecl *D, StringRef Message,
-                         SourceLocation Loc,
-                         const ObjCInterfaceDecl *UnknownObjCClass,
-                         const ObjCPropertyDecl *ObjCPropery) {
+DoEmitAvailabilityWarning(Sema &S,
+                          DelayedDiagnostic::DDKind K,
+                          Decl *Ctx,
+                          const NamedDecl *D,
+                          StringRef Message,
+                          SourceLocation Loc,
+                          const ObjCInterfaceDecl *UnknownObjCClass,
+                          const ObjCPropertyDecl *ObjCProperty) {
+
+  // Diagnostics for deprecated or unavailable.
+  unsigned diag, diag_message, diag_fwdclass_message;
+
+  // Matches 'diag::note_property_attribute' options.
+  unsigned property_note_select;
+
+  // Matches diag::note_availability_specified_here.
+  unsigned available_here_select_kind;
+
+  // Don't warn if our current context is deprecated or unavailable.
+  switch (K) {
+    case DelayedDiagnostic::Deprecation:
+      if (isDeclDeprecated(Ctx))
+        return;
+      diag = diag::warn_deprecated;
+      diag_message = diag::warn_deprecated_message;
+      diag_fwdclass_message = diag::warn_deprecated_fwdclass_message;
+      property_note_select = /* deprecated */ 0;
+      available_here_select_kind = /* deprecated */ 2;
+      break;
+
+    case DelayedDiagnostic::Unavailable:
+      if (isDeclUnavailable(Ctx))
+        return;
+      diag = diag::err_unavailable;
+      diag_message = diag::err_unavailable_message;
+      diag_fwdclass_message = diag::warn_unavailable_fwdclass_message;
+      property_note_select = /* unavailable */ 1;
+      available_here_select_kind = /* unavailable */ 0;
+      break;
+
+    default:
+      llvm_unreachable("Neither a deprecation or unavailable kind");
+  }
+
   DeclarationName Name = D->getDeclName();
   if (!Message.empty()) {
-    S.Diag(Loc, diag::warn_deprecated_message) << Name << Message;
-    S.Diag(D->getLocation(),
-           isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at
-                                  : diag::note_previous_decl) << Name;
-    if (ObjCPropery)
-      S.Diag(ObjCPropery->getLocation(), diag::note_property_attribute)
-        << ObjCPropery->getDeclName() << 0;
+    S.Diag(Loc, diag_message) << Name << Message;
+//    S.Diag(D->getLocation(), diag::note_availability_specified_here)
+//      << D << available_here_select_kind;
+    if (ObjCProperty)
+      S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
+        << ObjCProperty->getDeclName() << property_note_select;
   } else if (!UnknownObjCClass) {
-    S.Diag(Loc, diag::warn_deprecated) << D->getDeclName();
-    S.Diag(D->getLocation(),
-           isa<ObjCMethodDecl>(D) ? diag::note_method_declared_at
-                                  : diag::note_previous_decl) << Name;
-    if (ObjCPropery)
-      S.Diag(ObjCPropery->getLocation(), diag::note_property_attribute)
-        << ObjCPropery->getDeclName() << 0;
+    S.Diag(Loc, diag) << Name;
+//    S.Diag(D->getLocation(), diag::note_availability_specified_here)
+//      << D << available_here_select_kind;
+    if (ObjCProperty)
+      S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
+        << ObjCProperty->getDeclName() << property_note_select;
   } else {
-    S.Diag(Loc, diag::warn_deprecated_fwdclass_message) << Name;
+    S.Diag(Loc, diag_fwdclass_message) << Name;
     S.Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
   }
-}
-
-void Sema::HandleDelayedDeprecationCheck(DelayedDiagnostic &DD,
-                                         Decl *Ctx) {
-  if (isDeclDeprecated(Ctx))
-    return;
 
-  DD.Triggered = true;
-  DoEmitDeprecationWarning(*this, DD.getDeprecationDecl(),
-                           DD.getDeprecationMessage(), DD.Loc,
-                           DD.getUnknownObjCClass(),
-                           DD.getObjCProperty());
+  S.Diag(D->getLocation(), diag::note_availability_specified_here)
+    << D << available_here_select_kind;
 }
 
-void Sema::EmitDeprecationWarning(NamedDecl *D, StringRef Message,
-                                  SourceLocation Loc,
-                                  const ObjCInterfaceDecl *UnknownObjCClass,
-                                  const ObjCPropertyDecl  *ObjCProperty) {
+void Sema::HandleDelayedAvailabilityCheck(DelayedDiagnostic &DD,
+                                          Decl *Ctx) {
+  DD.Triggered = true;
+  DoEmitAvailabilityWarning(*this,
+                            (DelayedDiagnostic::DDKind) DD.Kind,
+                            Ctx,
+                            DD.getDeprecationDecl(),
+                            DD.getDeprecationMessage(),
+                            DD.Loc,
+                            DD.getUnknownObjCClass(),
+                            DD.getObjCProperty());
+}
+
+void Sema::EmitAvailabilityWarning(AvailabilityDiagnostic AD,
+                                   NamedDecl *D, StringRef Message,
+                                   SourceLocation Loc,
+                                   const ObjCInterfaceDecl *UnknownObjCClass,
+                                   const ObjCPropertyDecl  *ObjCProperty) {
   // Delay if we're currently parsing a declaration.
   if (DelayedDiagnostics.shouldDelayDiagnostics()) {
-    DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, 
-                                                              UnknownObjCClass,
-                                                              ObjCProperty,
-                                                              Message));
+    DelayedDiagnostics.add(DelayedDiagnostic::makeAvailability(AD, Loc, D,
+                                                               UnknownObjCClass,
+                                                               ObjCProperty,
+                                                               Message));
     return;
   }
 
-  // Otherwise, don't warn if our current context is deprecated.
-  if (isDeclDeprecated(cast<Decl>(getCurLexicalContext())))
-    return;
-  DoEmitDeprecationWarning(*this, D, Message, Loc, UnknownObjCClass, ObjCProperty);
+  Decl *Ctx = cast<Decl>(getCurLexicalContext());
+  DelayedDiagnostic::DDKind K;
+  switch (AD) {
+    case AD_Deprecation:
+      K = DelayedDiagnostic::Deprecation;
+      break;
+    case AD_Unavailable:
+      K = DelayedDiagnostic::Unavailable;
+      break;
+  }
+
+  DoEmitAvailabilityWarning(*this, K, Ctx, D, Message, Loc,
+                            UnknownObjCClass, ObjCProperty);
 }
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a1de4046e0f..3bc221fb7ee 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -112,32 +112,16 @@ static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S,
             
     case AR_Deprecated:
       if (S.getCurContextAvailability() != AR_Deprecated)
-        S.EmitDeprecationWarning(D, Message, Loc, UnknownObjCClass, ObjCPDecl);
+        S.EmitAvailabilityWarning(Sema::AD_Deprecation,
+                                  D, Message, Loc, UnknownObjCClass, ObjCPDecl);
       break;
-            
+
     case AR_Unavailable:
-      if (S.getCurContextAvailability() != AR_Unavailable) {
-        if (Message.empty()) {
-          if (!UnknownObjCClass) {
-            S.Diag(Loc, diag::err_unavailable) << D->getDeclName();
-            if (ObjCPDecl)
-              S.Diag(ObjCPDecl->getLocation(), diag::note_property_attribute)
-                << ObjCPDecl->getDeclName() << 1;
-          }
-          else
-            S.Diag(Loc, diag::warn_unavailable_fwdclass_message) 
-              << D->getDeclName();
-        }
-        else
-          S.Diag(Loc, diag::err_unavailable_message) 
-            << D->getDeclName() << Message;
-        S.Diag(D->getLocation(), diag::note_unavailable_here)
-                  << isa<FunctionDecl>(D) << false;
-        if (ObjCPDecl)
-          S.Diag(ObjCPDecl->getLocation(), diag::note_property_attribute)
-          << ObjCPDecl->getDeclName() << 1;
-      }
+      if (S.getCurContextAvailability() != AR_Unavailable)
+        S.EmitAvailabilityWarning(Sema::AD_Unavailable,
+                                  D, Message, Loc, UnknownObjCClass, ObjCPDecl);
       break;
+
     }
     return Result;
 }
@@ -177,8 +161,8 @@ void Sema::NoteDeletedFunction(FunctionDecl *Decl) {
     }
   }
 
-  Diag(Decl->getLocation(), diag::note_unavailable_here)
-    << 1 << true;
+  Diag(Decl->getLocation(), diag::note_availability_specified_here)
+    << Decl << true;
 }
 
 /// \brief Determine whether a FunctionDecl was ever declared with an
diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m
index a640c2f4023..7815103822a 100644
--- a/test/ARCMT/checking.m
+++ b/test/ARCMT/checking.m
@@ -44,9 +44,9 @@ struct UnsafeS {
 };
 
 @interface A : NSObject
-- (id)retain; // expected-note {{declaration has been explicitly marked unavailable here}}
-- (id)retainCount; // expected-note {{declaration has been explicitly marked unavailable here}}
-- (id)autorelease; // expected-note 2 {{declaration has been explicitly marked unavailable here}}
+- (id)retain; // expected-note {{'retain' has been explicitly marked unavailable here}}
+- (id)retainCount; // expected-note {{'retainCount' has been explicitly marked unavailable here}}
+- (id)autorelease; // expected-note 2 {{'autorelease' has been explicitly marked unavailable here}}
 - (id)init;
 - (oneway void)release;
 - (void)dealloc;
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 57d3203be12..8b11a56799c 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -210,7 +210,7 @@ typedef struct IONotificationPort * IONotificationPortRef;
 typedef void (*IOServiceMatchingCallback)(  void * refcon,  io_iterator_t iterator );
 io_service_t IOServiceGetMatchingService(  mach_port_t masterPort,  CFDictionaryRef matching );
 kern_return_t IOServiceGetMatchingServices(  mach_port_t masterPort,  CFDictionaryRef matching,  io_iterator_t * existing );
-kern_return_t IOServiceAddNotification(  mach_port_t masterPort,  const io_name_t notificationType,  CFDictionaryRef matching,  mach_port_t wakePort,  uintptr_t reference,  io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' declared here}}
+kern_return_t IOServiceAddNotification(  mach_port_t masterPort,  const io_name_t notificationType,  CFDictionaryRef matching,  mach_port_t wakePort,  uintptr_t reference,  io_iterator_t * notification ) __attribute__((deprecated)); // expected-note {{'IOServiceAddNotification' has been explicitly marked deprecated here}}
 kern_return_t IOServiceAddMatchingNotification(  IONotificationPortRef notifyPort,  const io_name_t notificationType,  CFDictionaryRef matching,         IOServiceMatchingCallback callback,         void * refCon,  io_iterator_t * notification );
 CFMutableDictionaryRef IOServiceMatching(  const char * name );
 CFMutableDictionaryRef IOServiceNameMatching(  const char * name );
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
index 21119398b2f..3bbbf9eed6e 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
@@ -1,25 +1,25 @@
 // RUN: %clang_cc1 -std=c++1y -verify %s
 
-class [[deprecated]] C {}; // expected-note {{declared here}}
+class [[deprecated]] C {}; // expected-note {{'C' has been explicitly marked deprecated here}}
 C c; // expected-warning {{'C' is deprecated}}
 
-typedef int t [[deprecated]]; // expected-note {{declared here}}
+typedef int t [[deprecated]]; // expected-note {{'t' has been explicitly marked deprecated here}}
 t x = 42; // expected-warning {{'t' is deprecated}}
 
-[[deprecated]] int old = 42; // expected-note {{declared here}}
+[[deprecated]] int old = 42; // expected-note {{'old' has been explicitly marked deprecated here}}
 int use = old; // expected-warning {{'old' is deprecated}}
 
-struct S { [[deprecated]] int member = 42; } s; // expected-note {{declared here}}
+struct S { [[deprecated]] int member = 42; } s; // expected-note {{'member' has been explicitly marked deprecated here}}
 int use2 = s.member; // expected-warning {{'member' is deprecated}}
 
-[[deprecated]] int f() { return 42; } // expected-note {{declared here}}
+[[deprecated]] int f() { return 42; } // expected-note {{'f' has been explicitly marked deprecated here}}
 int use3 = f(); // expected-warning {{'f' is deprecated}}
 
-enum [[deprecated]] e { E }; // expected-note {{declared here}}
+enum [[deprecated]] e { E }; // expected-note {{'e' has been explicitly marked deprecated here}}
 e my_enum; // expected-warning {{'e' is deprecated}}
 
 template <typename T> class X {};
-template <> class [[deprecated]] X<int> {}; // expected-note {{declared here}}
+template <> class [[deprecated]] X<int> {}; // expected-note {{'X<int>' has been explicitly marked deprecated here}}
 X<char> x1;
 // FIXME: The diagnostic here could be much better by mentioning X<int>.
 X<int> x2; // expected-warning {{'X' is deprecated}}
diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp
index b66e19ab4c4..28cd4f33a8a 100644
--- a/test/CXX/special/class.copy/p33-0x.cpp
+++ b/test/CXX/special/class.copy/p33-0x.cpp
@@ -27,7 +27,7 @@ namespace PR10142 {
   struct X {
     X();
     X(X&&);
-    X(const X&) = delete; // expected-note 2{{function has been explicitly marked deleted here}}
+    X(const X&) = delete; // expected-note 2{{'X' has been explicitly marked deleted here}}
   };
 
   void f(int i) {
diff --git a/test/CXX/special/class.inhctor/p4.cpp b/test/CXX/special/class.inhctor/p4.cpp
index 356cdef687f..ae1f7a57031 100644
--- a/test/CXX/special/class.inhctor/p4.cpp
+++ b/test/CXX/special/class.inhctor/p4.cpp
@@ -43,8 +43,8 @@ FA fa2{X<2>{}}; // expected-error {{calling a private constructor}}
 
 // It is deleted if the corresponding constructor [...] is deleted.
 struct G {
-  G(int) = delete; // expected-note {{function has been explicitly marked deleted here}}
-  template<typename T> G(T*) = delete; // expected-note {{function has been explicitly marked deleted here}}
+  G(int) = delete; // expected-note {{'G' has been explicitly marked deleted here}}
+  template<typename T> G(T*) = delete; // expected-note {{'G<const char>' has been explicitly marked deleted here}}
 };
 struct H : G {
   using G::G; // expected-note 2{{deleted constructor was inherited here}}
diff --git a/test/CXX/special/class.temporary/p1.cpp b/test/CXX/special/class.temporary/p1.cpp
index 4f6ac0a0029..75a56df1e9c 100644
--- a/test/CXX/special/class.temporary/p1.cpp
+++ b/test/CXX/special/class.temporary/p1.cpp
@@ -6,7 +6,7 @@ namespace test0 {
     int x;
     int y;
 
-    A(const A&) = delete; // expected-note {{function has been explicitly marked deleted here}}
+    A(const A&) = delete; // expected-note {{'A' has been explicitly marked deleted here}}
   };
 
   void foo(...);
diff --git a/test/Headers/ms-intrin.cpp b/test/Headers/ms-intrin.cpp
index 1bf134e7eac..6a6c2323556 100644
--- a/test/Headers/ms-intrin.cpp
+++ b/test/Headers/ms-intrin.cpp
@@ -18,7 +18,7 @@ void bar() {
   _WriteBarrier();      // expected-warning {{is deprecated: use other intrinsics or C++11 atomics instead}}
   // FIXME: It'd be handy if we didn't have to hardcode the line number in
   // intrin.h.
-  // expected-note@Intrin.h:754 {{declared here}}
-  // expected-note@Intrin.h:759 {{declared here}}
-  // expected-note@Intrin.h:764 {{declared here}}
+  // expected-note@Intrin.h:754 {{'_ReadWriteBarrier' has been explicitly marked deprecated here}}
+  // expected-note@Intrin.h:759 {{'_ReadBarrier' has been explicitly marked deprecated here}}
+  // expected-note@Intrin.h:764 {{'_WriteBarrier' has been explicitly marked deprecated here}}
 }
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 5e1139338b8..f61f7b45f1e 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -71,8 +71,8 @@ char x = FOO(a);
 typedef enum E { e1 };
 
 
-enum __declspec(deprecated) E2 { i, j, k }; // expected-note {{declared here}}
-__declspec(deprecated) enum E3 { a, b, c } e; // expected-note {{declared here}}
+enum __declspec(deprecated) E2 { i, j, k }; // expected-note {{'E2' has been explicitly marked deprecated here}}
+__declspec(deprecated) enum E3 { a, b, c } e; // expected-note {{'e' has been explicitly marked deprecated here}}
 
 void deprecated_enum_test(void)
 {
@@ -111,7 +111,7 @@ struct __declspec(unknown(12) deprecated) S6 {};	/* expected-warning {{unknown _
 
 struct S7 {
 	int foo() { return 12; }
-	__declspec(property(get=foo) deprecated) int t; // expected-note {{declared here}}
+	__declspec(property(get=foo) deprecated) int t; // expected-note {{'t' has been explicitly marked deprecated here}}
 };
 
 /* Technically, this is legal (though it does nothing) */
diff --git a/test/Sema/MicrosoftExtensions.c b/test/Sema/MicrosoftExtensions.c
index e672d05d090..4441f179736 100644
--- a/test/Sema/MicrosoftExtensions.c
+++ b/test/Sema/MicrosoftExtensions.c
@@ -87,11 +87,11 @@ typedef struct {
   AA; // expected-warning {{anonymous structs are a Microsoft extension}}
 } BB;
 
-__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' declared here}}
-struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{declared here}}
+__declspec(deprecated("This is deprecated")) enum DE1 { one, two } e1; // expected-note {{'e1' has been explicitly marked deprecated here}}
+struct __declspec(deprecated) DS1 { int i; float f; }; // expected-note {{'DS1' has been explicitly marked deprecated here}}
 
 #define MY_TEXT		"This is also deprecated"
-__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' declared here}}
+__declspec(deprecated(MY_TEXT)) void Dfunc1( void ) {} // expected-note {{'Dfunc1' has been explicitly marked deprecated here}}
 
 struct __declspec(deprecated(123)) DS2 {};	// expected-error {{'deprecated' attribute requires a string}}
 
diff --git a/test/Sema/attr-availability-ios.c b/test/Sema/attr-availability-ios.c
index 329068cf16b..6462d58beec 100644
--- a/test/Sema/attr-availability-ios.c
+++ b/test/Sema/attr-availability-ios.c
@@ -1,14 +1,14 @@
 // RUN: %clang_cc1 "-triple" "x86_64-apple-ios3.0" -fsyntax-only -verify %s
 
-void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' declared here}}
+void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}}
 void f1(int) __attribute__((availability(ios,introduced=2.1)));
-void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' declared here}}
+void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}}
 void f3(int) __attribute__((availability(ios,introduced=3.0)));
 void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
 
-void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' declared here}}
+void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}}
 void f6(int) __attribute__((availability(ios,deprecated=3.0)));
-void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' declared here}}
+void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
 
 void test() {
   f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
diff --git a/test/Sema/attr-availability-macosx.c b/test/Sema/attr-availability-macosx.c
index 468e9303e70..38f149ba62a 100644
--- a/test/Sema/attr-availability-macosx.c
+++ b/test/Sema/attr-availability-macosx.c
@@ -2,10 +2,10 @@
 
 void f0(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.6)));
 void f1(int) __attribute__((availability(macosx,introduced=10.5)));
-void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' declared here}}
+void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5))); // expected-note {{'f2' has been explicitly marked deprecated here}}
 void f3(int) __attribute__((availability(macosx,introduced=10.6)));
 void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}}
-void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{function has been explicitly marked unavailable here}}
+void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}}
 
 void test() {
   f0(0);
diff --git a/test/Sema/attr-availability.c b/test/Sema/attr-availability.c
index ac6a187591b..b7a8e6ef0f5 100644
--- a/test/Sema/attr-availability.c
+++ b/test/Sema/attr-availability.c
@@ -8,10 +8,10 @@ void f3() __attribute__((availability(otheros,introduced=2.2))); // expected-war
 
 // rdar://10095131
 extern void 
-ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' declared here}}
+ATSFontGetName(const char *oName) __attribute__((availability(macosx,introduced=8.0,deprecated=9.0, message="use CTFontCopyFullName"))); // expected-note {{'ATSFontGetName' has been explicitly marked deprecated here}}
 
 extern void
-ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{function has been explicitly marked unavailable here}}
+ATSFontGetPostScriptName(int flags) __attribute__((availability(macosx,introduced=8.0,obsoleted=9.0, message="use ATSFontGetFullPostScriptName"))); // expected-note {{'ATSFontGetPostScriptName' has been explicitly marked unavailable here}}
 
 void test_10095131() {
   ATSFontGetName("Hello"); // expected-warning {{'ATSFontGetName' is deprecated: first deprecated in OS X 9.0 - use CTFontCopyFullName}}
diff --git a/test/Sema/attr-cleanup.c b/test/Sema/attr-cleanup.c
index f5cbc385c68..26f283a1a4f 100644
--- a/test/Sema/attr-cleanup.c
+++ b/test/Sema/attr-cleanup.c
@@ -38,7 +38,7 @@ void t4() {
   __attribute((cleanup(c4))) void* g;
 }
 
-void c5(void*) __attribute__((deprecated));  // expected-note{{'c5' declared here}}
+void c5(void*) __attribute__((deprecated));  // expected-note{{'c5' has been explicitly marked deprecated here}}
 void t5() {
   int i __attribute__((cleanup(c5)));  // expected-warning {{'c5' is deprecated}}
 }
diff --git a/test/Sema/attr-deprecated-message.c b/test/Sema/attr-deprecated-message.c
index f48d13e607d..c68306132c3 100644
--- a/test/Sema/attr-deprecated-message.c
+++ b/test/Sema/attr-deprecated-message.c
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 %s -verify -fsyntax-only
 // rdar: // 6734520
 
-typedef int INT1 __attribute__((deprecated("Please avoid INT1"))); // expected-note 3 {{'INT1' declared here}}
+typedef int INT1 __attribute__((deprecated("Please avoid INT1"))); // expected-note 3 {{'INT1' has been explicitly marked deprecated here}}
 
 typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
 
@@ -12,16 +12,16 @@ typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));
 INT1 should_be_unavailable; // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
 INT1a should_not_be_deprecated;
 
-INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); // expected-note {{'f1' declared here}}
+INT1 f1(void) __attribute__ ((deprecated("Please avoid f1"))); // expected-note {{'f1' has been explicitly marked deprecated here}}
 INT1 f2(void); // expected-warning {{'INT1' is deprecated: Please avoid INT1}}
 
-typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color"))); // expected-note {{'Color' declared here}}
+typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color"))); // expected-note {{'Color' has been explicitly marked deprecated here}}
  
 
 Color c1; // expected-warning {{'Color' is deprecated: Please avoid Color}}
 
 int g1;
-int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' declared here}}
+int g2 __attribute__ ((deprecated("Please avoid g2"))); // expected-note {{'g2' has been explicitly marked deprecated here}}
 
 int func1()
 {
diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c
index 8124ab0ddd0..c9e3dd546c5 100644
--- a/test/Sema/attr-deprecated.c
+++ b/test/Sema/attr-deprecated.c
@@ -1,10 +1,10 @@
 // RUN: %clang_cc1 %s -verify -fsyntax-only
 
-int f() __attribute__((deprecated)); // expected-note 2 {{declared here}}
+int f() __attribute__((deprecated)); // expected-note 2 {{'f' has been explicitly marked deprecated here}}
 void g() __attribute__((deprecated));
-void g(); // expected-note {{declared here}}
+void g(); // expected-note {{'g' has been explicitly marked deprecated here}}
 
-extern int var __attribute__((deprecated)); // expected-note {{declared here}}
+extern int var __attribute__((deprecated)); // expected-note {{'var' has been explicitly marked deprecated here}}
 
 int a() {
   int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
@@ -17,13 +17,13 @@ int a() {
 }
 
 // test if attributes propagate to variables
-extern int var; // expected-note {{declared here}}
+extern int var; // expected-note {{'var' has been explicitly marked deprecated here}}
 int w() {
   return var; // expected-warning {{'var' is deprecated}}
 }
 
 int old_fn() __attribute__ ((deprecated));
-int old_fn(); // expected-note {{declared here}}
+int old_fn(); // expected-note {{'old_fn' has been explicitly marked deprecated here}}
 int (*fn_ptr)() = old_fn; // expected-warning {{'old_fn' is deprecated}}
 
 int old_fn() {
@@ -32,7 +32,7 @@ int old_fn() {
 
 
 struct foo {
-  int x __attribute__((deprecated)); // expected-note 3 {{declared here}}
+  int x __attribute__((deprecated)); // expected-note 3 {{'x' has been explicitly marked deprecated here}}
 };
 
 void test1(struct foo *F) {
@@ -41,11 +41,11 @@ void test1(struct foo *F) {
   struct foo f2 = { 17 }; // expected-warning {{'x' is deprecated}}
 }
 
-typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 12 {{declared here}}
+typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 12 {{'foo_dep' has been explicitly marked deprecated here}}
 foo_dep *test2;    // expected-warning {{'foo_dep' is deprecated}}
 
 struct __attribute__((deprecated, 
-                      invalid_attribute)) bar_dep ;  // expected-warning {{unknown attribute 'invalid_attribute' ignored}} expected-note 2 {{declared here}}
+                      invalid_attribute)) bar_dep ;  // expected-warning {{unknown attribute 'invalid_attribute' ignored}} expected-note 2 {{'bar_dep' has been explicitly marked deprecated here}}
 
 struct bar_dep *test3;   // expected-warning {{'bar_dep' is deprecated}}
 
@@ -102,9 +102,9 @@ foo_dep test17, // expected-warning {{'foo_dep' is deprecated}}
         test19;
 
 // rdar://problem/8518751
-enum __attribute__((deprecated)) Test20 { // expected-note {{declared here}}
-  test20_a __attribute__((deprecated)), // expected-note {{declared here}}
-  test20_b // expected-note {{declared here}}
+enum __attribute__((deprecated)) Test20 { // expected-note {{'Test20' has been explicitly marked deprecated here}}
+  test20_a __attribute__((deprecated)), // expected-note {{'test20_a' has been explicitly marked deprecated here}}
+  test20_b // expected-note {{'test20_b' has been explicitly marked deprecated here}}
 };
 void test20() {
   enum Test20 f; // expected-warning {{'Test20' is deprecated}}
@@ -122,5 +122,5 @@ struct test22 {
 };
 
 typedef int test23_ty __attribute((deprecated)); // expected-note {{previous definition is here}}
-typedef int test23_ty; // expected-note {{'test23_ty' declared here}} expected-warning {{redefinition of typedef 'test23_ty' is a C11 feature}}
+typedef int test23_ty; // expected-note {{'test23_ty' has been explicitly marked deprecated here}} expected-warning {{redefinition of typedef 'test23_ty' is a C11 feature}}
 test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}
diff --git a/test/Sema/attr-unavailable-message.c b/test/Sema/attr-unavailable-message.c
index ebdf945867f..400a2c63288 100644
--- a/test/Sema/attr-unavailable-message.c
+++ b/test/Sema/attr-unavailable-message.c
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 // rdar: //6734520
 
-int foo(int)  __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{function has been explicitly marked unavailable here}}
-double dfoo(double)  __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{function has been explicitly marked unavailable here}}
+int foo(int)  __attribute__((__unavailable__("USE IFOO INSTEAD"))); // expected-note {{'foo' has been explicitly marked unavailable here}}
+double dfoo(double)  __attribute__((__unavailable__("NO LONGER"))); // expected-note 2 {{'dfoo' has been explicitly marked unavailable here}}
 
 void bar() __attribute__((__unavailable__)); // expected-note {{explicitly marked unavailable}}
 
@@ -34,13 +34,13 @@ void unavail(void) {
 
 // rdar://10201690
 enum foo {
-    a = 1, // expected-note {{declared here}}
-    b __attribute__((deprecated())) = 2, // expected-note {{declared here}}
+    a = 1, // expected-note {{'a' has been explicitly marked deprecated here}}
+    b __attribute__((deprecated())) = 2, // expected-note {{'b' has been explicitly marked deprecated here}}
     c = 3
 }__attribute__((deprecated()));
 
-enum fee { // expected-note {{declaration has been explicitly marked unavailable here}}
-    r = 1, // expected-note {{declaration has been explicitly marked unavailable here}}
+enum fee { // expected-note {{'fee' has been explicitly marked unavailable here}}
+    r = 1, // expected-note {{'r' has been explicitly marked unavailable here}}
     s = 2,
     t = 3
 }__attribute__((unavailable()));
diff --git a/test/Sema/typeof-use-deprecated.c b/test/Sema/typeof-use-deprecated.c
index 1518c83701c..ba72b126d7c 100644
--- a/test/Sema/typeof-use-deprecated.c
+++ b/test/Sema/typeof-use-deprecated.c
@@ -1,25 +1,25 @@
 // RUN: %clang_cc1 %s -verify -fsyntax-only
 
-struct s { int a; } __attribute__((deprecated)) x;  // expected-warning {{'s' is deprecated}} expected-note 2 {{'s' declared here}}
+struct s { int a; } __attribute__((deprecated)) x;  // expected-warning {{'s' is deprecated}} expected-note 2 {{'s' has been explicitly marked deprecated here}}
 
 typeof(x) y;  // expected-warning {{'s' is deprecated}}
 
-union un{ int a; } __attribute__((deprecated)) u;  // expected-warning {{'un' is deprecated}} expected-note 2 {{'un' declared here}}
+union un{ int a; } __attribute__((deprecated)) u;  // expected-warning {{'un' is deprecated}} expected-note 2 {{'un' has been explicitly marked deprecated here}}
 
 typeof(     u) z; // expected-warning {{'un' is deprecated}}
 
-enum E{ one} __attribute__((deprecated))  e; // expected-warning {{'E' is deprecated}} expected-note 2 {{'E' declared here}}
+enum E{ one} __attribute__((deprecated))  e; // expected-warning {{'E' is deprecated}} expected-note 2 {{'E' has been explicitly marked deprecated here}}
 
 typeof( e) w; // expected-warning {{'E' is deprecated}}
 
-struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' declared here}}
-typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' declared here}}
+struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
+typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' has been explicitly marked deprecated here}}
 bar x1;	// expected-warning {{'bar' is deprecated}}
 
 int main() { typeof(x1) y; }	// expected-warning {{'foo' is deprecated}}
 
 struct gorf { int x; };
-typedef struct gorf T __attribute__((deprecated));  // expected-note {{'T' declared here}}
+typedef struct gorf T __attribute__((deprecated));  // expected-note {{'T' has been explicitly marked deprecated here}}
 T t;	// expected-warning {{'T' is deprecated}}
 void wee() { typeof(t) y; }
 
diff --git a/test/SemaCXX/aggregate-initialization.cpp b/test/SemaCXX/aggregate-initialization.cpp
index 885bf703dc1..4e4177463f8 100644
--- a/test/SemaCXX/aggregate-initialization.cpp
+++ b/test/SemaCXX/aggregate-initialization.cpp
@@ -49,7 +49,7 @@ struct A {
   A(int);
   ~A();
   
-  A(const A&) = delete; // expected-note 2 {{function has been explicitly marked deleted here}}
+  A(const A&) = delete; // expected-note 2 {{'A' has been explicitly marked deleted here}}
 };
 
 struct B {
diff --git a/test/SemaCXX/attr-deprecated.cpp b/test/SemaCXX/attr-deprecated.cpp
index b3223f39979..d28eb75cca6 100644
--- a/test/SemaCXX/attr-deprecated.cpp
+++ b/test/SemaCXX/attr-deprecated.cpp
@@ -1,10 +1,10 @@
 // RUN: %clang_cc1 %s -verify -fexceptions
 class A {
-  void f() __attribute__((deprecated)); // expected-note 2 {{declared here}}
+  void f() __attribute__((deprecated)); // expected-note 2 {{'f' has been explicitly marked deprecated here}}
   void g(A* a);
   void h(A* a) __attribute__((deprecated));
 
-  int b __attribute__((deprecated)); // expected-note 2 {{declared here}}
+  int b __attribute__((deprecated)); // expected-note 2 {{'b' has been explicitly marked deprecated here}}
 };
 
 void A::g(A* a)
@@ -26,7 +26,7 @@ void A::h(A* a)
 }
 
 struct B {
-  virtual void f() __attribute__((deprecated)); // expected-note 4 {{declared here}}
+  virtual void f() __attribute__((deprecated)); // expected-note 4 {{'f' has been explicitly marked deprecated here}}
   void g();
 };
 
@@ -68,20 +68,20 @@ void f(D* d) {
 
 // Overloaded namespace members.
 namespace test1 {
-  void foo(int) __attribute__((deprecated)); // expected-note {{declared here}}
+  void foo(int) __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
   void test1() { foo(10); } // expected-warning {{deprecated}}
-  void foo(short) __attribute__((deprecated)); // expected-note {{declared here}}
+  void foo(short) __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
   void test2(short s) { foo(s); } // expected-warning {{deprecated}}
   void foo(long);
   void test3(long l) { foo(l); }
   struct A {
-    friend void foo(A*) __attribute__((deprecated)); // expected-note {{declared here}}
+    friend void foo(A*) __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
   };
   void test4(A *a) { foo(a); } // expected-warning {{deprecated}}
 
   namespace ns {
     struct Foo {};
-    void foo(const Foo &f) __attribute__((deprecated)); // expected-note {{declared here}}
+    void foo(const Foo &f) __attribute__((deprecated)); // expected-note {{'foo' has been explicitly marked deprecated here}}
   }
   void test5() {
     foo(ns::Foo()); // expected-warning {{deprecated}}
@@ -91,9 +91,9 @@ namespace test1 {
 // Overloaded class members.
 namespace test2 {
   struct A {
-    void foo(int) __attribute__((deprecated)); // expected-note 2 {{declared here}}
+    void foo(int) __attribute__((deprecated)); // expected-note 2 {{'foo' has been explicitly marked deprecated here}}
     void foo(long);
-    static void bar(int) __attribute__((deprecated)); // expected-note 3 {{declared here}}
+    static void bar(int) __attribute__((deprecated)); // expected-note 3 {{'bar' has been explicitly marked deprecated here}}
     static void bar(long);
 
     void test2(int i, long l);
@@ -120,12 +120,12 @@ namespace test2 {
 namespace test3 {
   struct A {
     void operator*(const A &);
-    void operator*(int) __attribute__((deprecated)); // expected-note {{declared here}}
+    void operator*(int) __attribute__((deprecated)); // expected-note {{'operator*' has been explicitly marked deprecated here}}
     void operator-(const A &) const;
   };
   void operator+(const A &, const A &);
-  void operator+(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
-  void operator-(const A &, int) __attribute__((deprecated)); // expected-note {{declared here}}
+  void operator+(const A &, int) __attribute__((deprecated)); // expected-note {{'operator+' has been explicitly marked deprecated here}}
+  void operator-(const A &, int) __attribute__((deprecated)); // expected-note {{'operator-' has been explicitly marked deprecated here}}
 
   void test() {
     A a, b;
@@ -143,9 +143,9 @@ namespace test4 {
   struct A {
     typedef void (*intfn)(int);
     typedef void (*unintfn)(unsigned);
-    operator intfn() __attribute__((deprecated)); // expected-note {{declared here}}
+    operator intfn() __attribute__((deprecated)); // expected-note {{'operator void (*)(int)' has been explicitly marked deprecated here}}
     operator unintfn();
-    void operator ()(A &) __attribute__((deprecated)); // expected-note {{declared here}}
+    void operator ()(A &) __attribute__((deprecated)); // expected-note {{'operator()' has been explicitly marked deprecated here}}
     void operator ()(const A &);
   };
 
@@ -163,7 +163,7 @@ namespace test4 {
 
 namespace test5 {
   struct A {
-    operator int() __attribute__((deprecated)); // expected-note 3 {{declared here}}
+    operator int() __attribute__((deprecated)); // expected-note 3 {{'operator int' has been explicitly marked deprecated here}}
     operator long();
   };
   void test1(A a) {
@@ -193,8 +193,8 @@ namespace test5 {
 
 // rdar://problem/8518751
 namespace test6 {
-  enum __attribute__((deprecated)) A { // expected-note {{declared here}}
-    a0 // expected-note {{declared here}}
+  enum __attribute__((deprecated)) A { // expected-note {{'A' has been explicitly marked deprecated here}}
+    a0 // expected-note {{'a0' has been explicitly marked deprecated here}}
   };
   void testA() {
     A x; // expected-warning {{'A' is deprecated}}
@@ -202,7 +202,7 @@ namespace test6 {
   }
   
   enum B {
-    b0 __attribute__((deprecated)), // expected-note {{declared here}}
+    b0 __attribute__((deprecated)), // expected-note {{'b0' has been explicitly marked deprecated here}}
     b1
   };
   void testB() {
@@ -212,8 +212,8 @@ namespace test6 {
   }
 
   template <class T> struct C {
-    enum __attribute__((deprecated)) Enum { // expected-note {{declared here}}
-      c0 // expected-note {{declared here}}
+    enum __attribute__((deprecated)) Enum { // expected-note {{'Enum' has been explicitly marked deprecated here}}
+      c0 // expected-note {{'c0' has been explicitly marked deprecated here}}
     };
   };
   void testC() {
@@ -224,7 +224,7 @@ namespace test6 {
   template <class T> struct D {
     enum Enum {
       d0,
-      d1 __attribute__((deprecated)), // expected-note {{declared here}}
+      d1 __attribute__((deprecated)), // expected-note {{'d1' has been explicitly marked deprecated here}}
     };
   };
   void testD() {
@@ -236,8 +236,8 @@ namespace test6 {
 
 namespace test7 {
   struct X {
-    void* operator new(typeof(sizeof(void*))) __attribute__((deprecated));  // expected-note{{'operator new' declared here}}
-    void operator delete(void *) __attribute__((deprecated));  // expected-note{{'operator delete' declared here}}
+    void* operator new(typeof(sizeof(void*))) __attribute__((deprecated));  // expected-note{{'operator new' has been explicitly marked deprecated here}}
+    void operator delete(void *) __attribute__((deprecated));  // expected-note{{'operator delete' has been explicitly marked deprecated here}}
   };
 
   void test() {
@@ -247,6 +247,6 @@ namespace test7 {
 
 // rdar://problem/15044218
 typedef struct TDS {
-} TDS __attribute__((deprecated)); // expected-note {{'TDS' declared here}}
+} TDS __attribute__((deprecated)); // expected-note {{'TDS' has been explicitly marked deprecated here}}
 TDS tds; // expected-warning {{'TDS' is deprecated}}
 struct TDS tds2; // no warning, attribute only applies to the typedef.
diff --git a/test/SemaCXX/attr-unavailable.cpp b/test/SemaCXX/attr-unavailable.cpp
index 2d82668a205..51dc8fe3789 100644
--- a/test/SemaCXX/attr-unavailable.cpp
+++ b/test/SemaCXX/attr-unavailable.cpp
@@ -3,7 +3,7 @@
 int &foo(int); // expected-note {{candidate}}
 double &foo(double); // expected-note {{candidate}}
 void foo(...) __attribute__((__unavailable__)); // expected-note {{candidate function}} \
-// expected-note{{function has been explicitly marked unavailable here}}
+// expected-note{{'foo' has been explicitly marked unavailable here}}
 
 void bar(...) __attribute__((__unavailable__)); // expected-note 2{{explicitly marked unavailable}}
 
@@ -37,3 +37,22 @@ void unavail(short* sp) {
   foo(sp);
   foo();
 }
+
+// Show that delayed processing of 'unavailable' is the same
+// delayed process for 'deprecated'.
+// <rdar://problem/12241361> and <rdar://problem/15584219>
+enum DeprecatedEnum { DE_A, DE_B } __attribute__((deprecated)); // expected-note {{'DeprecatedEnum' has been explicitly marked deprecated here}}
+__attribute__((deprecated)) typedef enum DeprecatedEnum DeprecatedEnum;
+typedef enum DeprecatedEnum AnotherDeprecatedEnum; // expected-warning {{'DeprecatedEnum' is deprecated}}
+
+__attribute__((deprecated))
+DeprecatedEnum testDeprecated(DeprecatedEnum X) { return X; }
+
+
+enum UnavailableEnum { UE_A, UE_B } __attribute__((unavailable)); // expected-note {{'UnavailableEnum' has been explicitly marked unavailable here}}
+__attribute__((unavailable)) typedef enum UnavailableEnum UnavailableEnum;
+typedef enum UnavailableEnum AnotherUnavailableEnum; // expected-error {{'UnavailableEnum' is unavailable}}
+
+
+__attribute__((unavailable))
+UnavailableEnum testUnavailable(UnavailableEnum X) { return X; }
diff --git a/test/SemaCXX/cxx0x-delegating-ctors.cpp b/test/SemaCXX/cxx0x-delegating-ctors.cpp
index a34ee4fcb02..2e1abf53ae9 100644
--- a/test/SemaCXX/cxx0x-delegating-ctors.cpp
+++ b/test/SemaCXX/cxx0x-delegating-ctors.cpp
@@ -43,7 +43,7 @@ foo::foo (void*) : foo(4.0f) {
 }
 
 struct deleted_dtor {
-  ~deleted_dtor() = delete; // expected-note{{function has been explicitly marked deleted here}}
+  ~deleted_dtor() = delete; // expected-note{{'~deleted_dtor' has been explicitly marked deleted here}}
   deleted_dtor();
   deleted_dtor(int) : deleted_dtor() // expected-error{{attempt to use a deleted function}}
   {}
diff --git a/test/SemaCXX/deleted-function.cpp b/test/SemaCXX/deleted-function.cpp
index e78e7edc719..d7ef9b263d8 100644
--- a/test/SemaCXX/deleted-function.cpp
+++ b/test/SemaCXX/deleted-function.cpp
@@ -15,9 +15,9 @@ void ov(int) {} // expected-note {{candidate function}}
 void ov(double) = delete; // expected-note {{candidate function has been explicitly deleted}}
 
 struct WithDel {
-  WithDel() = delete; // expected-note {{function has been explicitly marked deleted here}}
-  void fn() = delete; // expected-note {{function has been explicitly marked deleted here}}
-  operator int() = delete; // expected-note {{function has been explicitly marked deleted here}}
+  WithDel() = delete; // expected-note {{'WithDel' has been explicitly marked deleted here}}
+  void fn() = delete; // expected-note {{'fn' has been explicitly marked deleted here}}
+  operator int() = delete; // expected-note {{'operator int' has been explicitly marked deleted here}}
   void operator +(int) = delete;
 
   int i = delete; // expected-error {{only functions can have deleted definitions}}
diff --git a/test/SemaCXX/for-range-dereference.cpp b/test/SemaCXX/for-range-dereference.cpp
index bf3187da30e..7377199024e 100644
--- a/test/SemaCXX/for-range-dereference.cpp
+++ b/test/SemaCXX/for-range-dereference.cpp
@@ -11,7 +11,7 @@ struct NoBegin {
 
 struct DeletedEnd : public T {
   Data *begin();
-  Data *end() = delete; //expected-note {{function has been explicitly marked deleted here}}
+  Data *end() = delete; //expected-note {{'end' has been explicitly marked deleted here}}
 };
 
 struct DeletedADLBegin { };
diff --git a/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp b/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
index 710a5dbde02..ed97a1df548 100644
--- a/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
+++ b/test/SemaCXX/microsoft-dtor-lookup-cxx11.cpp
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -triple i686-pc-win32 -cxx-abi microsoft -std=c++11 -verify %s
 
 struct S {
-  virtual ~S() = delete; // expected-note {{function has been explicitly marked deleted here}}
+  virtual ~S() = delete; // expected-note {{'~S' has been explicitly marked deleted here}}
   void operator delete(void*, int);
   void operator delete(void*, double);
 } s; // expected-error {{attempt to use a deleted function}}
diff --git a/test/SemaCXX/rval-references-examples.cpp b/test/SemaCXX/rval-references-examples.cpp
index 110ae26fb5d..8a5b562bbb9 100644
--- a/test/SemaCXX/rval-references-examples.cpp
+++ b/test/SemaCXX/rval-references-examples.cpp
@@ -4,7 +4,7 @@ template<typename T>
 class unique_ptr {
   T *ptr;
 
-  unique_ptr(const unique_ptr&) = delete; // expected-note 3{{function has been explicitly marked deleted here}}
+  unique_ptr(const unique_ptr&) = delete; // expected-note 3{{'unique_ptr' has been explicitly marked deleted here}}
   unique_ptr &operator=(const unique_ptr&) = delete; // expected-note{{candidate function has been explicitly deleted}}
 public:
   unique_ptr() : ptr(0) { }
diff --git a/test/SemaObjC/arc-unavailable-system-function.m b/test/SemaObjC/arc-unavailable-system-function.m
index b0b70db641c..54ceaafbd69 100644
--- a/test/SemaObjC/arc-unavailable-system-function.m
+++ b/test/SemaObjC/arc-unavailable-system-function.m
@@ -3,7 +3,7 @@
 
 # 1 "<command line>"
 # 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
-id * foo(); // expected-note {{function has been explicitly marked unavailable here}}
+id * foo(); // expected-note {{'foo' has been explicitly marked unavailable here}}
 
 # 1 "arc-unavailable-system-function.m" 2
 void ret() {
diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m
index fddcd506d44..7990b1202e8 100644
--- a/test/SemaObjC/attr-availability.m
+++ b/test/SemaObjC/attr-availability.m
@@ -1,11 +1,11 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -fsyntax-only -verify %s
 
 @protocol P
-- (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{method 'proto_method' declared here}}
+- (void)proto_method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note 2 {{'proto_method' has been explicitly marked deprecated here}}
 @end
 
 @interface A <P>
-- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
+- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{'method' has been explicitly marked deprecated here}}
 
 - (void)overridden __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}}
 - (void)overridden2 __attribute__((availability(macosx,introduced=10.3)));
@@ -37,7 +37,7 @@ void f(A *a, B *b) {
 // using a deprecated method when that method is re-implemented in a
 // subclass where the redeclared method is not deprecated.
 @interface C
-- (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
+- (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{'method' has been explicitly marked deprecated here}}
 @end
 
 @interface D : C
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index cf2e063762c..9dba48eced7 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -2,10 +2,10 @@
 // RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify -Wno-objc-root-class %s
 
 @interface A {
-  int X __attribute__((deprecated)); // expected-note 2 {{declared here}}
+  int X __attribute__((deprecated)); // expected-note 2 {{'X' has been explicitly marked deprecated here}}
 }
-+ (void)F __attribute__((deprecated)); // expected-note 2 {{declared here}}
-- (void)f __attribute__((deprecated)); // expected-note 4 {{declared here}}
++ (void)F __attribute__((deprecated)); // expected-note 2 {{'F' has been explicitly marked deprecated here}}
+- (void)f __attribute__((deprecated)); // expected-note 4 {{'f' has been explicitly marked deprecated here}}
 @end
 
 @implementation A
@@ -43,7 +43,7 @@
 @end
 
 @protocol P
-- (void)p __attribute__((deprecated)); // expected-note {{declared here}}
+- (void)p __attribute__((deprecated)); // expected-note {{'p' has been explicitly marked deprecated here}}
 @end
 
 void t1(A *a)
@@ -72,7 +72,7 @@ void t4(Class c)
 
 @interface Bar 
 
-@property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); // expected-note 2 {{declared here}}
+@property (assign, setter = MySetter:) int FooBar __attribute__ ((deprecated)); // expected-note 2 {{'FooBar' has been explicitly marked deprecated here}}
 - (void) MySetter : (int) value;
 @end
 
@@ -84,7 +84,7 @@ int t5() {
 
 
 __attribute ((deprecated))  
-@interface DEPRECATED { // expected-note 2 {{declared here}}
+@interface DEPRECATED { // expected-note 2 {{'DEPRECATED' has been explicitly marked deprecated here}}
   @public int ivar; 
   DEPRECATED *ivar2; // no warning.
 } 
@@ -108,8 +108,8 @@ __attribute ((deprecated))
 
 
 @interface Test2
-@property int test2 __attribute__((deprecated)); // expected-note 4 {{declared here}} \
-						 // expected-note 2 {{property 'test2' is declared deprecated here}}
+@property int test2 __attribute__((deprecated)); // expected-note 2 {{property 'test2' is declared deprecated here}} expected-note 3 {{'test2' has been explicitly marked deprecated here}} \
+						 // expected-note {{'setTest2:' has been explicitly marked deprecated here}}
 @end
 
 void test(Test2 *foo) {
@@ -127,7 +127,7 @@ __attribute__((deprecated))
 
 typedef struct {
 	int x;
-} footype __attribute((deprecated)); // expected-note 2 {{declared here}}
+} footype __attribute((deprecated)); // expected-note 2 {{'footype' has been explicitly marked deprecated here}}
 
 @interface foo {
 	footype a; // expected-warning {{'footype' is deprecated}}
@@ -142,7 +142,7 @@ typedef struct {
 +(void)cmeth;
 @end
 
-typedef NewI DeprI __attribute__((deprecated("blah"))); // expected-note 4 {{'DeprI' declared here}}
+typedef NewI DeprI __attribute__((deprecated("blah"))); // expected-note 4 {{'DeprI' has been explicitly marked deprecated here}}
 
 @interface SI : DeprI // expected-warning {{'DeprI' is deprecated: blah}}
 -(DeprI*)meth; // expected-warning {{'DeprI' is deprecated: blah}}
diff --git a/test/SemaObjC/class-unavail-warning.m b/test/SemaObjC/class-unavail-warning.m
index b2bd3883110..a337c97ec08 100644
--- a/test/SemaObjC/class-unavail-warning.m
+++ b/test/SemaObjC/class-unavail-warning.m
@@ -2,7 +2,7 @@
 // rdar://9092208
 
 __attribute__((unavailable("not available")))
-@interface MyClass { // expected-note 8 {{declaration has been explicitly marked unavailable here}}
+@interface MyClass { // expected-note 8 {{'MyClass' has been explicitly marked unavailable here}}
 @public
     void *_test;
     MyClass *ivar; // no error.
diff --git a/test/SemaObjC/property-deprecated-warning.m b/test/SemaObjC/property-deprecated-warning.m
index 7e10356ac57..c89edb94208 100644
--- a/test/SemaObjC/property-deprecated-warning.m
+++ b/test/SemaObjC/property-deprecated-warning.m
@@ -5,7 +5,7 @@
 typedef signed char BOOL;
 
 @protocol P
-@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} expected-note {{method 'ptarget' declared here}}
+@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} expected-note {{'ptarget' has been explicitly marked deprecated here}}
 @end
 
 @protocol P1<P>
@@ -14,7 +14,7 @@ typedef signed char BOOL;
 
 
 @interface UITableViewCell<P1>
-@property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}} expected-note {{method 'setTarget:' declared here}}
+@property(nonatomic,assign) id target __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'target' is declared deprecated here}} expected-note {{'setTarget:' has been explicitly marked deprecated here}}
 @end
 
 @interface PSTableCell : UITableViewCell
@@ -22,9 +22,9 @@ typedef signed char BOOL;
 @end
 
 @interface UITableViewCell(UIDeprecated)
-@property(nonatomic,assign) id dep_target  __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{method 'dep_target' declared here}} \
+@property(nonatomic,assign) id dep_target  __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{'dep_target' has been explicitly marked deprecated here}} \
                                                                                     // expected-note 4 {{property 'dep_target' is declared deprecated here}} \
-                                                                                    // expected-note 2 {{method 'setDep_target:' declared here}}
+                                                                                    // expected-note 2 {{'setDep_target:' has been explicitly marked deprecated here}}
 @end
 
 @implementation PSTableCell
@@ -55,9 +55,9 @@ typedef signed char BOOL;
 
 
 @interface CustomAccessorNames
-@property(getter=isEnabled,assign) BOOL enabled __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'isEnabled' declared here}} expected-note {{property 'enabled' is declared deprecated here}}
+@property(getter=isEnabled,assign) BOOL enabled __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'isEnabled' has been explicitly marked deprecated here}} expected-note {{property 'enabled' is declared deprecated here}}
 
-@property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{method 'setNewDelegate:' declared here}} expected-note {{property 'delegate' is declared deprecated here}}
+@property(setter=setNewDelegate:,assign) id delegate __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'setNewDelegate:' has been explicitly marked deprecated here}} expected-note {{property 'delegate' is declared deprecated here}}
 @end
 
 void testCustomAccessorNames(CustomAccessorNames *obj) {
diff --git a/test/SemaObjC/property-noninherited-availability-attr.m b/test/SemaObjC/property-noninherited-availability-attr.m
index f53a1a61d53..793ceb6dc08 100644
--- a/test/SemaObjC/property-noninherited-availability-attr.m
+++ b/test/SemaObjC/property-noninherited-availability-attr.m
@@ -5,13 +5,12 @@
 
 @interface NSObject @end
 @protocol myProtocol
-@property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{method 'myProtocolProperty' declared here}} \
+@property int myProtocolProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8))); // expected-note {{'myProtocolProperty' has been explicitly marked deprecated here}} \
                                                                                                         // expected-note {{property 'myProtocolProperty' is declared deprecated here}}
 @end
 
 @interface Foo : NSObject
-@property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8)));  // expected-note {{'myProperty' declared here}} \
-								// expected-note {{method 'myProperty' declared here}} \
+@property int myProperty __attribute__((availability(macosx,introduced=10.7,deprecated=10.8)));  // expected-note 2 {{'myProperty' has been explicitly marked deprecated here}} \
 								// expected-note {{property 'myProperty' is declared deprecated here}}
 @end
 
diff --git a/test/SemaObjC/protocol-attribute.m b/test/SemaObjC/protocol-attribute.m
index b2aecc209f1..52bd44110fc 100644
--- a/test/SemaObjC/protocol-attribute.m
+++ b/test/SemaObjC/protocol-attribute.m
@@ -6,7 +6,7 @@ __attribute ((unavailable))
 Class <FwProto> cFw = 0;  // expected-error {{'FwProto' is unavailable}}
 
 
-__attribute ((deprecated)) @protocol MyProto1 // expected-note 7 {{declared here}}
+__attribute ((deprecated)) @protocol MyProto1 // expected-note 7 {{'MyProto1' has been explicitly marked deprecated here}}
 @end
 
 @protocol Proto2  <MyProto1>  // expected-warning {{'MyProto1' is deprecated}}
diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m
index a179647ebcc..29e215348b7 100644
--- a/test/SemaObjC/special-dep-unavail-warning.m
+++ b/test/SemaObjC/special-dep-unavail-warning.m
@@ -4,30 +4,30 @@
 @interface B
 - (void) depInA;
 - (void) unavailMeth __attribute__((unavailable)); // expected-note {{has been explicitly marked unavailable here}}
-- (void) depInA1 __attribute__((deprecated));
+- (void) depInA1 __attribute__((deprecated)); // expected-note {{'depInA1' has been explicitly marked deprecated here}}
 - (void) unavailMeth1;
-- (void) depInA2 __attribute__((deprecated));
+- (void) depInA2 __attribute__((deprecated)); // expected-note {{'depInA2' has been explicitly marked deprecated here}}
 - (void) unavailMeth2 __attribute__((unavailable)); // expected-note {{has been explicitly marked unavailable here}}
 - (void) depunavailInA;
 - (void) depunavailInA1 __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{has been explicitly marked unavailable here}}
-- (void)FuzzyMeth __attribute__((deprecated));
+- (void)FuzzyMeth __attribute__((deprecated)); // expected-note {{'FuzzyMeth' has been explicitly marked deprecated here}}
 - (void)FuzzyMeth1 __attribute__((unavailable));
 @end
 
 @interface A
 - (void) unavailMeth1 __attribute__((unavailable)); // expected-note {{has been explicitly marked unavailable here}}
-- (void) depInA __attribute__((deprecated));
+- (void) depInA __attribute__((deprecated)); // expected-note {{'depInA' has been explicitly marked deprecated here}}
 - (void) depInA2 __attribute__((deprecated));
 - (void) depInA1;
 - (void) unavailMeth2 __attribute__((unavailable)); 
 - (void) depunavailInA __attribute__((deprecated)) __attribute__((unavailable)); // expected-note {{has been explicitly marked unavailable here}}
 - (void) depunavailInA1;
 - (void)FuzzyMeth __attribute__((unavailable));
-- (void)FuzzyMeth1 __attribute__((deprecated));
+- (void)FuzzyMeth1 __attribute__((deprecated)); // expected-note {{'FuzzyMeth1' has been explicitly marked deprecated here}}
 @end
 
 
-@class C;	// expected-note 5 {{forward declaration of class here}}
+@class C;	// expected-note 10 {{forward declaration of class here}}
 
 void test(C *c) {
   [c depInA]; // expected-warning {{'depInA' maybe deprecated because receiver type is unknown}}
@@ -45,7 +45,7 @@ void test(C *c) {
 
 // rdar://10268422
 __attribute ((deprecated))
-@interface DEPRECATED // expected-note {{declared here}}
+@interface DEPRECATED // expected-note {{'DEPRECATED' has been explicitly marked deprecated here}}
 +(id)new;
 @end
 
diff --git a/test/SemaObjC/warn-deprecated-implementations.m b/test/SemaObjC/warn-deprecated-implementations.m
index f63962f9618..e346fbebec9 100644
--- a/test/SemaObjC/warn-deprecated-implementations.m
+++ b/test/SemaObjC/warn-deprecated-implementations.m
@@ -29,7 +29,7 @@
 @end
 
 __attribute__((deprecated))
-@interface CL // expected-note 2 {{class declared here}} // expected-note 2 {{declared here}}
+@interface CL // expected-note 2 {{class declared here}} // expected-note 2 {{'CL' has been explicitly marked deprecated here}}
 @end
 
 @implementation CL // expected-warning {{Implementing deprecated class}}
diff --git a/test/SemaObjC/warn-forward-class-attr-deprecated.m b/test/SemaObjC/warn-forward-class-attr-deprecated.m
index 854ff699eed..ba365ba5e45 100644
--- a/test/SemaObjC/warn-forward-class-attr-deprecated.m
+++ b/test/SemaObjC/warn-forward-class-attr-deprecated.m
@@ -4,7 +4,7 @@
 @class ABGroupImportFilesScope; // expected-note {{forward declaration of class here}}
 
 @interface I1
-- (id) filenames __attribute__((deprecated));
+- (id) filenames __attribute__((deprecated)); // expected-note {{'filenames' has been explicitly marked deprecated here}}
 @end
 
 @interface I2
diff --git a/test/SemaObjC/warn-protocol-method-deprecated.m b/test/SemaObjC/warn-protocol-method-deprecated.m
index 928694db252..70dd394845c 100644
--- a/test/SemaObjC/warn-protocol-method-deprecated.m
+++ b/test/SemaObjC/warn-protocol-method-deprecated.m
@@ -3,7 +3,7 @@
 
 @protocol TestProtocol 
 - (void)newProtocolMethod;
-- (void)deprecatedProtocolMethod __attribute__((deprecated)); // expected-note 2 {{method 'deprecatedProtocolMethod' declared here}}
+- (void)deprecatedProtocolMethod __attribute__((deprecated)); // expected-note 2 {{'deprecatedProtocolMethod' has been explicitly marked deprecated here}}
 @end
 
 @interface NSObject @end
@@ -11,7 +11,7 @@
 @interface TestClass : NSObject <TestProtocol>
 
 - (void)newInstanceMethod;
-- (void)deprecatedInstanceMethod __attribute__((deprecated)); // expected-note {{method 'deprecatedInstanceMethod' declared here}}
+- (void)deprecatedInstanceMethod __attribute__((deprecated)); // expected-note {{'deprecatedInstanceMethod' has been explicitly marked deprecated here}}
 
 @end
 
diff --git a/test/SemaObjCXX/arc-system-header.mm b/test/SemaObjCXX/arc-system-header.mm
index 3358e5fc127..b97e2f3b1eb 100644
--- a/test/SemaObjCXX/arc-system-header.mm
+++ b/test/SemaObjCXX/arc-system-header.mm
@@ -6,4 +6,4 @@ void f(A* a) {
   a->data.void_ptr = 0;
   a->data.a_b.b = 0; // expected-error{{'a_b' is unavailable: this system field has retaining ownership}}
 }
-// expected-note@arc-system-header.h:10{{declaration has been explicitly marked unavailable here}}
+// expected-note@arc-system-header.h:10{{'a_b' has been explicitly marked unavailable here}}
-- 
GitLab