loplugin:simplifyconstruct improve warning message

which was needlessly cryptic

Change-Id: Ifb91631705accff3f49ec3f55b67e83532d70a12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182199
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2025-02-26 08:20:55 +02:00
parent e20cc47c0e
commit 84cd2e5a71
2 changed files with 4 additions and 3 deletions

View File

@ -96,7 +96,8 @@ bool SimplifyConstruct::VisitVarDecl(VarDecl const* varDecl)
if (compiler.getSourceManager().isMacroBodyExpansion(init->getBeginLoc()))
return true;
report(DiagnosticsEngine::Warning, "simplify", varDecl->getLocation())
report(DiagnosticsEngine::Warning, "simplify construction, just use 'Foo a(...);'",
varDecl->getLocation())
<< varDecl->getSourceRange();
return true;

View File

@ -60,7 +60,7 @@ struct Foo
};
void f(Foo* f)
{
// expected-error@+1 {{simplify [loplugin:simplifyconstruct]}}
// expected-error@+1 {{simplify construction, just use 'Foo a(...);' [loplugin:simplifyconstruct]}}
rtl::Reference<Foo> x = rtl::Reference(f);
}
}
@ -80,7 +80,7 @@ namespace test5
{
void f()
{
// expected-error@+1 {{simplify [loplugin:simplifyconstruct]}}
// expected-error@+1 {{simplify construction, just use 'Foo a(...);' [loplugin:simplifyconstruct]}}
tools::Rectangle x = tools::Rectangle(10, 10, 10, 10);
(void)x;
}