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@redhat.com>
This commit is contained in:
@@ -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(
|
||||
|
Reference in New Issue
Block a user