summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-05-08 18:55:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-05-08 19:15:31 +0200
commite6fa865b4d5c7eb0576f7b1510077bca081ce4fb (patch)
treeeffcaf23a1ab79111d81af3ff0ffdc7778f09906 /compilerplugins
parent127625e8efc64dfbc3f2c53db84a3c919823b0a5 (diff)
lopluign:staticmethods: Improve diagnostics
Change-Id: I6079f387a697c5fe794655e455a19d0cb44b96bc
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/staticmethods.cxx9
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;
}