Improve missing error messages as suggested by Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80489 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2009-08-30 06:49:43 +00:00
Родитель 05180afbf4
Коммит 639bfc7b1e
3 изменённых файлов: 16 добавлений и 16 удалений

Просмотреть файл

@ -1298,11 +1298,11 @@ def note_member_reference_needs_call : Note<
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<

Просмотреть файл

@ -354,16 +354,16 @@ void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
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;
}

Просмотреть файл

@ -8,19 +8,19 @@ namespace A {
}
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'}}
};