Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.

llvm-svn: 84028
diff --git a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
index 04129f8..a5877d2 100644
--- a/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
+++ b/clang/test/CXX/temp/temp.spec/temp.expl.spec/p18.cpp
@@ -9,12 +9,12 @@
 template<> template<class X>
 class A<long>::B { }; 
 
-// FIXME: If we make the explicit specialization of A<long>::B, above, into
-// a specialization of A<int>::B, our diagnostic is correct but not very 
-// helpful.
 template<> template<> template<class T>
   void A<int>::B<double>::mf1(T t) { } 
 
+template<> template<> template<class T>
+void A<long>::B<double>::mf1(T t) { } // expected-error{{does not match}}
+
 // FIXME: This diagnostic could probably be better.
 template<class Y> template<>
   void A<Y>::B<double>::mf2() { } // expected-error{{does not refer}}
diff --git a/clang/test/SemaCXX/missing-members.cpp b/clang/test/SemaCXX/missing-members.cpp
index 5fd4c54..28ad9a04 100644
--- a/clang/test/SemaCXX/missing-members.cpp
+++ b/clang/test/SemaCXX/missing-members.cpp
@@ -9,7 +9,7 @@
 
 void f() {
   A::B::i; // expected-error {{no member named 'i' in namespace 'A::B'}}
-  A::B::C::i; // expected-error {{no member named 'i' in class 'A::B::C'}}
+  A::B::C::i; // expected-error {{no member named 'i' in 'class A::B::C'}}
   ::i; // expected-error {{no member named 'i' in the global namespace}}
 }
 
@@ -19,18 +19,18 @@
 
 void g() {
   A::B::D::E; // expected-error {{no member named 'D' in namespace 'A::B'}}
-  B::B::C::D; // expected-error {{no member named 'C' in class 'B::B'}}
+  B::B::C::D; // expected-error {{no member named 'C' in 'class B::B'}}
   ::C::D; // expected-error {{no member named 'C' in the global namespace}}
 }
 
 int A::B::i = 10; // expected-error {{no member named 'i' in namespace 'A::B'}}
-int A::B::C::i = 10; // expected-error {{no member named 'i' in class 'A::B::C'}}
-int A::B::S::i = 10; // expected-error {{no member named 'i' in struct 'A::B::S'}}
-int A::B::U::i = 10; // expected-error {{no member named 'i' in union 'A::B::U'}}
+int A::B::C::i = 10; // expected-error {{no member named 'i' in 'class A::B::C'}}
+int A::B::S::i = 10; // expected-error {{no member named 'i' in 'struct A::B::S'}}
+int A::B::U::i = 10; // expected-error {{no member named 'i' in 'union A::B::U'}}
 
 using A::B::D; // expected-error {{no member named 'D' in namespace 'A::B'}}
 
 struct S : A::B::C { 
-  using A::B::C::f; // expected-error {{no member named 'f' in class 'A::B::C'}}
+  using A::B::C::f; // expected-error {{no member named 'f' in 'class A::B::C'}}
   
 };
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp
index ffb20d2..4ddf3bb 100644
--- a/clang/test/SemaCXX/nested-name-spec.cpp
+++ b/clang/test/SemaCXX/nested-name-spec.cpp
@@ -35,9 +35,9 @@
   int x;
 };
 
-void C2::m() const { } // expected-error{{out-of-line definition does not match any declaration in 'C2'}}
+void C2::m() const { } // expected-error{{out-of-line definition of 'm' does not match any declaration in 'class C2'}}
 
-void C2::f(int) { } // expected-error{{out-of-line definition does not match any declaration in 'C2'}}
+void C2::f(int) { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'class C2'}}
 
 void C2::m() {
   x = 0;
@@ -125,7 +125,7 @@
   operator bool();
 };
 
-Operators Operators::operator+(const Operators&) { // expected-error{{out-of-line definition does not match any declaration in 'Operators'}}
+Operators Operators::operator+(const Operators&) { // expected-error{{out-of-line definition of 'operator+' does not match any declaration in 'class Operators'}}
   Operators ops;
   return ops;
 }
@@ -143,13 +143,13 @@
   void g(int&); // expected-note{{member declaration nearly matches}}
 } 
 
-void A::f() {} // expected-error{{out-of-line definition does not match any declaration in 'A'}}
+void A::f() {} // expected-error{{out-of-line definition of 'f' does not match any declaration in namespace 'A'}}
 
-void A::g(const int&) { } // expected-error{{out-of-line definition does not match any declaration in 'A'}}
+void A::g(const int&) { } // expected-error{{out-of-line definition of 'g' does not match any declaration in namespace 'A'}}
 
 struct Struct { };
 
-void Struct::f() { } // expected-error{{out-of-line definition does not match any declaration in 'Struct'}}
+void Struct::f() { } // expected-error{{out-of-line definition of 'f' does not match any declaration in 'struct Struct'}}
 
 void global_func(int);
 void global_func2(int);
diff --git a/clang/test/SemaTemplate/typename-specifier.cpp b/clang/test/SemaTemplate/typename-specifier.cpp
index d3fca3e..62795eb 100644
--- a/clang/test/SemaTemplate/typename-specifier.cpp
+++ b/clang/test/SemaTemplate/typename-specifier.cpp
@@ -16,7 +16,7 @@
 int i;
 
 typename N::A::type *ip1 = &i;
-typename N::B::type *ip2 = &i; // expected-error{{ no type named 'type' in 'B'}}
+typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'struct N::B'}}
 typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}}
 
 void test(double d) {
@@ -33,7 +33,8 @@
 namespace N {
   template<typename T>
   struct X {
-    typedef typename T::type type; // expected-error 2{{no type named 'type' in 'B'}} \
+    typedef typename T::type type; // expected-error {{no type named 'type' in 'struct N::B'}} \
+    // expected-error {{no type named 'type' in 'struct B'}} \
     // FIXME: location info for error above isn't very good \
     // expected-error 2{{typename specifier refers to non-type member 'type'}} \
     // expected-error{{type 'int' cannot be used prior to '::' because it has no members}}