Improve diagnostics for missing members. This renames the err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80469 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 0d9ad12..f291be1 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -345,6 +345,31 @@
return 0;
}
+void Sema::DiagnoseMissingMember(SourceLocation MemberLoc,
+ DeclarationName Member,
+ NestedNameSpecifier *NNS, SourceRange Range) {
+ switch (NNS->getKind()) {
+ default: assert(0 && "Unexpected nested name specifier kind!");
+ case NestedNameSpecifier::TypeSpec: {
+ 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;
+ break;
+ }
+ case NestedNameSpecifier::Namespace: {
+ Diag(MemberLoc, diag::err_typecheck_namespace_no_member)
+ << NNS->getAsNamespace() << Member << Range;
+ break;
+ }
+ case NestedNameSpecifier::Global: {
+ Diag(MemberLoc, diag::err_typecheck_global_scope_no_member)
+ << Member << Range;
+ break;
+ }
+ }
+}
+
Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
if (!this->Emit())
return;