[Libreoffice-commits] core.git: compilerplugins/clang
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 14 08:40:17 UTC 2018
compilerplugins/clang/simplifyconstruct.cxx | 5 +++--
compilerplugins/clang/test/simplifyconstruct.cxx | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit c62d02bcb9192c839767d6824751002696c3ed3f
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Sep 13 21:21:20 2018 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Sep 14 10:39:50 2018 +0200
Improve loplugin:simplifyconstruct warnings
Change-Id: I0a64d0eb9938d5a99416dbe4078ba4c05e5d588b
Reviewed-on: https://gerrit.libreoffice.org/60465
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/simplifyconstruct.cxx b/compilerplugins/clang/simplifyconstruct.cxx
index fd5ba5027d01..172a1bd48029 100644
--- a/compilerplugins/clang/simplifyconstruct.cxx
+++ b/compilerplugins/clang/simplifyconstruct.cxx
@@ -55,9 +55,10 @@ bool SimplifyConstruct::VisitCXXConstructExpr(CXXConstructExpr const* constructE
&& isa<CXXNullPtrLiteralExpr>(constructExpr->getArg(0)->IgnoreParenImpCasts()))
{
report(DiagnosticsEngine::Warning,
- "no need to explicitly init this with nullptr, just use default constructor",
+ "no need to explicitly init an instance of %0 with nullptr, just use default "
+ "constructor",
constructExpr->getSourceRange().getBegin())
- << constructExpr->getSourceRange();
+ << constructExpr->getType() << constructExpr->getSourceRange();
}
return true;
}
diff --git a/compilerplugins/clang/test/simplifyconstruct.cxx b/compilerplugins/clang/test/simplifyconstruct.cxx
index 3ff6ddf22c64..ca4b3a1a198c 100644
--- a/compilerplugins/clang/test/simplifyconstruct.cxx
+++ b/compilerplugins/clang/test/simplifyconstruct.cxx
@@ -21,9 +21,9 @@ class Foo1
rtl::Reference<Foo> m_pbar2;
Foo1()
: m_pbar1(nullptr)
- // expected-error at -1 {{no need to explicitly init this with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
+ // expected-error at -1 {{no need to explicitly init an instance of 'std::unique_ptr<int>' with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
, m_pbar2(nullptr)
- // expected-error at -1 {{no need to explicitly init this with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
+ // expected-error at -1 {{no need to explicitly init an instance of 'rtl::Reference<Foo>' with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
{
}
};
More information about the Libreoffice-commits
mailing list