[cfe-commits] r154656 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp test/SemaCXX/nested-name-spec.cpp test/SemaCXX/qual-id-test.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu Apr 12 21:07:40 PDT 2012


Author: rsmith
Date: Thu Apr 12 23:07:40 2012
New Revision: 154656

URL: http://llvm.org/viewvc/llvm-project?rev=154656&view=rev
Log:
PR12500: Improve the wording of the diagnostic for a redefinition of a name
in the wrong namespace scope. Patch by Jonathan Sauer!

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
    cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
    cfe/trunk/test/SemaCXX/nested-name-spec.cpp
    cfe/trunk/test/SemaCXX/qual-id-test.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Apr 12 23:07:40 2012
@@ -4296,8 +4296,8 @@
 def err_expected_class_or_namespace : Error<"expected a class or namespace">;
 def err_expected_class : Error<"%0 is not a class%select{ or namespace|, "
   "namespace, or scoped enumeration}1">;
-def err_invalid_declarator_scope : Error<
-  "definition or redeclaration of %0 not in a namespace enclosing %1">;
+def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
+  "because namespace %1 does not enclose namespace %2">;
 def err_invalid_declarator_global_scope : Error<
   "definition or redeclaration of %0 cannot name the global scope">;
 def err_invalid_declarator_in_function : Error<

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Apr 12 23:07:40 2012
@@ -3307,7 +3307,7 @@
         << Name << SS.getRange();
     else
       Diag(Loc, diag::err_invalid_declarator_scope)
-      << Name << cast<NamedDecl>(DC) << SS.getRange();
+      << Name << cast<NamedDecl>(Cur) << cast<NamedDecl>(DC) << SS.getRange();
     
     return true;
   }

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp Thu Apr 12 23:07:40 2012
@@ -33,7 +33,7 @@
 template<> void N0::f0(int) { } // okay
 
 namespace N1 {
-  template<> void N0::f0(long) { } // expected-error{{not in a namespace enclosing}}
+  template<> void N0::f0(long) { } // expected-error{{does not enclose namespace}}
 }
 
 template<> void N0::f0(double) { }
@@ -129,7 +129,7 @@
 template<> float N0::X0<float>::member = 3.14f;
 
 namespace N1 {
-  template<> double N0::X0<double>::member = 3.14; // expected-error{{not in a namespace enclosing}}
+  template<> double N0::X0<double>::member = 3.14; // expected-error{{does not enclose namespace}}
 }
 
 //    -- member class of a class template
@@ -227,7 +227,7 @@
 
 namespace N1 {
   template<> template<>
-  void N0::X0<void*>::ft1(void *, long) { } // expected-error{{enclosing}}
+  void N0::X0<void*>::ft1(void *, long) { } // expected-error{{does not enclose namespace}}
 }
 
 

Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/p2.cpp Thu Apr 12 23:07:40 2012
@@ -33,7 +33,7 @@
 template<> void N0::f0(int) { } // okay
 
 namespace N1 {
-  template<> void N0::f0(long) { } // expected-error{{not in a namespace enclosing}}
+  template<> void N0::f0(long) { } // expected-error{{does not enclose namespace}}
 }
 
 template<> void N0::f0(double); // expected-warning{{C++11 extension}}
@@ -130,7 +130,7 @@
 template<> float N0::X0<float>::member = 3.14f;
 
 namespace N1 {
-  template<> double N0::X0<double>::member = 3.14; // expected-error{{not in a namespace enclosing}}
+  template<> double N0::X0<double>::member = 3.14; // expected-error{{does not enclose namespace}}
 }
 
 //    -- member class of a class template
@@ -228,7 +228,7 @@
 
 namespace N1 {
   template<> template<>
-  void N0::X0<void*>::ft1(void *, long) { } // expected-error{{enclosing}}
+  void N0::X0<void*>::ft1(void *, long) { } // expected-error{{does not enclose namespace}}
 }
 
 

Modified: cfe/trunk/test/SemaCXX/nested-name-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nested-name-spec.cpp?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nested-name-spec.cpp (original)
+++ cfe/trunk/test/SemaCXX/nested-name-spec.cpp Thu Apr 12 23:07:40 2012
@@ -45,7 +45,7 @@
 }
 
 namespace B {
-  void ::A::Af() {} // expected-error {{definition or redeclaration of 'Af' not in a namespace enclosing 'A'}}
+  void ::A::Af() {} // expected-error {{cannot define or redeclare 'Af' here because namespace 'B' does not enclose namespace 'A'}}
 }
 
 void f1() {

Modified: cfe/trunk/test/SemaCXX/qual-id-test.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/qual-id-test.cpp?rev=154656&r1=154655&r2=154656&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/qual-id-test.cpp (original)
+++ cfe/trunk/test/SemaCXX/qual-id-test.cpp Thu Apr 12 23:07:40 2012
@@ -144,6 +144,6 @@
   typedef int foo;
   namespace Inner {
     typedef int PR6645::foo; // expected-error{{typedef declarator cannot be qualified}} \
-    // expected-error{{definition or redeclaration of 'foo' not in a namespace enclosing 'PR6645'}}
+    // expected-error{{cannot define or redeclare 'foo' here because namespace 'Inner' does not enclose namespace 'PR6645'}}
   }
 }





More information about the cfe-commits mailing list