summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-10-23 18:23:04 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-10-23 22:07:32 +0200
commit6facd4811af68538544207fc1be606bf2cefbb1e (patch)
treedbbb2d00b9528a69953e59d86a943448e02ca6d6 /compilerplugins
parent12eb32fccec16a436a6c3eca725b9d6d449f8e19 (diff)
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>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/bufferadd.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/compilerplugins/clang/bufferadd.cxx b/compilerplugins/clang/bufferadd.cxx
index 4346e9ca28b2..ab619f523622 100644
--- a/compilerplugins/clang/bufferadd.cxx
+++ b/compilerplugins/clang/bufferadd.cxx
@@ -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))