summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-12-13 08:42:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-12-13 13:14:11 +0100
commit2f28d2b4fa92be7dca47ea48c1a68db7b2060608 (patch)
tree3165c4a683bbb830d27c6adcb286e80bdab40414
parenta987aa3be73ec29917567d16886c017ac9a0a3d8 (diff)
Improve loplugin:salcall error reporting
Change-Id: Ib18f61f10225d5499f94144c8a0f9efff40e43aa Reviewed-on: https://gerrit.libreoffice.org/46366 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--compilerplugins/clang/salcall.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index 61fb4e1a5f0b..f60eecf40e80 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -301,11 +301,23 @@ bool SalCall::VisitFunctionDecl(FunctionDecl const* decl)
if (bOK)
return true;
- report(DiagnosticsEngine::Warning, "SAL_CALL unnecessary here", rewriteLoc)
- << decl->getSourceRange();
+ if (bDeclIsSalCall)
+ {
+ report(DiagnosticsEngine::Warning, "SAL_CALL unnecessary here",
+ rewriteLoc.isValid() ? rewriteLoc : decl->getLocation())
+ << decl->getSourceRange();
+ }
if (canonicalDecl != decl)
+ {
report(DiagnosticsEngine::Warning, "SAL_CALL unnecessary here", rewriteCanonicalLoc)
<< canonicalDecl->getSourceRange();
+ if (!bDeclIsSalCall)
+ {
+ report(DiagnosticsEngine::Note, "defined here (without SAL_CALL decoration)",
+ decl->getLocation())
+ << decl->getSourceRange();
+ }
+ }
return true;
}