[cfe-commits] r80489 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/Sema.cpp test/SemaCXX/missing-members.cpp

Anders Carlsson andersca at mac.com
Sat Aug 29 23:49:43 PDT 2009


Author: andersca
Date: Sun Aug 30 01:49:43 2009
New Revision: 80489

URL: http://llvm.org/viewvc/llvm-project?rev=80489&view=rev
Log:
Improve missing error messages as suggested by Doug.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/test/SemaCXX/missing-members.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=80489&r1=80488&r2=80489&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Aug 30 01:49:43 2009
@@ -1298,11 +1298,11 @@
 def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
 def err_typecheck_no_member_deprecated : Error<"no member named %0">;
 def err_typecheck_record_no_member : Error<
-  "%select{struct|union|class}0 %q1 has no member named %2">;
+  "no member named %0 in %select{struct|union|class|enum}1 %q2">;
 def err_typecheck_namespace_no_member : Error<
-  "namespace %q0 has no member named %1">;
-def err_typecheck_global_scope_no_member : Error<
-  "the global scope has no member named %0">;
+  "no member named %0 in namespace %q1">;
+def err_typecheck_global_namespace_no_member : Error<
+  "no member named %0 in the global namespace">;
 
 def err_member_redeclared : Error<"class member cannot be redeclared">;
 def err_member_def_does_not_match : Error<

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=80489&r1=80488&r2=80489&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sun Aug 30 01:49:43 2009
@@ -354,16 +354,16 @@
     const Type *Ty = Context.getCanonicalType(NNS->getAsType());
     RecordDecl *RD = cast<RecordType>(Ty)->getDecl();
     Diag(MemberLoc, diag::err_typecheck_record_no_member)
-      << RD->getTagKind() << RD << Member << Range;
+      << Member << RD->getTagKind() << RD << Range;
     break;
   }
   case NestedNameSpecifier::Namespace: {
     Diag(MemberLoc, diag::err_typecheck_namespace_no_member)
-      << NNS->getAsNamespace() << Member << Range;
+       << Member << NNS->getAsNamespace() << Range;
     break;
   }
   case NestedNameSpecifier::Global: {
-    Diag(MemberLoc, diag::err_typecheck_global_scope_no_member)
+    Diag(MemberLoc, diag::err_typecheck_global_namespace_no_member)
       << Member << Range;
     break;
   }

Modified: cfe/trunk/test/SemaCXX/missing-members.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/missing-members.cpp?rev=80489&r1=80488&r2=80489&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/missing-members.cpp (original)
+++ cfe/trunk/test/SemaCXX/missing-members.cpp Sun Aug 30 01:49:43 2009
@@ -8,19 +8,19 @@
 }
 
 void f() {
-  A::B::i; // expected-error {{namespace 'A::B' has no member named 'i'}}
-  A::B::C::i; // expected-error {{class 'A::B::C' has no member named 'i'}}
-  ::i; // expected-error {{the global scope has no member named 'i'}}
+  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'}}
+  ::i; // expected-error {{no member named 'i' in the global namespace}}
 }
 
-int A::B::i = 10; // expected-error {{namespace 'A::B' has no member named 'i'}}
-int A::B::C::i = 10; // expected-error {{class 'A::B::C' has no member named 'i'}}
-int A::B::S::i = 10; // expected-error {{struct 'A::B::S' has no member named 'i'}}
-int A::B::U::i = 10; // expected-error {{union 'A::B::U' has no member named 'i'}}
+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'}}
 
-using A::B::D; // expected-error {{namespace 'A::B' has no member named 'D'}}
+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 {{class 'A::B::C' has no member named 'f'}}
+  using A::B::C::f; // expected-error {{no member named 'f' in class 'A::B::C'}}
   
 };





More information about the cfe-commits mailing list