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)
|
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;
|
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]}}
|
// 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;
|
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,
|
report(DiagnosticsEngine::Warning,
|
||||||
"function param %0 at definition site does not match function param at "
|
"function param %0 at definition site does not match function param at "
|
||||||
"declaration site, %1 vs %2",
|
"declaration site, %1 vs %2",
|
||||||
compat::getBeginLoc(functionDecl))
|
thisParam->getLocation())
|
||||||
<< i << thisParam->getType() << canonicalParam->getType()
|
<< (i + 1) << thisParam->getType() << canonicalParam->getType()
|
||||||
<< functionDecl->getSourceRange();
|
<< functionDecl->getSourceRange();
|
||||||
report(DiagnosticsEngine::Note, "declaration site here",
|
report(DiagnosticsEngine::Note, "declaration site here", canonicalParam->getLocation())
|
||||||
compat::getBeginLoc(canonicalDecl))
|
|
||||||
<< canonicalDecl->getSourceRange();
|
<< canonicalDecl->getSourceRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,11 +111,11 @@ bool TypedefParam::VisitCXXMethodDecl(CXXMethodDecl const* methodDecl)
|
|||||||
report(DiagnosticsEngine::Warning,
|
report(DiagnosticsEngine::Warning,
|
||||||
"method param %0 does not match overridden method param "
|
"method param %0 does not match overridden method param "
|
||||||
"%1 vs %2",
|
"%1 vs %2",
|
||||||
compat::getBeginLoc(methodDecl))
|
parmVarDecl->getLocation())
|
||||||
<< i << parmVarDecl->getType() << superParmVarDecl->getType()
|
<< (i + 1) << parmVarDecl->getType() << superParmVarDecl->getType()
|
||||||
<< methodDecl->getSourceRange();
|
<< methodDecl->getSourceRange();
|
||||||
report(DiagnosticsEngine::Note, "super-class method here",
|
report(DiagnosticsEngine::Note, "super-class method here",
|
||||||
compat::getBeginLoc(superMethodDecl))
|
superParmVarDecl->getLocation())
|
||||||
<< superMethodDecl->getSourceRange();
|
<< superMethodDecl->getSourceRange();
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
|
Reference in New Issue
Block a user