[Libreoffice-commits] core.git: compilerplugins/clang
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 27 17:28:16 UTC 2020
compilerplugins/clang/makeshared.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 606baaeea69a3a8bb8c295cd692df8f6f30982bb
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Jan 27 14:11:13 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 27 18:27:43 2020 +0100
loplugin:makeshared: Fix call to clang::NamedDecl::getName
...which caused
> llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed.
when compiling e.g. comphelper/source/misc/lok.cxx
Change-Id: Ie83e7fb42fae1093058caea320973bc23a90bee9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87526
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/compilerplugins/clang/makeshared.cxx b/compilerplugins/clang/makeshared.cxx
index 61b58c36488a..b1f1c13ce640 100644
--- a/compilerplugins/clang/makeshared.cxx
+++ b/compilerplugins/clang/makeshared.cxx
@@ -108,8 +108,11 @@ bool MakeShared::VisitCXXMemberCallExpr(CXXMemberCallExpr const* cxxMemberCallEx
if (!cxxRecordDecl->getName().contains("shared_ptr"))
return true;
- if (cxxMemberCallExpr->getMethodDecl()->getName() != "reset")
- return true;
+ if (auto const id = cxxMemberCallExpr->getMethodDecl()->getIdentifier())
+ {
+ if (id->getName() != "reset")
+ return true;
+ }
auto cxxNewExpr = dyn_cast<CXXNewExpr>(cxxMemberCallExpr->getArg(0)->IgnoreParenImpCasts());
if (!cxxNewExpr)
return true;
More information about the Libreoffice-commits
mailing list