compilerplugins/clang/compat.hxx                |    8 ++++++++
 compilerplugins/clang/consttobool.cxx           |    3 ++-
 compilerplugins/clang/getimplementationname.cxx |    3 ++-
 compilerplugins/clang/sallogareas.cxx           |    2 +-
 compilerplugins/clang/stringconstant.cxx        |    2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 9e2dbeea9f680f2d3d1611167820c197ce8a9685
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Fri Jul 1 14:56:01 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Fri Jul 1 22:12:41 2022 +0200

    Adapt to LLVM 15 trunk clang::StringLiteral::isAscii rename
    
    
<https://github.com/llvm/llvm-project/commit/a9a60f20e6cc80855864b8f559073bc31f34554b>
    "[Clang] Rename StringLiteral::isAscii() => isOrdinary() [NFC]"
    
    Change-Id: Iac293c19bd135a94dcc3a3ef9f252ca6175c959a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136744
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 350263da6854..1a6266ec5201 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -125,6 +125,14 @@ inline const clang::Expr *getSubExprAsWritten(const 
clang::CastExpr *This) {
   return getSubExprAsWritten(const_cast<clang::CastExpr *>(This));
 }
 
+inline bool isOrdinary(clang::StringLiteral const * expr) {
+#if CLANG_VERSION >= 150000
+    return expr->isOrdinary();
+#else
+    return expr->isAscii();
+#endif
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/consttobool.cxx 
b/compilerplugins/clang/consttobool.cxx
index d20a0d5c9b48..c13bf7729e72 100644
--- a/compilerplugins/clang/consttobool.cxx
+++ b/compilerplugins/clang/consttobool.cxx
@@ -16,6 +16,7 @@
 #include "clang/Basic/Builtins.h"
 
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 
 // Find implicit conversions from non-'bool' constants (e.g., 'sal_False') to 
'bool'.
@@ -145,7 +146,7 @@ public:
         {
             if (auto const e = 
dyn_cast<clang::StringLiteral>(sub->IgnoreParenImpCasts()))
             {
-                if (e->isAscii()) // somewhat randomly restrict to plain 
literals
+                if (compat::isOrdinary(e)) // somewhat randomly restrict to 
plain literals
                 {
                     if (compiler.getSourceManager().isMacroArgExpansion(l)
                         && Lexer::getImmediateMacroName(l, 
compiler.getSourceManager(),
diff --git a/compilerplugins/clang/getimplementationname.cxx 
b/compilerplugins/clang/getimplementationname.cxx
index acc45acb7442..65cbabfdd4e9 100644
--- a/compilerplugins/clang/getimplementationname.cxx
+++ b/compilerplugins/clang/getimplementationname.cxx
@@ -20,6 +20,7 @@
 #include <fstream>
 #include <regex>
 #include "check.hxx"
+#include "compat.hxx"
 #include "plugin.hxx"
 #include "clang/Frontend/CompilerInstance.h"
 
@@ -170,7 +171,7 @@ bool GetImplementationName::isStringConstant(
     }
     clang::StringLiteral const * lit = dyn_cast<clang::StringLiteral>(expr);
     if (lit != nullptr) {
-        if (!lit->isAscii()) {
+        if (!compat::isOrdinary(lit)) {
             return false;
         }
         *string = lit->getString();
diff --git a/compilerplugins/clang/sallogareas.cxx 
b/compilerplugins/clang/sallogareas.cxx
index bd71128aa17c..f20c7f347e2f 100644
--- a/compilerplugins/clang/sallogareas.cxx
+++ b/compilerplugins/clang/sallogareas.cxx
@@ -116,7 +116,7 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
         };
     if( const clang::StringLiteral* area = dyn_cast< clang::StringLiteral >( 
call->getArg( areaArgIndex )->IgnoreParenImpCasts()))
         {
-        if( area->getKind() == clang::StringLiteral::Ascii )
+        if( compat::isOrdinary(area) )
             checkArea( area->getBytes(), area->getExprLoc());
         else
             report( DiagnosticsEngine::Warning, "unsupported string literal 
kind (plugin needs fixing?)",
diff --git a/compilerplugins/clang/stringconstant.cxx 
b/compilerplugins/clang/stringconstant.cxx
index 80b0b13882b6..cf1eb6afedbf 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -1385,7 +1385,7 @@ bool StringConstant::isStringConstant(
     }
     clang::StringLiteral const * lit = dyn_cast<clang::StringLiteral>(expr);
     if (lit != nullptr) {
-        if (!(lit->isAscii() || lit->isUTF8())) {
+        if (!(compat::isOrdinary(lit) || lit->isUTF8())) {
             return false;
         }
         unsigned n = lit->getLength();

Reply via email to