[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann sbergman at redhat.com
Wed Dec 13 12:16:37 UTC 2017


 compilerplugins/clang/salcall.cxx |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 2f28d2b4fa92be7dca47ea48c1a68db7b2060608
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Dec 13 08:42:34 2017 +0100

    Improve loplugin:salcall error reporting
    
    Change-Id: Ib18f61f10225d5499f94144c8a0f9efff40e43aa
    Reviewed-on: https://gerrit.libreoffice.org/46366
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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


More information about the Libreoffice-commits mailing list