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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu May 16 10:42:13 UTC 2019


 compilerplugins/clang/compat.hxx  |   16 ++++++++++++++++
 compilerplugins/clang/salcall.cxx |    4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 56f87dac69b487f7b9aef4d3fd34c3a8a232a8df
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed May 15 08:39:40 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu May 16 12:41:36 2019 +0200

    Adapt compilerplugins to Clang 9 isExplicitSpecified -> getExplicitSpecifier
    
    see <https://github.com/llvm/llvm-project/commit/
    76b9027f352a83c13c98820724071c5e3bea6232> "[c++20] Add support for
    explicit(bool), as described in P0892R2."
    
    Change-Id: Ia8a6902a64ab3377328fd5e3ed57246d214176f2
    Reviewed-on: https://gerrit.libreoffice.org/72335
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 97410fcbdc7a..bdbcdcb46f0b 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -240,6 +240,22 @@ inline const clang::Expr *getSubExprAsWritten(const clang::CastExpr *This) {
   return getSubExprAsWritten(const_cast<clang::CastExpr *>(This));
 }
 
+inline bool isExplicitSpecified(clang::CXXConstructorDecl const * decl) {
+#if CLANG_VERSION >= 80000
+    return decl->getExplicitSpecifier().isExplicit();
+#else
+    return decl->isExplicitSpecified();
+#endif
+}
+
+inline bool isExplicitSpecified(clang::CXXConversionDecl const * decl) {
+#if CLANG_VERSION >= 80000
+    return decl->getExplicitSpecifier().isExplicit();
+#else
+    return decl->isExplicitSpecified();
+#endif
+}
+
 }
 
 #endif
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index 883f099abc9a..ce32c46893ed 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -536,9 +536,9 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
         if (noReturnType
             && !(functionDecl->isVirtualAsWritten()
                  || (isa<CXXConstructorDecl>(functionDecl)
-                     && cast<CXXConstructorDecl>(functionDecl)->isExplicitSpecified())
+                     && compat::isExplicitSpecified(cast<CXXConstructorDecl>(functionDecl)))
                  || (isa<CXXConversionDecl>(functionDecl)
-                     && cast<CXXConversionDecl>(functionDecl)->isExplicitSpecified())))
+                     && compat::isExplicitSpecified(cast<CXXConversionDecl>(functionDecl)))))
         {
             SourceLocation endLoc1;
             if (macroStartLoc.isMacroID()


More information about the Libreoffice-commits mailing list