[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Oct 1 19:42:46 UTC 2019
compilerplugins/clang/noexceptmove.cxx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 152b3ef0f36a067e3ee07172d3057a3a728e12f1
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Oct 1 13:54:45 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Oct 1 21:41:44 2019 +0200
loplugin:noexceptmove: Cater for null FunctionDecl::getBody
...which can happen for function templates with clang-cl, leading to false
warnings like
> [build CXX] codemaker/source/commoncpp/commoncpp.cxx
> In file included from codemaker/source/commoncpp/commoncpp.cxx:25:
> In file included from include\codemaker/typemanager.hxx:28:
> include\rtl/ref.hxx(126,5): error: move operator= can be noexcept [loplugin:noexceptmove]
> Reference<reference_type> &
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Change-Id: I541c7c3d86d05964834e3e5cf678c8f1145ea132
Reviewed-on: https://gerrit.libreoffice.org/79956
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/noexceptmove.cxx b/compilerplugins/clang/noexceptmove.cxx
index 1a1f2de41971..f0fd6cd899c5 100644
--- a/compilerplugins/clang/noexceptmove.cxx
+++ b/compilerplugins/clang/noexceptmove.cxx
@@ -67,7 +67,8 @@ bool NoExceptMove::TraverseCXXConstructorDecl(CXXConstructorDecl* constructorDec
&& constructorDecl->getExceptionSpecType() == EST_None
&& !constructorDecl->isDefaulted() && !constructorDecl->isDeleted()
&& !ignoreLocation(constructorDecl)
- && constructorDecl->isThisDeclarationADefinition();
+ && constructorDecl->isThisDeclarationADefinition()
+ && constructorDecl->getBody() != nullptr;
if (isMove)
{
m_ConstructorThrows.push_back(false);
@@ -115,7 +116,7 @@ bool NoExceptMove::TraverseCXXMethodDecl(CXXMethodDecl* methodDecl)
bool isMove = methodDecl->isMoveAssignmentOperator()
&& methodDecl->getExceptionSpecType() == EST_None && !methodDecl->isDefaulted()
&& !methodDecl->isDeleted() && !ignoreLocation(methodDecl)
- && methodDecl->isThisDeclarationADefinition();
+ && methodDecl->isThisDeclarationADefinition() && methodDecl->getBody() != nullptr;
if (isMove)
{
StringRef fn = getFileNameOfSpellingLoc(
More information about the Libreoffice-commits
mailing list