[Libreoffice-commits] core.git: compilerplugins/clang

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 23 20:08:49 UTC 2019


 compilerplugins/clang/bufferadd.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6facd4811af68538544207fc1be606bf2cefbb1e
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Oct 23 18:23:04 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Oct 23 22:07:32 2019 +0200

    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 at cib.de>
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

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))


More information about the Libreoffice-commits mailing list