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