diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-13 21:16:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-13 21:16:44 +0000 |
commit | 3f09327b26033d0a9676d52d80cf92c48f581aff (patch) | |
tree | 039a1889fa3bd411d947c5642da2182868e05489 /lib/Sema/SemaDecl.cpp | |
parent | cee1b54e11cb4d460634e6ecedbe75c7c2382389 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index a1582a900f..9f03cb284c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2229,10 +2229,9 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, } } else if (D.getCXXScopeSpec().isSet()) { // No previous declaration in the qualifying scope. - NestedNameSpecifier *NNS = - (NestedNameSpecifier *)D.getCXXScopeSpec().getScopeRep(); - DiagnoseMissingMember(D.getIdentifierLoc(), Name, NNS, - D.getCXXScopeSpec().getRange()); + Diag(D.getIdentifierLoc(), diag::err_no_member) + << Name << computeDeclContext(D.getCXXScopeSpec(), true) + << D.getCXXScopeSpec().getRange(); NewVD->setInvalidDecl(); } @@ -2844,7 +2843,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC, // matches (e.g., those that differ only in cv-qualifiers and // whether the parameter types are references). Diag(D.getIdentifierLoc(), diag::err_member_def_does_not_match) - << cast<NamedDecl>(DC) << D.getCXXScopeSpec().getRange(); + << Name << DC << D.getCXXScopeSpec().getRange(); NewFD->setInvalidDecl(); LookupResult Prev; |