diff options
-rw-r--r-- | compilerplugins/clang/staticmethods.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
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; } |