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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 27 09:58:12 UTC 2019


 compilerplugins/clang/test/typedefparam.cxx |    4 ++--
 compilerplugins/clang/typedefparam.cxx      |   13 ++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit be0655364cf3fff09195d6ce9d50e5b60b98ff18
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Mar 27 08:44:28 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Mar 27 10:57:46 2019 +0100

    Improve loplugin:typedefparam error reporting
    
    Change-Id: I2ed4c20ab909b79fca794fb04259018fbfcb1db5
    Reviewed-on: https://gerrit.libreoffice.org/69787
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/test/typedefparam.cxx b/compilerplugins/clang/test/typedefparam.cxx
index ed2f8d7017a3..63609347dda8 100644
--- a/compilerplugins/clang/test/typedefparam.cxx
+++ b/compilerplugins/clang/test/typedefparam.cxx
@@ -18,7 +18,7 @@ class Foo
 };
 
 void Foo::bar(sal_uLong)
-// expected-error at -1 {{function param 0 at definition site does not match function param at declaration site, 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
+// expected-error at -1 {{function param 1 at definition site does not match function param at declaration site, 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
 {
 }
 
@@ -73,7 +73,7 @@ struct Struct2 : public Struct1
     virtual sal_uLong foo1() override;
     // expected-error at -1 {{method return type does not match overridden method 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
     virtual void foo2(sal_uLong) override;
-    // expected-error at -1 {{method param 0 does not match overridden method param 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
+    // expected-error at -1 {{method param 1 does not match overridden method param 'sal_uLong' (aka 'unsigned long') vs 'sal_uIntPtr' (aka 'unsigned long') [loplugin:typedefparam]}}
 };
 };
 
diff --git a/compilerplugins/clang/typedefparam.cxx b/compilerplugins/clang/typedefparam.cxx
index e4ed07da4e13..fe6ebba78f0f 100644
--- a/compilerplugins/clang/typedefparam.cxx
+++ b/compilerplugins/clang/typedefparam.cxx
@@ -56,11 +56,10 @@ bool TypedefParam::VisitFunctionDecl(FunctionDecl const* functionDecl)
             report(DiagnosticsEngine::Warning,
                    "function param %0 at definition site does not match function param at "
                    "declaration site, %1 vs %2",
-                   compat::getBeginLoc(functionDecl))
-                << i << thisParam->getType() << canonicalParam->getType()
+                   thisParam->getLocation())
+                << (i + 1) << thisParam->getType() << canonicalParam->getType()
                 << functionDecl->getSourceRange();
-            report(DiagnosticsEngine::Note, "declaration site here",
-                   compat::getBeginLoc(canonicalDecl))
+            report(DiagnosticsEngine::Note, "declaration site here", canonicalParam->getLocation())
                 << canonicalDecl->getSourceRange();
         }
     }
@@ -112,11 +111,11 @@ bool TypedefParam::VisitCXXMethodDecl(CXXMethodDecl const* methodDecl)
                 report(DiagnosticsEngine::Warning,
                        "method param %0 does not match overridden method param "
                        "%1 vs %2",
-                       compat::getBeginLoc(methodDecl))
-                    << i << parmVarDecl->getType() << superParmVarDecl->getType()
+                       parmVarDecl->getLocation())
+                    << (i + 1) << parmVarDecl->getType() << superParmVarDecl->getType()
                     << methodDecl->getSourceRange();
                 report(DiagnosticsEngine::Note, "super-class method here",
-                       compat::getBeginLoc(superMethodDecl))
+                       superParmVarDecl->getLocation())
                     << superMethodDecl->getSourceRange();
             }
             ++i;


More information about the Libreoffice-commits mailing list