Fix call to NamedDecl::getName

...which fails at least with clang-8.0.0-3.fc30.x86_64 with "clang-8:
/usr/include/clang/AST/Decl.h:277: llvm::StringRef clang::NamedDecl::getName()
const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"'
failed."

Change-Id: I6999240e2b518b6818a43d1e5ac92224300b343f
Reviewed-on: https://gerrit.libreoffice.org/81415
Tested-by: Michael Stahl <michael.stahl@cib.de>
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2019-10-23 18:23:04 +02:00
parent 12eb32fcce
commit 6facd4811a

View file

@ -274,10 +274,13 @@ bool BufferAdd::isMethodOkToMerge(CXXMemberCallExpr const* memberCall)
if (methodDecl->getNumParams() == 0)
return true;
auto name = methodDecl->getName();
if (name == "appendUninitialized" || name == "setLength" || name == "remove" || name == "insert"
|| name == "appendAscii" || name == "appendUtf32")
return false;
if (auto const id = methodDecl->getIdentifier())
{
auto name = id->getName();
if (name == "appendUninitialized" || name == "setLength" || name == "remove"
|| name == "insert" || name == "appendAscii" || name == "appendUtf32")
return false;
}
auto rhs = memberCall->getArg(0);
if (!isSideEffectFree(rhs))