Improve diagnostics when an elaborated-type-specifer containing a
nested-name-specifier (e.g., "class T::foo") fails to find a tag
member in the scope nominated by the
nested-name-specifier. Previously, we gave a bland

  error: 'Nested' does not name a tag member in the specified scope

which didn't actually say where we were looking, which was rather
horrible when the nested-name-specifier was instantiated. Now, we give
something a bit better:

  error: no class named 'Nested' in 'NoDepBase<T>'




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100060 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index eef73d8..f3d0dcf 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4786,7 +4786,8 @@
       }
 
       // A tag 'foo::bar' must already exist.
-      Diag(NameLoc, diag::err_not_tag_in_scope) << Name << SS.getRange();
+      Diag(NameLoc, diag::err_not_tag_in_scope) 
+        << Kind << Name << DC << SS.getRange();
       Name = 0;
       Invalid = true;
       goto CreateNewDecl;
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 9777569..3375ccc 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -693,7 +693,8 @@
 
     if (!PrevClassTemplate && Qualifier) {
       SemaRef.Diag(Pattern->getLocation(), diag::err_not_tag_in_scope)
-        << Pattern->getDeclName() << Pattern->getQualifierRange();
+        << D->getTemplatedDecl()->getTagKind() << Pattern->getDeclName() << DC
+        << Pattern->getQualifierRange();
       return 0;
     }
 
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index b08447e..f9ffd3f 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -618,9 +618,9 @@
     }
 
     if (!Tag) {
-      // FIXME: Crummy diagnostic
+      // FIXME: Would be nice to highlight just the source range.
       SemaRef.Diag(SR.getEnd(), diag::err_not_tag_in_scope)
-        << Id << SR;
+        << Kind << Id << DC;
       return QualType();
     }