Improve loplugin:typedefparam error reporting
Change-Id: I2ed4c20ab909b79fca794fb04259018fbfcb1db5 Reviewed-on: https://gerrit.libreoffice.org/69787 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -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]}}
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user