lopluign:staticmethods: Improve diagnostics

Change-Id: I6079f387a697c5fe794655e455a19d0cb44b96bc
This commit is contained in:
Stephan Bergmann
2015-05-08 18:55:30 +02:00
parent 127625e8ef
commit e6fa865b4d

View File

@@ -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;
}