From e6fa865b4d5c7eb0576f7b1510077bca081ce4fb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 8 May 2015 18:55:30 +0200 Subject: lopluign:staticmethods: Improve diagnostics Change-Id: I6079f387a697c5fe794655e455a19d0cb44b96bc --- compilerplugins/clang/staticmethods.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx index decb3ffd0f8f..71e3b6a2a717 100644 --- a/compilerplugins/clang/staticmethods.cxx +++ b/compilerplugins/clang/staticmethods.cxx @@ -201,8 +201,15 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) report( DiagnosticsEngine::Warning, "this method can be declared static " + fqn, - pCXXMethodDecl->getCanonicalDecl()->getLocStart()) + pCXXMethodDecl->getCanonicalDecl()->getLocation()) << pCXXMethodDecl->getCanonicalDecl()->getSourceRange(); + FunctionDecl const * def; + if (pCXXMethodDecl->isDefined(def) + && def != pCXXMethodDecl->getCanonicalDecl()) + { + report(DiagnosticsEngine::Note, "defined here:", def->getLocation()) + << def->getSourceRange(); + } return true; } -- cgit