compilerplugins/clang/simplifyconstruct.cxx | 3 ++- compilerplugins/clang/test/simplifyconstruct.cxx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
New commits: commit 84cd2e5a712f68062429d369cc5a196f7070fd41 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Feb 26 08:20:55 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Feb 26 09:03:48 2025 +0100 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.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/compilerplugins/clang/simplifyconstruct.cxx b/compilerplugins/clang/simplifyconstruct.cxx index d9eff0b3af89..8c67abe6806f 100644 --- a/compilerplugins/clang/simplifyconstruct.cxx +++ b/compilerplugins/clang/simplifyconstruct.cxx @@ -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; diff --git a/compilerplugins/clang/test/simplifyconstruct.cxx b/compilerplugins/clang/test/simplifyconstruct.cxx index d44738f78d01..e39c469bbec3 100644 --- a/compilerplugins/clang/test/simplifyconstruct.cxx +++ b/compilerplugins/clang/test/simplifyconstruct.cxx @@ -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; }