compilerplugins/clang/bufferadd.cxx               |    2 
 compilerplugins/clang/casttovoid.cxx              |    7 
 compilerplugins/clang/check.hxx                   |   14 -
 compilerplugins/clang/checkconfigmacros.cxx       |    3 
 compilerplugins/clang/colorcheck.cxx              |    4 
 compilerplugins/clang/compat.hxx                  |  165 ----------------------
 compilerplugins/clang/constantparam.cxx           |    4 
 compilerplugins/clang/constparams.cxx             |   16 +-
 compilerplugins/clang/consttobool.cxx             |   10 -
 compilerplugins/clang/cstylecast.cxx              |   15 --
 compilerplugins/clang/dynexcspec.cxx              |    7 
 compilerplugins/clang/elidestringvar.cxx          |    4 
 compilerplugins/clang/expressionalwayszero.cxx    |   10 -
 compilerplugins/clang/external.cxx                |    2 
 compilerplugins/clang/externandnotdefined.cxx     |    5 
 compilerplugins/clang/fakebool.cxx                |   10 -
 compilerplugins/clang/fieldcanbelocal.cxx         |    6 
 compilerplugins/clang/finalclasses.cxx            |    7 
 compilerplugins/clang/flatten.cxx                 |   14 -
 compilerplugins/clang/getimplementationname.cxx   |    3 
 compilerplugins/clang/implicitboolconversion.cxx  |    4 
 compilerplugins/clang/includeform.cxx             |    6 
 compilerplugins/clang/intvsfloat.cxx              |   16 +-
 compilerplugins/clang/literaltoboolconversion.cxx |    8 -
 compilerplugins/clang/locking2.cxx                |    7 
 compilerplugins/clang/mergeclasses.cxx            |   11 -
 compilerplugins/clang/noexceptmove.cxx            |   12 -
 compilerplugins/clang/nullptr.cxx                 |    5 
 compilerplugins/clang/ostr.cxx                    |    3 
 compilerplugins/clang/overridevirtual.cxx         |    5 
 compilerplugins/clang/plugin.cxx                  |   12 -
 compilerplugins/clang/pluginhandler.cxx           |   11 -
 compilerplugins/clang/pointerbool.cxx             |   11 -
 compilerplugins/clang/privatebase.cxx             |    3 
 compilerplugins/clang/redundantcast.cxx           |   10 -
 compilerplugins/clang/redundantfcast.cxx          |    6 
 compilerplugins/clang/redundantinline.cxx         |    7 
 compilerplugins/clang/reservedid.cxx              |    5 
 compilerplugins/clang/returnconstant.cxx          |    4 
 compilerplugins/clang/salcall.cxx                 |   16 +-
 compilerplugins/clang/sallogareas.cxx             |    2 
 compilerplugins/clang/salunicodeliteral.cxx       |    3 
 compilerplugins/clang/sharedvisitor/analyzer.cxx  |   11 -
 compilerplugins/clang/simplifypointertobool.cxx   |    5 
 compilerplugins/clang/singlevalfields.cxx         |    5 
 compilerplugins/clang/staticconstfield.cxx        |    4 
 compilerplugins/clang/stringadd.cxx               |    2 
 compilerplugins/clang/stringconstant.cxx          |   16 +-
 compilerplugins/clang/test/redundantfcast.cxx     |    3 
 compilerplugins/clang/test/unreffun.cxx           |    7 
 compilerplugins/clang/unnecessaryvirtual.cxx      |    3 
 compilerplugins/clang/unoaggregation.cxx          |    3 
 compilerplugins/clang/unreffun.cxx                |    3 
 compilerplugins/clang/unusedfields.cxx            |   13 -
 compilerplugins/clang/unusedvarsglobal.cxx        |    7 
 compilerplugins/clang/vclwidgets.cxx              |    2 
 compilerplugins/clang/virtualdead.cxx             |    4 
 compilerplugins/clang/writeonlyvars.cxx           |    7 
 compilerplugins/clang/xmlimport.cxx               |    3 
 59 files changed, 189 insertions(+), 384 deletions(-)

New commits:
commit 3289b1609ee42b58179372ff929107762c5a696e
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Fri Dec 5 16:28:24 2025 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Sun Dec 7 16:46:58 2025 +0100

    Adapt compilerplugins to Clang baseline bump
    
    ...as of e8fd52037a3b77e2da95918ff4ba5ed465c2f3bc "Update README.md after 
Clang
    bump to 18"
    
    Change-Id: I2512205aa22ade1da17c414066a4f9e3d82bc99e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195099
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/compilerplugins/clang/bufferadd.cxx 
b/compilerplugins/clang/bufferadd.cxx
index 161db77eb0e3..5327384c4ec3 100644
--- a/compilerplugins/clang/bufferadd.cxx
+++ b/compilerplugins/clang/bufferadd.cxx
@@ -384,7 +384,7 @@ bool BufferAdd::isSideEffectFree(Expr const* expr)
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
                 // allowlist some known-safe methods
-                if (compat::ends_with(name, "ResId") || name == "GetXMLToken")
+                if (name.ends_with("ResId") || name == "GetXMLToken")
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
             }
diff --git a/compilerplugins/clang/casttovoid.cxx 
b/compilerplugins/clang/casttovoid.cxx
index 4026162ea0c1..417fe5b91814 100644
--- a/compilerplugins/clang/casttovoid.cxx
+++ b/compilerplugins/clang/casttovoid.cxx
@@ -447,10 +447,9 @@ private:
 
     bool isFromCIncludeFile(SourceLocation spellingLocation) const {
         return !compiler.getSourceManager().isInMainFile(spellingLocation)
-            && compat::ends_with(
-                StringRef(
-                    
compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()),
-                ".h");
+            && StringRef(
+                
compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+               .ends_with(".h");
     }
 
     bool isSharedCAndCppCode(VarDecl const * decl) const {
diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx
index 09b3b25b2ba3..3cb8b8859361 100644
--- a/compilerplugins/clang/check.hxx
+++ b/compilerplugins/clang/check.hxx
@@ -190,7 +190,7 @@ ContextCheck TypeCheck::Class(llvm::StringRef id)
     if (!type_.isNull()) {
         auto const t = type_->getAs<clang::RecordType>();
         if (t != nullptr) {
-            return detail::checkRecordDecl(compat::getDecl(t), 
compat::TagTypeKind::Class, id);
+            return detail::checkRecordDecl(compat::getDecl(t), 
clang::TagTypeKind::Class, id);
         }
     }
     return ContextCheck();
@@ -201,7 +201,7 @@ ContextCheck TypeCheck::Struct(llvm::StringRef id) const
     if (!type_.isNull()) {
         auto const t = type_->getAs<clang::RecordType>();
         if (t != nullptr) {
-            return detail::checkRecordDecl(compat::getDecl(t), 
compat::TagTypeKind::Struct, id);
+            return detail::checkRecordDecl(compat::getDecl(t), 
clang::TagTypeKind::Struct, id);
         }
     }
     return ContextCheck();
@@ -233,12 +233,12 @@ ContextCheck TypeCheck::Typedef(llvm::StringRef id) const
 
 ContextCheck DeclCheck::Class(llvm::StringRef id) const
 {
-    return detail::checkRecordDecl(decl_, compat::TagTypeKind::Class, id);
+    return detail::checkRecordDecl(decl_, clang::TagTypeKind::Class, id);
 }
 
 ContextCheck DeclCheck::Struct(llvm::StringRef id) const
 {
-    return detail::checkRecordDecl(decl_, compat::TagTypeKind::Struct, id);
+    return detail::checkRecordDecl(decl_, clang::TagTypeKind::Struct, id);
 }
 
 ContextCheck DeclCheck::ClassOrStruct(llvm::StringRef id) const
@@ -252,7 +252,7 @@ ContextCheck DeclCheck::ClassOrStruct(llvm::StringRef id) 
const
 
 ContextCheck DeclCheck::Union(llvm::StringRef id) const
 {
-    return detail::checkRecordDecl(decl_, compat::TagTypeKind::Union, id);
+    return detail::checkRecordDecl(decl_, clang::TagTypeKind::Union, id);
 }
 
 ContextCheck DeclCheck::Function(llvm::StringRef id) const
@@ -296,13 +296,13 @@ ContextCheck ContextCheck::Namespace(llvm::StringRef id) 
const
 ContextCheck ContextCheck::Class(llvm::StringRef id) const
 {
     return detail::checkRecordDecl(
-        llvm::dyn_cast_or_null<clang::Decl>(context_), 
compat::TagTypeKind::Class, id);
+        llvm::dyn_cast_or_null<clang::Decl>(context_), 
clang::TagTypeKind::Class, id);
 }
 
 ContextCheck ContextCheck::Struct(llvm::StringRef id) const
 {
     return detail::checkRecordDecl(
-        llvm::dyn_cast_or_null<clang::Decl>(context_), 
compat::TagTypeKind::Struct, id);
+        llvm::dyn_cast_or_null<clang::Decl>(context_), 
clang::TagTypeKind::Struct, id);
 }
 
 bool isExtraWarnUnusedType(clang::ASTContext const & context, clang::QualType 
type);
diff --git a/compilerplugins/clang/checkconfigmacros.cxx 
b/compilerplugins/clang/checkconfigmacros.cxx
index 4bed4c82502c..aeb4dd3e1744 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -12,7 +12,6 @@
 #include <memory>
 #include <set>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 #include "config_clang.h"
@@ -72,7 +71,7 @@ void CheckConfigMacros::MacroDefined( const Token& 
macroToken, const MacroDirect
 //        fprintf(stderr,"DEF: %s %s
", macroToken.getIdentifierInfo()->getName().data(), filename );
         StringRef macro = macroToken.getIdentifierInfo()->getName();
         // Skia #defines do not have values, but we set them in config_skia.h .
-        if( compat::starts_with(macro, "SK_" ) && 
loplugin::isSamePathname(filename, BUILDDIR "/config_host/config_skia.h"))
+        if( macro.starts_with( "SK_" ) && loplugin::isSamePathname(filename, 
BUILDDIR "/config_host/config_skia.h"))
             return;
         configMacros.insert( macro.str());
         }
diff --git a/compilerplugins/clang/colorcheck.cxx 
b/compilerplugins/clang/colorcheck.cxx
index 69bcaa0cd9cc..7480222900d2 100644
--- a/compilerplugins/clang/colorcheck.cxx
+++ b/compilerplugins/clang/colorcheck.cxx
@@ -13,12 +13,12 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <set>
 
 #include "config_clang.h"
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 /**
@@ -73,7 +73,7 @@ bool ColorCheck::VisitCXXConstructExpr(const 
CXXConstructExpr* constructExpr)
     {
         if (!arg0->isValueDependent())
         {
-            compat::optional<llvm::APSInt> xVal
+            std::optional<llvm::APSInt> xVal
                 = arg0->getIntegerConstantExpr(compiler.getASTContext());
             if (xVal && *xVal > 0xffffff)
                 report(DiagnosticsEngine::Warning,
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index e8e5a44f16cc..03d6c3c6ac74 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -9,7 +9,6 @@
 
 #pragma once
 
-#include <string>
 #include <utility>
 
 #include "clang/AST/ASTContext.h"
@@ -17,70 +16,12 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Basic/Specifiers.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
 
 #include "config_clang.h"
 
-#if CLANG_VERSION >= 170000
-#include <optional>
-#else
-#include "llvm/ADT/Optional.h"
-#endif
-
 // Compatibility wrapper to abstract over (trivial) changes in the Clang API:
 namespace compat {
 
-template<typename T>
-#if CLANG_VERSION >= 170000
-using optional = std::optional<T>;
-#else
-using optional = llvm::Optional<T>;
-#endif
-
-template<typename T>
-constexpr bool has_value(optional<T> const & o) {
-#if CLANG_VERSION >= 150000
-    return o.has_value();
-#else
-    return o.hasValue();
-#endif
-}
-
-template<typename T>
-constexpr T const & value(optional<T> const & o) {
-#if CLANG_VERSION >= 150000
-    return *o;
-#else
-    return o.getValue();
-#endif
-}
-
-inline std::string toString(llvm::APSInt const & i, unsigned radix) {
-#if CLANG_VERSION >= 130000
-    return llvm::toString(i, radix);
-#else
-    return i.toString(radix);
-#endif
-}
-
-inline bool starts_with(llvm::StringRef s, llvm::StringRef Prefix) {
-#if CLANG_VERSION >= 160000
-    return s.starts_with(Prefix);
-#else
-    return s.startswith(Prefix);
-#endif
-}
-
-inline bool ends_with(llvm::StringRef s, llvm::StringRef Suffix) {
-#if CLANG_VERSION >= 160000
-    return s.ends_with(Suffix);
-#else
-    return s.endswith(Suffix);
-#endif
-}
-
 inline std::pair<clang::SourceLocation, clang::SourceLocation> 
getImmediateExpansionRange(
     clang::SourceManager const & SM, clang::SourceLocation Loc)
 {
@@ -105,72 +46,6 @@ inline clang::Expr const * IgnoreParenImplicit(clang::Expr 
const * expr) {
     return expr->IgnoreImplicit()->IgnoreParens()->IgnoreImplicit();
 }
 
-#if CLANG_VERSION >= 130000
-constexpr clang::ExprValueKind VK_PRValue = clang::VK_PRValue;
-#else
-constexpr clang::ExprValueKind VK_PRValue = clang::VK_RValue;
-#endif
-
-namespace CXXConstructionKind
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::CXXConstructionKind Complete = 
clang::CXXConstructionKind::Complete;
-#else
-constexpr clang::CXXConstructExpr::ConstructionKind Complete = 
clang::CXXConstructExpr::CK_Complete;
-#endif
-}
-
-namespace CharacterLiteralKind
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::CharacterLiteralKind Ascii = 
clang::CharacterLiteralKind::Ascii;
-#else
-constexpr clang::CharacterLiteral::CharacterKind Ascii = 
clang::CharacterLiteral::Ascii;
-#endif
-}
-
-namespace ElaboratedTypeKeyword
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::ElaboratedTypeKeyword None = 
clang::ElaboratedTypeKeyword::None;
-#else
-constexpr clang::ElaboratedTypeKeyword None = clang::ETK_None;
-#endif
-}
-
-namespace Linkage
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::Linkage External = clang::Linkage::External;
-constexpr clang::Linkage Module = clang::Linkage::Module;
-#else
-constexpr clang::Linkage External = clang::ExternalLinkage;
-constexpr clang::Linkage Module = clang::ModuleLinkage;
-#endif
-}
-
-namespace StringLiteralKind
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::StringLiteralKind UTF8 = clang::StringLiteralKind::UTF8;
-#else
-constexpr clang::StringLiteral::StringKind UTF8 = clang::StringLiteral::UTF8;
-#endif
-}
-
-namespace TagTypeKind
-{
-#if CLANG_VERSION >= 180000
-constexpr clang::TagTypeKind Class = clang::TagTypeKind::Class;
-constexpr clang::TagTypeKind Struct = clang::TagTypeKind::Struct;
-constexpr clang::TagTypeKind Union = clang::TagTypeKind::Union;
-#else
-constexpr clang::TagTypeKind Class = clang::TTK_Class;
-constexpr clang::TagTypeKind Struct = clang::TTK_Struct;
-constexpr clang::TagTypeKind Union = clang::TTK_Union;
-#endif
-}
-
 inline bool EvaluateAsInt(clang::Expr const * expr, llvm::APSInt& intRes, 
const clang::ASTContext& ctx) {
     clang::Expr::EvalResult res;
     bool b = expr->EvaluateAsInt(res, ctx);
@@ -245,22 +120,6 @@ 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
-}
-
-inline bool isPureVirtual(clang::FunctionDecl const * decl) {
-#if CLANG_VERSION >= 180000
-    return decl->isPureVirtual();
-#else
-    return decl->isPure();
-#endif
-}
-
 inline bool isUnnamedBitField(clang::FieldDecl const * decl) {
 #if CLANG_VERSION >= 190000
     return decl->isUnnamedBitField();
@@ -333,29 +192,6 @@ inline clang::Type const * 
getClass(clang::MemberPointerType const * type) {
 #endif
 }
 
-inline clang::TemplateTypeParmDecl const * getReplacedParameter(
-    clang::SubstTemplateTypeParmType const * type)
-{
-#if CLANG_VERSION >= 160000
-    return type->getReplacedParameter();
-#else
-    return type->getReplacedParameter()->getDecl();
-#endif
-}
-
-// Printing `std::size_t n` via `report(...) << n` is ambiguous prior to
-// 
<https://github.com/llvm/llvm-project/commit/afdac5fbcb6a375245d435e4427086a376de59ff>
 "[clang]
-// Allow printing 64 bit ints in diagnostics" (in Clang 14.x) and its follow-up
-// 
<https://github.com/llvm/llvm-project/commit/ac7a9ef0ae3a5c63dc4e641f9912d8b659ebd720>
 "Resolve
-// overload ambiguity on Mac OS when printing size_t in diagnostics" (in Clang 
15.x):
-inline
-#if CLANG_VERSION >= 150000
-std::size_t
-#else
-unsigned
-#endif
-diagnosticSize(std::size_t n) { return n; }
-
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/constantparam.cxx 
b/compilerplugins/clang/constantparam.cxx
index fd8f8f4e7992..73ab67e95bc7 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -12,6 +12,8 @@
 #include <iostream>
 #include <fstream>
 
+#include "llvm/ADT/StringExtras.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
@@ -173,7 +175,7 @@ std::string ConstantParam::getCallValue(const Expr* arg)
     APSInt x1;
     if (compat::EvaluateAsInt(arg, x1, compiler.getASTContext()))
     {
-        return compat::toString(x1, 10);
+        return llvm::toString(x1, 10);
     }
     if (isa<CXXNullPtrLiteralExpr>(arg)) {
         return "0";
diff --git a/compilerplugins/clang/constparams.cxx 
b/compilerplugins/clang/constparams.cxx
index fffa735135e5..c1a60366cffc 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -194,16 +194,16 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl 
* functionDecl)
         || 
compiler.getSourceManager().isMacroArgExpansion(canonicalDecl->getBeginLoc())) {
         StringRef name { Lexer::getImmediateMacroName(
                 canonicalDecl->getBeginLoc(), compiler.getSourceManager(), 
compiler.getLangOpts()) };
-        if (compat::starts_with(name, "DECL_LINK") || 
compat::starts_with(name, "DECL_STATIC_LINK")
-            || compat::starts_with(name, "DECL_DLLPRIVATE_STATIC_LINK") )
+        if (name.starts_with("DECL_LINK") || 
name.starts_with("DECL_STATIC_LINK")
+            || name.starts_with("DECL_DLLPRIVATE_STATIC_LINK") )
             return false;
         auto loc2 = 
compat::getImmediateExpansionRange(compiler.getSourceManager(), 
canonicalDecl->getBeginLoc()).first;
         if (compiler.getSourceManager().isMacroBodyExpansion(loc2))
         {
             StringRef name2 { Lexer::getImmediateMacroName(
                     loc2, compiler.getSourceManager(), compiler.getLangOpts()) 
};
-            if (compat::starts_with(name2, "DECL_DLLPRIVATE_LINK")
-                || compat::starts_with(name2, "DECL_DLLPRIVATE_STATIC_LINK") )
+            if (name2.starts_with("DECL_DLLPRIVATE_LINK")
+                || name2.starts_with("DECL_DLLPRIVATE_STATIC_LINK") )
                 return false;
         }
     }
@@ -213,13 +213,13 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl 
* functionDecl)
         StringRef name = functionDecl->getName();
         if (   name == "file_write"
             || name == "SalMainPipeExchangeSignal_impl"
-            || compat::starts_with(name, "SbRtl_")
+            || name.starts_with("SbRtl_")
             || name == "GoNext"
             || name == "GoPrevious"
-            || compat::starts_with(name, "Read_F_")
+            || name.starts_with("Read_F_")
                 // UNO component entry points
-            || compat::ends_with(name, "component_getFactory")
-            || compat::ends_with(name, "_get_implementation")
+            || name.ends_with("component_getFactory")
+            || name.ends_with("_get_implementation")
             // callback for some external code?
             || name == "ScAddInAsyncCallBack"
             // used as function pointers
diff --git a/compilerplugins/clang/consttobool.cxx 
b/compilerplugins/clang/consttobool.cxx
index 124ab4efbaaa..bb4fc31911b5 100644
--- a/compilerplugins/clang/consttobool.cxx
+++ b/compilerplugins/clang/consttobool.cxx
@@ -16,7 +16,6 @@
 #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'.
@@ -146,7 +145,7 @@ public:
         {
             if (auto const e = 
dyn_cast<clang::StringLiteral>(sub->IgnoreParenImpCasts()))
             {
-                if (compat::isOrdinary(e)) // somewhat randomly restrict to 
plain literals
+                if (e->isOrdinary()) // somewhat randomly restrict to plain 
literals
                 {
                     if (compiler.getSourceManager().isMacroArgExpansion(l)
                         && Lexer::getImmediateMacroName(l, 
compiler.getSourceManager(),
@@ -266,10 +265,9 @@ private:
     bool isFromCIncludeFile(SourceLocation spellingLocation) const
     {
         return !compiler.getSourceManager().isInMainFile(spellingLocation)
-               && compat::ends_with(StringRef(compiler.getSourceManager()
-                                                  
.getPresumedLoc(spellingLocation)
-                                                  .getFilename()),
-                                    ".h");
+               && StringRef(
+                      
compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+                      .ends_with(".h");
     }
 
     bool isSharedCAndCppCode(SourceLocation location) const
diff --git a/compilerplugins/clang/cstylecast.cxx 
b/compilerplugins/clang/cstylecast.cxx
index 1be7bc1fb468..57af51cfe804 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -163,13 +163,13 @@ bool canBeUsedForFunctionalCast(TypeSourceInfo const * 
info) {
     }
 #if CLANG_VERSION >= 220000
     if (auto const t = dyn_cast<TagType>(type)) {
-        return t->getKeyword() == compat::ElaboratedTypeKeyword::None;
+        return t->getKeyword() == ElaboratedTypeKeyword::None;
     }
     if (auto const t = dyn_cast<TypedefType>(type)) {
-        return t->getKeyword() == compat::ElaboratedTypeKeyword::None;
+        return t->getKeyword() == ElaboratedTypeKeyword::None;
     }
     if (auto const t = dyn_cast<UsingType>(type)) {
-        return t->getKeyword() == compat::ElaboratedTypeKeyword::None;
+        return t->getKeyword() == ElaboratedTypeKeyword::None;
     }
 #else
     if (isa<TagType>(type) || isa<TypedefType>(type))
@@ -177,7 +177,7 @@ bool canBeUsedForFunctionalCast(TypeSourceInfo const * 
info) {
         return true;
     }
     if (auto const t = dyn_cast<ElaboratedType>(type)) {
-        return t->getKeyword() == compat::ElaboratedTypeKeyword::None;
+        return t->getKeyword() == ElaboratedTypeKeyword::None;
     }
 #endif
     return false;
@@ -336,9 +336,8 @@ bool CStyleCast::isConstCast(QualType from, QualType to) {
 
 bool CStyleCast::isFromCIncludeFile(SourceLocation spellingLocation) const {
     return !compiler.getSourceManager().isInMainFile(spellingLocation)
-        && compat::ends_with(
-            
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()),
-            ".h");
+        && 
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+           .ends_with(".h");
 }
 
 bool CStyleCast::isSharedCAndCppCode(SourceLocation location) const {
@@ -362,7 +361,7 @@ bool CStyleCast::isLastTokenOfImmediateMacroBodyExpansion(
     auto const spell = compiler.getSourceManager().getSpellingLoc(loc);
     auto name = Lexer::getImmediateMacroName(
         loc, compiler.getSourceManager(), compiler.getLangOpts());
-    while (compat::starts_with(name, "\
")) {
+    while (name.starts_with("\
")) {
         name = name.drop_front(2);
         while (!name.empty()
                && (name.front() == ' ' || name.front() == '    ' || 
name.front() == '
'
diff --git a/compilerplugins/clang/dynexcspec.cxx 
b/compilerplugins/clang/dynexcspec.cxx
index 483230e8cf31..52e52fcc21e9 100644
--- a/compilerplugins/clang/dynexcspec.cxx
+++ b/compilerplugins/clang/dynexcspec.cxx
@@ -13,7 +13,6 @@
 
 #include "clang/AST/Comment.h"
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Remove dynamic exception specifications.  See the mail thread starting at
@@ -80,7 +79,7 @@ public:
                 << decl->getSourceRange();
         }
         if (rewriter != nullptr) {
-            if (!(decl->isDefined() || compat::isPureVirtual(decl))) {
+            if (!(decl->isDefined() || decl->isPureVirtual())) {
                 return true;
             }
             if (auto m = dyn_cast<CXXMethodDecl>(decl)) {
@@ -116,7 +115,7 @@ public:
                         auto s = StringRef(
                             compiler.getSourceManager().getCharacterData(prev),
                             n);
-                        while (compat::starts_with(s, "\
")) {
+                        while (s.starts_with("\
")) {
                             s = s.drop_front(2);
                             while (!s.empty()
                                    && (s.front() == ' ' || s.front() == '      
'
@@ -127,7 +126,7 @@ public:
                             }
                         }
                         if (!s.empty() && s != "\") {
-                            if (compat::starts_with(s, "//")) {
+                            if (s.starts_with("//")) {
                                 beg = source.getBegin();
                             }
                             break;
diff --git a/compilerplugins/clang/elidestringvar.cxx 
b/compilerplugins/clang/elidestringvar.cxx
index 097120463ea0..d6ecc1e83096 100644
--- a/compilerplugins/clang/elidestringvar.cxx
+++ b/compilerplugins/clang/elidestringvar.cxx
@@ -12,10 +12,10 @@
 #include <algorithm>
 #include <cassert>
 #include <map>
+#include <optional>
 #include <stack>
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Find cases where a variable of a OString/OUString type is initialized
@@ -447,7 +447,7 @@ private:
         {
         }
         Stmt const* innermostLoop;
-        compat::optional<Expr const*> singleUse;
+        std::optional<Expr const*> singleUse;
     };
 
     std::stack<Stmt const*> innermostLoop_;
diff --git a/compilerplugins/clang/expressionalwayszero.cxx 
b/compilerplugins/clang/expressionalwayszero.cxx
index f741d30c426b..03814e6c87e5 100644
--- a/compilerplugins/clang/expressionalwayszero.cxx
+++ b/compilerplugins/clang/expressionalwayszero.cxx
@@ -12,6 +12,8 @@
 #include <iostream>
 #include <fstream>
 
+#include "llvm/ADT/StringExtras.h"
+
 #include "plugin.hxx"
 #include "compat.hxx"
 #include "check.hxx"
@@ -91,8 +93,8 @@ bool ExpressionAlwaysZero::VisitBinaryOperator(BinaryOperator 
const* binaryOpera
         return true;
     report(DiagnosticsEngine::Warning, "expression always evaluates to zero, 
lhs=%0 rhs=%1",
            binaryOperator->getBeginLoc())
-        << (lhsValue ? compat::toString(*lhsValue, 10) : "unknown")
-        << (rhsValue ? compat::toString(*rhsValue, 10) : "unknown")
+        << (lhsValue ? llvm::toString(*lhsValue, 10) : "unknown")
+        << (rhsValue ? llvm::toString(*rhsValue, 10) : "unknown")
         << binaryOperator->getSourceRange();
     return true;
 }
@@ -122,8 +124,8 @@ bool 
ExpressionAlwaysZero::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const* c
         return true;
     report(DiagnosticsEngine::Warning, "expression always evaluates to zero, 
lhs=%0 rhs=%1",
            cxxOperatorCallExpr->getBeginLoc())
-        << (lhsValue ? compat::toString(*lhsValue, 10) : "unknown")
-        << (rhsValue ? compat::toString(*rhsValue, 10) : "unknown")
+        << (lhsValue ? llvm::toString(*lhsValue, 10) : "unknown")
+        << (rhsValue ? llvm::toString(*rhsValue, 10) : "unknown")
         << cxxOperatorCallExpr->getSourceRange();
     return true;
 }
diff --git a/compilerplugins/clang/external.cxx 
b/compilerplugins/clang/external.cxx
index 0b8a1f5efbbb..a6e841a3efbd 100644
--- a/compilerplugins/clang/external.cxx
+++ b/compilerplugins/clang/external.cxx
@@ -469,7 +469,7 @@ private:
         {
             return true;
         }
-        if (decl->getLinkageInternal() < compat::Linkage::Module)
+        if (decl->getLinkageInternal() < Linkage::Module)
         {
             return true;
         }
diff --git a/compilerplugins/clang/externandnotdefined.cxx 
b/compilerplugins/clang/externandnotdefined.cxx
index 8b04670b99bb..2d33e8bca252 100644
--- a/compilerplugins/clang/externandnotdefined.cxx
+++ b/compilerplugins/clang/externandnotdefined.cxx
@@ -11,7 +11,6 @@
 
 #include <string>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Having an extern prototype for a method in a module and not actually 
declaring that method is dodgy.
@@ -34,9 +33,9 @@ bool ExternAndNotDefined::VisitFunctionDecl(const 
FunctionDecl * functionDecl) {
     if (ignoreLocation(functionDecl)) {
         return true;
     }
-    if (functionDecl->isDefined() || compat::isPureVirtual(functionDecl)
+    if (functionDecl->isDefined() || functionDecl->isPureVirtual()
       || (functionDecl->getLinkageAndVisibility().getLinkage()
-          != compat::Linkage::External)) {
+          != Linkage::External)) {
         return true;
     }
     //TODO, filtering out anything template for now:
diff --git a/compilerplugins/clang/fakebool.cxx 
b/compilerplugins/clang/fakebool.cxx
index 18d353f78a65..d782b7860733 100644
--- a/compilerplugins/clang/fakebool.cxx
+++ b/compilerplugins/clang/fakebool.cxx
@@ -19,7 +19,6 @@
 #include "config_clang.h"
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "functionaddress.hxx"
 #include "plugin.hxx"
 
@@ -374,7 +373,7 @@ void FakeBool::run() {
                            dyn_cast<FunctionDecl>(
                                decl->getDeclContext())
                            ->getNameInfo().getLoc()))
-                   || f->isDefined() || compat::isPureVirtual(f))
+                   || f->isDefined() || f->isPureVirtual())
                   && k != OverrideKind::MAYBE && rewrite(loc, fbk)))
             {
                 report(
@@ -425,7 +424,7 @@ void FakeBool::run() {
             if (!((compiler.getSourceManager().isInMainFile(
                        compiler.getSourceManager().getSpellingLoc(
                            decl->getNameInfo().getLoc()))
-                   || f->isDefined() || compat::isPureVirtual(f))
+                   || f->isDefined() || f->isPureVirtual())
                   && rewrite(loc, fbk)))
             {
                 report(
@@ -872,9 +871,8 @@ bool FakeBool::TraverseLinkageSpecDecl(LinkageSpecDecl * 
decl) {
 
 bool FakeBool::isFromCIncludeFile(SourceLocation spellingLocation) const {
     return !compiler.getSourceManager().isInMainFile(spellingLocation)
-        && compat::ends_with(
-            
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()),
-            ".h");
+        && 
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+           .ends_with(".h");
 }
 
 bool FakeBool::isSharedCAndCppCode(SourceLocation location) const {
diff --git a/compilerplugins/clang/fieldcanbelocal.cxx 
b/compilerplugins/clang/fieldcanbelocal.cxx
index bfb56b809e32..4a50ca81b799 100644
--- a/compilerplugins/clang/fieldcanbelocal.cxx
+++ b/compilerplugins/clang/fieldcanbelocal.cxx
@@ -260,9 +260,9 @@ bool FieldCanBeLocal::TraverseCXXMethodDecl(CXXMethodDecl* 
cxxMethodDecl)
     {
         if (cxxMethodDecl->isCopyAssignmentOperator() || 
cxxMethodDecl->isMoveAssignmentOperator()
             || (cxxMethodDecl->getIdentifier()
-                && (compat::starts_with(cxxMethodDecl->getName(), "Clone")
-                    || compat::starts_with(cxxMethodDecl->getName(), "clone")
-                    || compat::starts_with(cxxMethodDecl->getName(), 
"createClone"))))
+                && (cxxMethodDecl->getName().starts_with("Clone")
+                    || cxxMethodDecl->getName().starts_with("clone")
+                    || cxxMethodDecl->getName().starts_with("createClone"))))
             insideMoveOrCopyOrCloneDeclParent = cxxMethodDecl->getParent();
         // these are similar in that they tend to simply enumerate all the 
fields of an object without putting
         // them to some useful purpose
diff --git a/compilerplugins/clang/finalclasses.cxx 
b/compilerplugins/clang/finalclasses.cxx
index 2d19dd67d703..9b0d1b3656f8 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -12,7 +12,6 @@
 #include <string>
 #include <iostream>
 #include "config_clang.h"
-#include "compat.hxx"
 #include "plugin.hxx"
 #include <fstream>
 
@@ -77,9 +76,9 @@ private:
 bool ignoreClass(StringRef s)
 {
     // ignore stuff in the standard library, and UNO stuff we can't touch.
-    if (compat::starts_with(s, "rtl::") || compat::starts_with(s, "sal::")
-        || compat::starts_with(s, "com::sun::") || compat::starts_with(s, 
"std::")
-        || compat::starts_with(s, "boost::")
+    if (s.starts_with("rtl::") || s.starts_with("sal::")
+        || s.starts_with("com::sun::") || s.starts_with("std::")
+        || s.starts_with("boost::")
         || s == "OString" || s == "OUString" || s == "bad_alloc")
     {
         return true;
diff --git a/compilerplugins/clang/flatten.cxx 
b/compilerplugins/clang/flatten.cxx
index a3d57812d924..85f67778cf1e 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -7,12 +7,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "compat.hxx"
 #include "plugin.hxx"
 #include <cassert>
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <set>
 #include <stack>
 
@@ -49,7 +49,7 @@ private:
     SourceRange ignoreMacroExpansions(SourceRange range);
     SourceRange extendOverComments(SourceRange range);
     std::string getSourceAsString(SourceRange range);
-    compat::optional<std::string> invertCondition(
+    std::optional<std::string> invertCondition(
         Expr const * condExpr, SourceRange conditionRange);
     bool isLargeCompoundStmt(Stmt const *);
 
@@ -303,7 +303,7 @@ bool Flatten::rewrite1(IfStmt const * ifStmt)
 
     // in adjusting the formatting I assume that "{" starts on a new line
 
-    compat::optional<std::string> conditionString = 
invertCondition(ifStmt->getCond(), conditionRange);
+    std::optional<std::string> conditionString = 
invertCondition(ifStmt->getCond(), conditionRange);
     if (!conditionString)
         return false;
 
@@ -393,7 +393,7 @@ bool Flatten::rewriteLargeIf(IfStmt const * ifStmt)
 
     // in adjusting the formatting I assume that "{" starts on a new line
 
-    compat::optional<std::string> conditionString = 
invertCondition(ifStmt->getCond(), conditionRange);
+    std::optional<std::string> conditionString = 
invertCondition(ifStmt->getCond(), conditionRange);
     if (!conditionString)
         return false;
 
@@ -417,7 +417,7 @@ bool Flatten::rewriteLargeIf(IfStmt const * ifStmt)
     return true;
 }
 
-compat::optional<std::string> Flatten::invertCondition(Expr const * condExpr, 
SourceRange conditionRange)
+std::optional<std::string> Flatten::invertCondition(Expr const * condExpr, 
SourceRange conditionRange)
 {
     std::string s = getSourceAsString(conditionRange);
 
@@ -456,7 +456,7 @@ compat::optional<std::string> Flatten::invertCondition(Expr 
const * condExpr, So
                 s = "!(" + s + ")";
         }
         if (!ok)
-           return compat::optional<std::string>();
+           return std::optional<std::string>();
     }
     else if (auto opCallExpr = dyn_cast<CXXOperatorCallExpr>(condExpr))
     {
@@ -473,7 +473,7 @@ compat::optional<std::string> Flatten::invertCondition(Expr 
const * condExpr, So
                 s = "!(" + s + ")";
         }
         if (!ok)
-            return compat::optional<std::string>();
+            return std::optional<std::string>();
     }
     else if (isa<DeclRefExpr>(condExpr) || isa<CallExpr>(condExpr) || 
isa<MemberExpr>(condExpr))
         s = "!" + s;
diff --git a/compilerplugins/clang/getimplementationname.cxx 
b/compilerplugins/clang/getimplementationname.cxx
index 65cbabfdd4e9..9c91a62310c2 100644
--- a/compilerplugins/clang/getimplementationname.cxx
+++ b/compilerplugins/clang/getimplementationname.cxx
@@ -20,7 +20,6 @@
 #include <fstream>
 #include <regex>
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 #include "clang/Frontend/CompilerInstance.h"
 
@@ -171,7 +170,7 @@ bool GetImplementationName::isStringConstant(
     }
     clang::StringLiteral const * lit = dyn_cast<clang::StringLiteral>(expr);
     if (lit != nullptr) {
-        if (!compat::isOrdinary(lit)) {
+        if (!lit->isOrdinary()) {
             return false;
         }
         *string = lit->getString();
diff --git a/compilerplugins/clang/implicitboolconversion.cxx 
b/compilerplugins/clang/implicitboolconversion.cxx
index 5b0646a5e701..2b39525bc9ba 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -63,7 +63,7 @@ QualType reconstructTemplateArgumentType(
     SubstTemplateTypeParmType const * parmType)
 {
     TemplateParameterList const * ps = decl->getTemplateParameters();
-    auto i = std::find(ps->begin(), ps->end(), 
compat::getReplacedParameter(parmType));
+    auto i = std::find(ps->begin(), ps->end(), 
parmType->getReplacedParameter());
     if (i == ps->end()) {
         return {};
     }
@@ -867,7 +867,7 @@ void ImplicitBoolConversion::checkCXXConstructExpr(
                             = td->getTemplateParameters();
                         auto k = std::find(
                             ps->begin(), ps->end(),
-                            compat::getReplacedParameter(t2));
+                            t2->getReplacedParameter());
                         if (k != ps->end()) {
                             auto const args = t1->template_arguments();
                             if (ps->size() == args.size()) { //TODO
diff --git a/compilerplugins/clang/includeform.cxx 
b/compilerplugins/clang/includeform.cxx
index 173f9e28841b..3469394467cf 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -29,13 +29,7 @@ private:
     void InclusionDirective(
         SourceLocation HashLoc, Token const & IncludeTok, StringRef,
         bool IsAngled, CharSourceRange FilenameRange,
-#if CLANG_VERSION >= 160000
         OptionalFileEntryRef File,
-#elif CLANG_VERSION >= 150000
-        Optional<FileEntryRef> File,
-#else
-        FileEntry const * File,
-#endif
         StringRef SearchPath, StringRef, clang::Module const *,
 #if CLANG_VERSION >= 190000
         bool,
diff --git a/compilerplugins/clang/intvsfloat.cxx 
b/compilerplugins/clang/intvsfloat.cxx
index f6bd996a1e6d..96d1e996c72b 100644
--- a/compilerplugins/clang/intvsfloat.cxx
+++ b/compilerplugins/clang/intvsfloat.cxx
@@ -10,8 +10,8 @@
 
 #include "plugin.hxx"
 #include "check.hxx"
-#include "compat.hxx"
 #include <iostream>
+#include <optional>
 
 /**
 
@@ -35,7 +35,7 @@ public:
     bool VisitBinaryOperator(BinaryOperator const*);
 
 private:
-    compat::optional<double> getExprValue(Expr const* expr);
+    std::optional<double> getExprValue(Expr const* expr);
 };
 
 bool IntVsFloat::VisitVarDecl(VarDecl const* varDecl)
@@ -49,7 +49,7 @@ bool IntVsFloat::VisitVarDecl(VarDecl const* varDecl)
     if (varDecl->getType()->isFloatingType())
         return true;
     //    init->dump();
-    compat::optional<double> d = getExprValue(init);
+    std::optional<double> d = getExprValue(init);
     if (!d)
         return true;
     if (static_cast<long>(*d) == *d)
@@ -77,7 +77,7 @@ bool IntVsFloat::VisitBinaryOperator(BinaryOperator const* op)
         return true;
     if (rhs->getType()->isFloatingType())
         return true;
-    compat::optional<double> d = getExprValue(lhs);
+    std::optional<double> d = getExprValue(lhs);
     if (!d)
         return true;
     if (static_cast<long>(*d) == *d)
@@ -88,18 +88,18 @@ bool IntVsFloat::VisitBinaryOperator(BinaryOperator const* 
op)
     return true;
 }
 
-compat::optional<double> IntVsFloat::getExprValue(Expr const* expr)
+std::optional<double> IntVsFloat::getExprValue(Expr const* expr)
 {
     // Of the available clang Evaluate* APIs, this is the __only__ one that 
produces useful output
     // (as of 17 Aug 2018 checkout of clang, ie. towards clang 7)
 
     if (expr->isValueDependent())
-        return compat::optional<double>();
+        return std::optional<double>();
     Expr::EvalResult evalResult;
     if (!expr->EvaluateAsRValue(evalResult, compiler.getASTContext()))
-        return compat::optional<double>();
+        return std::optional<double>();
     if (!evalResult.Val.isFloat())
-        return compat::optional<double>();
+        return std::optional<double>();
     llvm::APFloat floatResult = evalResult.Val.getFloat();
     bool losesInfo;
     floatResult.convert(APFloat::IEEEdouble(), APFloat::rmNearestTiesToEven, 
&losesInfo);
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx 
b/compilerplugins/clang/literaltoboolconversion.cxx
index 3d3a3615ec68..e5602c5d9a01 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -12,6 +12,7 @@
 #include <limits>
 
 #include "clang/Lex/Lexer.h"
+#include "llvm/ADT/StringExtras.h"
 
 #include "compat.hxx"
 #include "plugin.hxx"
@@ -81,9 +82,8 @@ bool LiteralToBoolConversion::isFromCIncludeFile(
     SourceLocation spellingLocation) const
 {
     return !compiler.getSourceManager().isInMainFile(spellingLocation)
-        && compat::ends_with(
-            
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()),
-            ".h");
+        && 
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+           .ends_with(".h");
 }
 
 bool LiteralToBoolConversion::isSharedCAndCppCode(SourceLocation location) 
const
@@ -218,7 +218,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
                  " %1 with value %2 to %3"),
                 expr2->getBeginLoc())
                 << castExpr->getCastKindName() << subExpr->getType()
-                << compat::toString(*res, 10) << castExpr->getType()
+                << llvm::toString(*res, 10) << castExpr->getType()
                 << expr2->getSourceRange();
         }
     }
diff --git a/compilerplugins/clang/locking2.cxx 
b/compilerplugins/clang/locking2.cxx
index d31b29b2023e..df26228bec91 100644
--- a/compilerplugins/clang/locking2.cxx
+++ b/compilerplugins/clang/locking2.cxx
@@ -24,7 +24,6 @@
 
 #include "plugin.hxx"
 #include "check.hxx"
-#include "compat.hxx"
 
 #include "clang/AST/ParentMapContext.h"
 
@@ -185,7 +184,7 @@ private:
     bool isSomeKindOfZero(const Expr* arg);
     bool IsPassedByNonConst(const FieldDecl* fieldDecl, const Stmt* child, 
CallerWrapper callExpr,
                             CalleeWrapper calleeFunctionDecl);
-    compat::optional<CalleeWrapper> getCallee(CallExpr const*);
+    std::optional<CalleeWrapper> getCallee(CallExpr const*);
 
     RecordDecl* insideMoveOrCopyDeclParent = nullptr;
     // For reasons I do not understand, parentFunctionDecl() is not reliable, 
so
@@ -607,7 +606,7 @@ bool Locking2::IsPassedByNonConst(const FieldDecl* 
fieldDecl, const Stmt* child,
     return false;
 }
 
-compat::optional<CalleeWrapper> Locking2::getCallee(CallExpr const* callExpr)
+std::optional<CalleeWrapper> Locking2::getCallee(CallExpr const* callExpr)
 {
     FunctionDecl const* functionDecl = callExpr->getDirectCallee();
     if (functionDecl)
@@ -625,7 +624,7 @@ compat::optional<CalleeWrapper> 
Locking2::getCallee(CallExpr const* callExpr)
         }
     }
 
-    return compat::optional<CalleeWrapper>();
+    return std::optional<CalleeWrapper>();
 }
 
 bool Locking2::VisitCompoundStmt(const CompoundStmt* compoundStmt)
diff --git a/compilerplugins/clang/mergeclasses.cxx 
b/compilerplugins/clang/mergeclasses.cxx
index 5081517f402a..d9687904328f 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -12,7 +12,6 @@
 #include <string>
 #include <iostream>
 #include "config_clang.h"
-#include "compat.hxx"
 #include "plugin.hxx"
 #include <fstream>
 
@@ -87,15 +86,15 @@ public:
 bool ignoreClass(StringRef s)
 {
     // ignore stuff in the standard library, and UNO stuff we can't touch.
-    if (compat::starts_with(s, "rtl::") || compat::starts_with(s, "sal::")
-        || compat::starts_with(s, "com::sun::") || compat::starts_with(s, 
"std::")
-        || compat::starts_with(s, "boost::")
+    if (s.starts_with("rtl::") || s.starts_with("sal::")
+        || s.starts_with("com::sun::") || s.starts_with("std::")
+        || s.starts_with("boost::")
         || s == "OString" || s == "OUString" || s == "bad_alloc")
     {
         return true;
     }
     // ignore instantiations of pointers and arrays
-    if (compat::ends_with(s, "*") || compat::ends_with(s, "]")) {
+    if (s.ends_with("*") || s.ends_with("]")) {
         return true;
     }
     return false;
@@ -135,7 +134,7 @@ bool MergeClasses::VisitCXXConstructExpr( const 
CXXConstructExpr* pCXXConstructE
         return true;
     }
     // ignore calls when a sub-class is constructing its superclass
-    if (pCXXConstructExpr->getConstructionKind() != 
compat::CXXConstructionKind::Complete) {
+    if (pCXXConstructExpr->getConstructionKind() != 
CXXConstructionKind::Complete) {
         return true;
     }
     const CXXConstructorDecl* pCXXConstructorDecl = 
pCXXConstructExpr->getConstructor();
diff --git a/compilerplugins/clang/noexceptmove.cxx 
b/compilerplugins/clang/noexceptmove.cxx
index 9be55e870e61..84e52f288c07 100644
--- a/compilerplugins/clang/noexceptmove.cxx
+++ b/compilerplugins/clang/noexceptmove.cxx
@@ -9,11 +9,11 @@
 // versions before 9.0 didn't have getExceptionSpecType
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 #include "config_clang.h"
 
+#include <optional>
 #include <string>
 #include <set>
 
@@ -54,7 +54,7 @@ public:
     bool VisitVarDecl(const VarDecl*);
 
 private:
-    compat::optional<bool> IsCallThrows(const CallExpr* callExpr);
+    std::optional<bool> IsCallThrows(const CallExpr* callExpr);
     std::vector<bool> m_ConstructorThrows;
     std::vector<std::vector<const Decl*>> m_Exclusions;
     std::vector<bool> m_CannotFix;
@@ -172,7 +172,7 @@ bool NoExceptMove::VisitCallExpr(const CallExpr* callExpr)
         return true;
     if (m_ConstructorThrows.empty())
         return true;
-    compat::optional<bool> bCallThrows = IsCallThrows(callExpr);
+    std::optional<bool> bCallThrows = IsCallThrows(callExpr);
     if (!bCallThrows)
     {
         callExpr->dump();
@@ -251,7 +251,7 @@ bool NoExceptMove::VisitVarDecl(const VarDecl* varDecl)
     return true;
 }
 
-compat::optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr)
+std::optional<bool> NoExceptMove::IsCallThrows(const CallExpr* callExpr)
 {
     const FunctionDecl* calleeFunctionDecl = callExpr->getDirectCallee();
     if (calleeFunctionDecl)
@@ -302,7 +302,7 @@ compat::optional<bool> NoExceptMove::IsCallThrows(const 
CallExpr* callExpr)
     else
     {
         m_CannotFix.back() = true;
-        return compat::optional<bool>();
+        return std::optional<bool>();
     }
 
     // allowlist of functions that could be noexcept, but we can't change them 
because of backwards-compatibility reasons
@@ -316,7 +316,7 @@ compat::optional<bool> NoExceptMove::IsCallThrows(const 
CallExpr* callExpr)
     if (!funcProto)
     {
         m_CannotFix.back() = true;
-        return compat::optional<bool>();
+        return std::optional<bool>();
     }
 
     auto est = funcProto->getExceptionSpecType();
diff --git a/compilerplugins/clang/nullptr.cxx 
b/compilerplugins/clang/nullptr.cxx
index 3189013fbc69..65c1ef3f0c49 100644
--- a/compilerplugins/clang/nullptr.cxx
+++ b/compilerplugins/clang/nullptr.cxx
@@ -257,9 +257,8 @@ bool Nullptr::isInLokIncludeFile(SourceLocation 
spellingLocation) const {
 
 bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
     return !compiler.getSourceManager().isInMainFile(spellingLocation)
-        && compat::ends_with(
-            
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename()),
-            ".h");
+        && 
StringRef(compiler.getSourceManager().getPresumedLoc(spellingLocation).getFilename())
+           .ends_with(".h");
 }
 
 bool Nullptr::isSharedCAndCppCode(SourceLocation location) const {
diff --git a/compilerplugins/clang/ostr.cxx b/compilerplugins/clang/ostr.cxx
index 189b74da3152..3ade3d2db0e5 100644
--- a/compilerplugins/clang/ostr.cxx
+++ b/compilerplugins/clang/ostr.cxx
@@ -12,7 +12,6 @@
 #include <stack>
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Rewrite some uses of O[U]String to use ""_ostr/u""_ustr literals.
@@ -302,7 +301,7 @@ public:
         {
             return true;
         }
-        if (!(compat::isOrdinary(e2) || e2->isUTF8()))
+        if (!(e2->isOrdinary() || e2->isUTF8()))
         {
             return true;
         }
diff --git a/compilerplugins/clang/overridevirtual.cxx 
b/compilerplugins/clang/overridevirtual.cxx
index b7fd2ce4d9cc..ea4e1ce506b1 100644
--- a/compilerplugins/clang/overridevirtual.cxx
+++ b/compilerplugins/clang/overridevirtual.cxx
@@ -16,7 +16,6 @@
 
 #include "clang/AST/Attr.h"
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -95,7 +94,7 @@ bool OverrideVirtual::VisitCXXMethodDecl(CXXMethodDecl const 
* decl) {
             // where "\<NL>" is followed directly by a real token without
             // intervening whitespace, tokens "\<NL>virtual" and "\<NL>{" are
             // reported:
-            if (compat::starts_with(s, "\
")) {
+            if (s.starts_with("\
")) {
                 s = s.drop_front(2);
             }
             if (parens == 0) {
@@ -121,7 +120,7 @@ bool OverrideVirtual::VisitCXXMethodDecl(CXXMethodDecl 
const * decl) {
                     addSpace = false;
                 }
                 seenSpace = true;
-            } else if (compat::starts_with(s, "/*") || compat::starts_with(s, 
"//") || s == "\") {
+            } else if (s.starts_with("/*") || s.starts_with("//") || s == "\") 
{
                 if (!seenSpace) {
                     addSpace = true;
                 }
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index bec85eb9ac01..4fdc5da2f6c4 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -203,7 +203,7 @@ bool Plugin::suppressWarningAt(SourceLocation location) 
const {
                 if (isDebugMode()) {
                     report(DiagnosticsEngine::Fatal, "failed to getSpelling", 
prev);
                 }
-            } else if (!compat::starts_with(spell, "/*")) {
+            } else if (!spell.starts_with("/*")) {
                 continue;
             }
         }
@@ -441,7 +441,7 @@ StringRef Plugin::getFilenameOfLocation(SourceLocation 
spellingLocation) const
             return fn;
         }
 #if !defined _WIN32
-        assert(compat::starts_with(fn, "/") || fn == "<stdin>");
+        assert(fn.starts_with("/") || fn == "<stdin>");
 #endif
         s_Mode = fn == "<stdin>" ? STDIN : GOOD;
         return getFilenameOfLocation(spellingLocation);
@@ -876,8 +876,8 @@ bool RewritePlugin::wouldRewriteWorkdir(SourceLocation loc)
     if (loc.isInvalid() || loc.isMacroID()) {
         return false;
     }
-    return compat::starts_with(
-        
getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(loc)), WORKDIR 
"/");
+    return 
getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(loc)).starts_with(
+        WORKDIR "/");
 }
 
 bool RewritePlugin::reportEditFailure( SourceLocation loc )
@@ -931,7 +931,7 @@ bool hasPathnamePrefix(StringRef pathname, StringRef prefix)
 {
     return checkPathname(
         pathname, prefix,
-        [](StringRef p, StringRef a) { return compat::starts_with(p, a); });
+        [](StringRef p, StringRef a) { return p.starts_with(a); });
 }
 
 bool isSamePathname(StringRef pathname, StringRef other)
@@ -1029,7 +1029,7 @@ int derivedFromCount(QualType subclassQt, QualType 
baseclassQt)
 // a variable declared in an 'extern "..." {...}'-style linkage-specification 
as
 // if it contained the 'extern' specifier:
 bool hasExternalLinkage(VarDecl const * decl) {
-    if (decl->getLinkageAndVisibility().getLinkage() != 
compat::Linkage::External) {
+    if (decl->getLinkageAndVisibility().getLinkage() != Linkage::External) {
         return false;
     }
     for (auto ctx = decl->getLexicalDeclContext();
diff --git a/compilerplugins/clang/pluginhandler.cxx 
b/compilerplugins/clang/pluginhandler.cxx
index 0fb62eb56c48..b9a2a2afa9b6 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -15,7 +15,6 @@
 
 #include "config_clang.h"
 
-#include "compat.hxx"
 #include "plugin.hxx"
 #include "pluginhandler.hxx"
 
@@ -319,7 +318,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& 
context )
     llvm::TimeTraceScope mainTimeScope("LOPluginMain", StringRef(""));
     if( context.getDiagnostics().hasErrorOccurred())
         return;
-    if (compat::ends_with(mainFileName, ".ii"))
+    if (mainFileName.ends_with(".ii"))
     {
         report(DiagnosticsEngine::Fatal,
             "input file has suffix .ii: \"%0\"
highly suspicious, probably ccache generated, this will break warning 
suppressions; export CCACHE_CPP2=1 to prevent this") << mainFileName;
@@ -354,11 +353,11 @@ void PluginHandler::HandleTranslationUnit( ASTContext& 
context )
         const char* pathWarning = NULL;
         bool bSkip = false;
         StringRef const name = e->getName();
-        if( compat::starts_with(name, WORKDIR "/") )
+        if( name.starts_with(WORKDIR "/") )
             pathWarning = "modified source in workdir/ : %0";
-        else if( strcmp( SRCDIR, BUILDDIR ) != 0 && compat::starts_with(name, 
BUILDDIR "/") )
+        else if( strcmp( SRCDIR, BUILDDIR ) != 0 && name.starts_with(BUILDDIR 
"/") )
             pathWarning = "modified source in build dir : %0";
-        else if( compat::starts_with(name, SRCDIR "/") )
+        else if( name.starts_with(SRCDIR "/") )
             ; // ok
         else
         {
@@ -430,7 +429,7 @@ static bool MethodsAndNestedClassesComplete(const 
CXXRecordDecl *RD,
        I != E && Complete; ++I) {
     if (const CXXMethodDecl *M = dyn_cast<CXXMethodDecl>(*I))
       Complete = M->isDefined() || M->isDefaulted() ||
-                 (compat::isPureVirtual(M) && !isa<CXXDestructorDecl>(M));
+                 (M->isPureVirtual() && !isa<CXXDestructorDecl>(M));
     else if (const FunctionTemplateDecl *F = 
dyn_cast<FunctionTemplateDecl>(*I))
       // If the template function is marked as late template parsed at this
       // point, it has not been instantiated and therefore we have not
diff --git a/compilerplugins/clang/pointerbool.cxx 
b/compilerplugins/clang/pointerbool.cxx
index 6530c76e7179..6225286a3dff 100644
--- a/compilerplugins/clang/pointerbool.cxx
+++ b/compilerplugins/clang/pointerbool.cxx
@@ -11,6 +11,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <set>
 
 #include <clang/AST/CXXInheritance.h>
@@ -47,7 +48,7 @@ public:
     bool VisitCallExpr(CallExpr const*);
 
 private:
-    compat::optional<APSInt> getCallValue(const Expr* arg);
+    std::optional<APSInt> getCallValue(const Expr* arg);
     std::vector<FunctionDecl*> functions_;
 };
 
@@ -115,7 +116,7 @@ bool PointerBool::VisitCallExpr(CallExpr const* callExpr)
         if (arg->getType()->isIntegerType())
         {
             auto ret = getCallValue(arg);
-            if (compat::has_value(ret) && (compat::value(ret) == 1 || 
compat::value(ret) == 0))
+            if (ret.has_value() && (*ret == 1 || *ret == 0))
                 continue;
             // something like: priv->m_nLOKFeatures & 
LOK_FEATURE_DOCUMENT_PASSWORD
             if (isa<BinaryOperator>(arg->IgnoreParenImpCasts()))
@@ -140,7 +141,7 @@ bool PointerBool::VisitCallExpr(CallExpr const* callExpr)
     return true;
 }
 
-compat::optional<APSInt> PointerBool::getCallValue(const Expr* arg)
+std::optional<APSInt> PointerBool::getCallValue(const Expr* arg)
 {
     arg = arg->IgnoreParenCasts();
     if (auto defArg = dyn_cast<CXXDefaultArgExpr>(arg))
@@ -150,14 +151,14 @@ compat::optional<APSInt> PointerBool::getCallValue(const 
Expr* arg)
     // ignore this, it seems to trigger an infinite recursion
     if (isa<UnaryExprOrTypeTraitExpr>(arg))
     {
-        return compat::optional<APSInt>();
+        return std::optional<APSInt>();
     }
     APSInt x1;
     if (compat::EvaluateAsInt(arg, x1, compiler.getASTContext()))
     {
         return x1;
     }
-    return compat::optional<APSInt>();
+    return std::optional<APSInt>();
 }
 
 loplugin::Plugin::Registration<PointerBool> pointerbool("pointerbool");
diff --git a/compilerplugins/clang/privatebase.cxx 
b/compilerplugins/clang/privatebase.cxx
index 677461302b15..42ec090caf57 100644
--- a/compilerplugins/clang/privatebase.cxx
+++ b/compilerplugins/clang/privatebase.cxx
@@ -9,7 +9,6 @@
 
 #ifndef LO_CLANG_SHARED_PLUGINS
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -34,7 +33,7 @@ void PrivateBase::run() {
 
 bool PrivateBase::VisitCXXRecordDecl(CXXRecordDecl const * decl) {
     if (ignoreLocation(decl) || !decl->isThisDeclarationADefinition()
-        || decl->getTagKind() != compat::TagTypeKind::Class)
+        || decl->getTagKind() != TagTypeKind::Class)
     {
         return true;
     }
diff --git a/compilerplugins/clang/redundantcast.cxx 
b/compilerplugins/clang/redundantcast.cxx
index 283553db72fa..78b1e70e14f2 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -53,12 +53,12 @@ bool canConstCastFromTo(Expr const * from, Expr const * to) 
{
     auto const k2 = to->getValueKind();
     return (k2 == VK_LValue && k1 == VK_LValue)
         || (k2 == VK_XValue
-            && (k1 != compat::VK_PRValue || from->getType()->isRecordType()));
+            && (k1 != VK_PRValue || from->getType()->isRecordType()));
 }
 
 char const * printExprValueKind(ExprValueKind k) {
     switch (k) {
-    case compat::VK_PRValue:
+    case VK_PRValue:
         return "prvalue";
     case VK_LValue:
         return "lvalue";
@@ -590,7 +590,7 @@ bool 
RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
          " written as an explicit construction of a temporary}4"),
         expr->getExprLoc())
         << t1 << printExprValueKind(k1) << t2 << printExprValueKind(k3)
-        << (k3 == compat::VK_PRValue && (k1 != compat::VK_PRValue || 
t1->isRecordType()))
+        << (k3 == VK_PRValue && (k1 != VK_PRValue || t1->isRecordType()))
         << expr->getSourceRange();
     return true;
 }
@@ -617,7 +617,7 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
         {
             if (loplugin::TypeCheck(sub->getType()).Pointer().Const().Char()) {
                 if (auto const lit = 
dyn_cast<clang::StringLiteral>(expr->getSubExprAsWritten())) {
-                    if (lit->getKind() == compat::StringLiteralKind::UTF8) {
+                    if (lit->getKind() == StringLiteralKind::UTF8) {
                         // Don't warn about
                         //
                         //   redundant_cast<char const *>(u8"...")
@@ -805,7 +805,7 @@ bool 
RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
     auto const t1 = expr->getTypeAsWritten();
     bool const fnptr = t1->isFunctionPointerType() || 
t1->isMemberFunctionPointerType();
     auto const sub = fnptr ? stopAtFunctionPointerDecay(expr) : 
compat::getSubExprAsWritten(expr);
-    if ((sub->getValueKind() != compat::VK_PRValue && !fnptr) || 
expr->getType()->isRecordType()
+    if ((sub->getValueKind() != VK_PRValue && !fnptr) || 
expr->getType()->isRecordType()
         || isa<InitListExpr>(sub) || isa<CXXStdInitializerListExpr>(sub))
     {
         return true;
diff --git a/compilerplugins/clang/redundantfcast.cxx 
b/compilerplugins/clang/redundantfcast.cxx
index 8a78fee4144f..3a0a8b34cb9a 100644
--- a/compilerplugins/clang/redundantfcast.cxx
+++ b/compilerplugins/clang/redundantfcast.cxx
@@ -16,8 +16,6 @@
 #include <unordered_set>
 #include <vector>
 
-#include "config_clang.h"
-
 namespace
 {
 class RedundantFCast final : public loplugin::FilteringPlugin<RedundantFCast>
@@ -242,7 +240,7 @@ public:
                     report(DiagnosticsEngine::Fatal,
                            "TODO: unexpected std::function with %0 template 
arguments",
                            expr->getExprLoc())
-                        << compat::diagnosticSize(args.size()) << 
expr->getSourceRange();
+                        << args.size() << expr->getSourceRange();
                 }
                 return false;
             }
@@ -297,10 +295,8 @@ public:
             return true;
         if (isa<CXXStdInitializerListExpr>(e))
             return true;
-#if CLANG_VERSION >= 160000
         if (isa<CXXParenListInitExpr>(e))
             return true;
-#endif
         auto const t1 = expr->getTypeAsWritten();
         auto const t2 = compat::getSubExprAsWritten(expr)->getType();
         if (!(t1.getCanonicalType().getTypePtr() == 
t2.getCanonicalType().getTypePtr()
diff --git a/compilerplugins/clang/redundantinline.cxx 
b/compilerplugins/clang/redundantinline.cxx
index c9491445b64f..44dab7545ad6 100644
--- a/compilerplugins/clang/redundantinline.cxx
+++ b/compilerplugins/clang/redundantinline.cxx
@@ -10,7 +10,6 @@
 
 #include <cassert>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -55,7 +54,7 @@ private:
                 loc, compiler.getSourceManager(), compiler.getLangOpts());
             StringRef s(compiler.getSourceManager().getCharacterData(loc), n);
             //TODO: see compilerplugins/clang/override.cxx:
-            if (compat::starts_with(s, "\
")) {
+            if (s.starts_with("\
")) {
                 s = s.drop_front(2);
             }
             if (s == "inline") {
@@ -87,7 +86,7 @@ private:
                 StringRef s(
                     compiler.getSourceManager().getCharacterData(loc), n2);
                 //TODO: see compilerplugins/clang/override.cxx:
-                if (compat::starts_with(s, "\
")) {
+                if (s.starts_with("\
")) {
                     s = s.drop_front(2);
                 }
                 if (!s.empty()) {
@@ -142,7 +141,7 @@ private:
     }
 
     bool handleNonExternalLinkage(FunctionDecl const * decl) {
-        if (decl->getLinkageInternal() >= compat::Linkage::Module) {
+        if (decl->getLinkageInternal() >= Linkage::Module) {
             return false;
         }
         if (!compiler.getSourceManager().isInMainFile(decl->getLocation())) {
diff --git a/compilerplugins/clang/reservedid.cxx 
b/compilerplugins/clang/reservedid.cxx
index 8fad7739065a..a5daa439a7c2 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -19,7 +19,6 @@
 
 #include "config_clang.h"
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -34,7 +33,7 @@ bool isJniFunction(NamedDecl const * decl) {
         return false;
     }
     auto const id = decl->getIdentifier();
-    return id != nullptr && compat::starts_with(id->getName(), "Java_");
+    return id != nullptr && id->getName().starts_with("Java_");
 }
 
 class ReservedId:
@@ -147,7 +146,7 @@ bool ReservedId::VisitNamedDecl(NamedDecl const * decl) {
     }
     auto filename = getFilenameOfLocation(spelLoc);
     if (loplugin::hasPathnamePrefix(filename, SRCDIR 
"/bridges/source/cpp_uno/")
-        && (compat::ends_with(filename, "abi.hxx") || 
compat::ends_with(filename, "share.hxx")))
+        && (filename.ends_with("abi.hxx") || filename.ends_with("share.hxx")))
     {
         return true;
     }
diff --git a/compilerplugins/clang/returnconstant.cxx 
b/compilerplugins/clang/returnconstant.cxx
index 530044c9609d..cc0d240aad74 100644
--- a/compilerplugins/clang/returnconstant.cxx
+++ b/compilerplugins/clang/returnconstant.cxx
@@ -15,6 +15,8 @@
 #include <set>
 #include <string>
 
+#include "llvm/ADT/StringExtras.h"
+
 /*
   Look for member functions that merely return a compile-time constant, or 
they are empty, and can thus
   be either removed, or converted into a constant.
@@ -185,7 +187,7 @@ std::string ReturnConstant::getExprValue(Expr const* arg)
     APSInt x1;
     if (compat::EvaluateAsInt(arg, x1, compiler.getASTContext()))
     {
-        return compat::toString(x1, 10);
+        return llvm::toString(x1, 10);
     }
     if (isa<CXXNullPtrLiteralExpr>(arg))
     {
diff --git a/compilerplugins/clang/salcall.cxx 
b/compilerplugins/clang/salcall.cxx
index 0c017755c836..79864a289d41 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -152,7 +152,7 @@ bool SalCall::VisitFunctionDecl(FunctionDecl const* decl)
     if (!bCanonicalDeclIsSalCall)
         return true;
 
-    if (!decl->isThisDeclarationADefinition() && !(methodDecl && 
compat::isPureVirtual(methodDecl)))
+    if (!decl->isThisDeclarationADefinition() && !(methodDecl && 
methodDecl->isPureVirtual()))
         return true;
 
     m_decls.insert(decl);
@@ -370,7 +370,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* 
functionDecl, SourceLocation
             assert(SM.isMacroBodyExpansion(startLoc));
             auto const startLoc2 = compat::getImmediateExpansionRange(SM, 
startLoc).second;
             auto name = Lexer::getImmediateMacroName(startLoc, SM, 
compiler.getLangOpts());
-            while (compat::starts_with(name, "\
"))
+            while (name.starts_with("\
"))
             {
                 name = name.drop_front(2);
                 while (!name.empty()
@@ -412,7 +412,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* 
functionDecl, SourceLocation
         if (SM.isMacroBodyExpansion(endLoc))
         {
             auto name = Lexer::getImmediateMacroName(endLoc, SM, 
compiler.getLangOpts());
-            while (compat::starts_with(name, "\
"))
+            while (name.starts_with("\
"))
             {
                 name = name.drop_front(2);
                 while (!name.empty()
@@ -505,8 +505,8 @@ bool SalCall::isSalCallFunction(FunctionDecl const* 
functionDecl, SourceLocation
                     // in the first line and include the intervening spaces 
and (part of? looks like an
                     // error in Clang) "barbaz", so just skip any tokens 
starting with backslash-newline
                     // when looking backwards here, without even trying to 
look at their content:
-                    if (!(s.empty() || compat::starts_with(s, "/*") || 
compat::starts_with(s, "//")
-                          || compat::starts_with(s, "\
")))
+                    if (!(s.empty() || s.starts_with("/*") || 
s.starts_with("//")
+                          || s.starts_with("\
")))
                     {
                         break;
                     }
@@ -531,8 +531,8 @@ bool SalCall::isSalCallFunction(FunctionDecl const* 
functionDecl, SourceLocation
                     // in the first line and include the intervening spaces 
and (part of? looks like an
                     // error in Clang) "barbaz", so just skip any tokens 
starting with backslash-newline
                     // when looking backwards here, without even trying to 
look at their content:
-                    if (!(s.empty() || compat::starts_with(s, "/*") || 
compat::starts_with(s, "//")
-                          || compat::starts_with(s, "\
")))
+                    if (!(s.empty() || s.starts_with("/*") || 
s.starts_with("//")
+                          || s.starts_with("\
")))
                     {
                         break;
                     }
@@ -567,7 +567,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* 
functionDecl, SourceLocation
         {
             unsigned n = Lexer::MeasureTokenLength(loc, SM, 
compiler.getLangOpts());
             auto s = 
StringRef(compiler.getSourceManager().getCharacterData(loc), n);
-            while (compat::starts_with(s, "\
"))
+            while (s.starts_with("\
"))
             {
                 s = s.drop_front(2);
                 while (!s.empty()
diff --git a/compilerplugins/clang/sallogareas.cxx 
b/compilerplugins/clang/sallogareas.cxx
index d1f111c1e666..adee6e7348ea 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( compat::isOrdinary(area) )
+        if( area->isOrdinary() )
             checkArea( area->getBytes(), area->getExprLoc());
         else
             report( DiagnosticsEngine::Warning, "unsupported string literal 
kind (plugin needs fixing?)",
diff --git a/compilerplugins/clang/salunicodeliteral.cxx 
b/compilerplugins/clang/salunicodeliteral.cxx
index 0a8eeea4885b..66e2d3f5829d 100644
--- a/compilerplugins/clang/salunicodeliteral.cxx
+++ b/compilerplugins/clang/salunicodeliteral.cxx
@@ -9,14 +9,13 @@
 #ifndef LO_CLANG_SHARED_PLUGINS
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
 
 bool isAsciiCharacterLiteral(Expr const * expr) {
     if (auto const e = dyn_cast<CharacterLiteral>(expr)) {
-        return e->getKind() == compat::CharacterLiteralKind::Ascii;
+        return e->getKind() == CharacterLiteralKind::Ascii;
     }
     return false;
 }
diff --git a/compilerplugins/clang/sharedvisitor/analyzer.cxx 
b/compilerplugins/clang/sharedvisitor/analyzer.cxx
index bfcc836f5298..db331ffdd982 100644
--- a/compilerplugins/clang/sharedvisitor/analyzer.cxx
+++ b/compilerplugins/clang/sharedvisitor/analyzer.cxx
@@ -25,7 +25,6 @@
 #include "config_clang.h"
 #include "../check.hxx"
 #include "../check.cxx"
-#include "../compat.hxx"
 
 using namespace clang;
 using namespace llvm;
@@ -127,7 +126,7 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* 
decl )
             continue;
         if( method->isStatic() || method->getAccess() != AS_public )
             continue;
-        if( compat::starts_with(method->getName(), "Visit" ))
+        if( method->getName().starts_with( "Visit" ))
         {
             if( method->getNumParams() == 1 )
             {
@@ -146,7 +145,7 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* 
decl )
                 abort();
             }
         }
-        else if( compat::starts_with(method->getName(), "Traverse" ))
+        else if( method->getName().starts_with( "Traverse" ))
         {
             if( method->getNumParams() == 1 )
             {
@@ -171,13 +170,13 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* 
decl )
                 abort();
             }
         }
-        else if( compat::starts_with(method->getName(), "PreTraverse" ))
+        else if( method->getName().starts_with( "PreTraverse" ))
         {
             TraverseFunctionInfo traverseInfo = 
findOrCreateTraverseFunctionInfo( method->getName().substr( 3 ));
             traverseInfo.hasPre = true;
             traverseFunctions.insert( std::move( traverseInfo ));
         }
-        else if( compat::starts_with(method->getName(), "PostTraverse" ))
+        else if( method->getName().starts_with( "PostTraverse" ))
         {
                 TraverseFunctionInfo traverseInfo = 
findOrCreateTraverseFunctionInfo( method->getName().substr( 4 ));
                 traverseInfo.hasPost = true;
@@ -187,7 +186,7 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* 
decl )
             std::cout << "ShouldVisitTemplateInstantiations:1" << std::endl;
         else if (method->getName() == "shouldVisitImplicitCode")
             std::cout << "ShouldVisitImplicitCode:1" << std::endl;
-        else if( compat::starts_with(method->getName(), "WalkUp" ))
+        else if( method->getName().starts_with( "WalkUp" ))
         {
             std::cerr << "WalkUp function not supported for shared visitor: " 
<< decl->getName().str()
                  << "::" << method->getName().str() << std::endl;
diff --git a/compilerplugins/clang/simplifypointertobool.cxx 
b/compilerplugins/clang/simplifypointertobool.cxx
index 1a9471fcf877..ac09c9e6608d 100644
--- a/compilerplugins/clang/simplifypointertobool.cxx
+++ b/compilerplugins/clang/simplifypointertobool.cxx
@@ -19,7 +19,6 @@
 
 #include "plugin.hxx"
 #include "check.hxx"
-#include "compat.hxx"
 
 /**
   Simplify boolean expressions involving smart pointers e.g.
@@ -263,7 +262,7 @@ private:
             auto const s = 
StringRef(compiler.getSourceManager().getCharacterData(start),
                                      Lexer::MeasureTokenLength(start, 
compiler.getSourceManager(),
                                                                
compiler.getLangOpts()));
-            if (s.empty() || compat::starts_with(s, "\
"))
+            if (s.empty() || s.starts_with("\
"))
             {
                 continue;
             }
@@ -280,7 +279,7 @@ private:
             auto const s = 
StringRef(compiler.getSourceManager().getCharacterData(start1),
                                      Lexer::MeasureTokenLength(start1, 
compiler.getSourceManager(),
                                                                
compiler.getLangOpts()));
-            if (!(s.empty() || compat::starts_with(s, "\
")))
+            if (!(s.empty() || s.starts_with("\
")))
             {
                 break;
             }
diff --git a/compilerplugins/clang/singlevalfields.cxx 
b/compilerplugins/clang/singlevalfields.cxx
index 5ff7a635b79e..b2dbd3f301c7 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -19,6 +19,7 @@
 #include "plugin.hxx"
 
 #include "clang/AST/ParentMapContext.h"
+#include "llvm/ADT/StringExtras.h"
 
 /**
 Look for fields that are only ever assigned a single constant value.
@@ -291,7 +292,7 @@ void SingleValFields::walkPotentialAssign( const 
DeclaratorDecl* fieldOrVarDecl,
         if (methodDecl && (methodDecl->isCopyAssignmentOperator() || 
methodDecl->isMoveAssignmentOperator()))
            return;
         if (methodDecl && methodDecl->getIdentifier()
-            && (compat::starts_with(methodDecl->getName(), "Clone") || 
compat::starts_with(methodDecl->getName(), "clone")))
+            && (methodDecl->getName().starts_with("Clone") || 
methodDecl->getName().starts_with("clone")))
            return;
         auto cxxConstructorDecl = dyn_cast<CXXConstructorDecl>(parentFunction);
         if (cxxConstructorDecl && 
cxxConstructorDecl->isCopyOrMoveConstructor())
@@ -572,7 +573,7 @@ std::string SingleValFields::getExprValue(const Expr* arg)
     }
     APSInt x1;
     if (compat::EvaluateAsInt(arg, x1, compiler.getASTContext()))
-        return compat::toString(x1, 10);
+        return llvm::toString(x1, 10);
     if (isa<CXXNullPtrLiteralExpr>(arg))
         return "0";
     return "?";
diff --git a/compilerplugins/clang/staticconstfield.cxx 
b/compilerplugins/clang/staticconstfield.cxx
index 74aad462fa3c..fc37545893a4 100644
--- a/compilerplugins/clang/staticconstfield.cxx
+++ b/compilerplugins/clang/staticconstfield.cxx
@@ -15,6 +15,8 @@
 #include <unordered_set>
 #include <vector>
 
+#include "llvm/ADT/StringExtras.h"
+
 /**
  Look for fields which are const, which can be made static const
 */
@@ -135,7 +137,7 @@ bool 
StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
         APSInt x1;
         if (compat::EvaluateAsInt(initexpr, x1, compiler.getASTContext()))
         {
-            value = compat::toString(x1, 10);
+            value = llvm::toString(x1, 10);
             found = true;
         }
     }
diff --git a/compilerplugins/clang/stringadd.cxx 
b/compilerplugins/clang/stringadd.cxx
index 179490e16463..c3891d2177ab 100644
--- a/compilerplugins/clang/stringadd.cxx
+++ b/compilerplugins/clang/stringadd.cxx
@@ -477,7 +477,7 @@ bool StringAdd::isSideEffectFree(Expr const* expr)
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
                 // allowlist some known-safe methods
-                if (compat::ends_with(name, "ResId") || name == "GetXMLToken")
+                if (name.ends_with("ResId") || name == "GetXMLToken")
                     if (isSideEffectFree(callExpr->getArg(0)))
                         return true;
             }
diff --git a/compilerplugins/clang/stringconstant.cxx 
b/compilerplugins/clang/stringconstant.cxx
index 344125dd4df0..c3d4d538f02d 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -19,6 +19,8 @@
 #include <vector>
 #include <iostream>
 
+#include "llvm/ADT/StringExtras.h"
+
 #include "check.hxx"
 #include "compat.hxx"
 #include "plugin.hxx"
@@ -994,7 +996,7 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr 
const * expr) {
                         ("suspicious 'rtl::OUString' constructor with literal"
                          " of length %0 and non-matching length argument %1"),
                         expr->getExprLoc())
-                        << n << compat::toString(res, 10) << 
expr->getSourceRange();
+                        << n << llvm::toString(res, 10) << 
expr->getSourceRange();
                     return true;
                 }
                 APSInt enc;
@@ -1018,7 +1020,7 @@ bool 
StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
                          " encoding %0 but plain ASCII content; use"
                          " 'RTL_TEXTENCODING_ASCII_US' instead"),
                         expr->getArg(2)->getExprLoc())
-                        << compat::toString(enc, 10) << expr->getSourceRange();
+                        << llvm::toString(enc, 10) << expr->getSourceRange();
                     return true;
                 }
                 if (encIsUtf8) {
@@ -1428,7 +1430,7 @@ bool StringConstant::isStringConstant(
     }
     clang::StringLiteral const * lit = dyn_cast<clang::StringLiteral>(expr);
     if (lit != nullptr) {
-        if (!(compat::isOrdinary(lit) || lit->isUTF8())) {
+        if (!(lit->isOrdinary() || lit->isUTF8())) {
             return false;
         }
         unsigned n = lit->getLength();
@@ -2089,7 +2091,7 @@ void StringConstant::handleStringCtor(
                 if (!first) {
                     StringRef s(
                         compiler.getSourceManager().getCharacterData(loc2), n);
-                    while (compat::starts_with(s, "\
")) {
+                    while (s.starts_with("\
")) {
                         s = s.drop_front(2);
                         while (!s.empty()
                                && (s.front() == ' ' || s.front() == '  '
@@ -2099,7 +2101,7 @@ void StringConstant::handleStringCtor(
                             s = s.drop_front(1);
                         }
                     }
-                    if (!(s.empty() || compat::starts_with(s, "/*") || 
compat::starts_with(s, "//")
+                    if (!(s.empty() || s.starts_with("/*") || 
s.starts_with("//")
                           || s == "\"))
                     {
                         break;
@@ -2115,7 +2117,7 @@ void StringConstant::handleStringCtor(
                 unsigned n = Lexer::MeasureTokenLength(
                     l, compiler.getSourceManager(), compiler.getLangOpts());
                 StringRef s(compiler.getSourceManager().getCharacterData(l), 
n);
-                while (compat::starts_with(s, "\
")) {
+                while (s.starts_with("\
")) {
                     s = s.drop_front(2);
                     while (!s.empty()
                            && (s.front() == ' ' || s.front() == '      '
@@ -2125,7 +2127,7 @@ void StringConstant::handleStringCtor(
                         s = s.drop_front(1);
                     }
                 }
-                if (!(s.empty() || compat::starts_with(s, "/*") || 
compat::starts_with(s, "//")
+                if (!(s.empty() || s.starts_with("/*") || s.starts_with("//")
                       || s == "\"))
                 {
                     break;
diff --git a/compilerplugins/clang/test/redundantfcast.cxx 
b/compilerplugins/clang/test/redundantfcast.cxx
index 190918adde9b..b71d05629567 100644
--- a/compilerplugins/clang/test/redundantfcast.cxx
+++ b/compilerplugins/clang/test/redundantfcast.cxx
@@ -9,7 +9,6 @@
 
 #include "sal/config.h"
 
-#include "config_clang.h"
 #include "rtl/ustring.hxx"
 #include "tools/color.hxx"
 
@@ -233,9 +232,7 @@ struct S
 void f()
 {
     (void)S{ 0 };
-#if CLANG_VERSION >= 160000
     (void)S(0);
-#endif
 }
 }
 
diff --git a/compilerplugins/clang/test/unreffun.cxx 
b/compilerplugins/clang/test/unreffun.cxx
index 315c699b7748..9af9f12e7431 100644
--- a/compilerplugins/clang/test/unreffun.cxx
+++ b/compilerplugins/clang/test/unreffun.cxx
@@ -7,8 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#include "config_clang.h"
-
 #include "unreffun.hxx"
 
 template <typename> struct S
@@ -40,12 +38,7 @@ void l() // expected-error {{Unreferenced externally visible 
function definition
 
 void m()
 {
-// The below produced a false "Unreferenced externally invisible function 
definition" for Local::f
-// prior to 
<https://github.com/llvm/llvm-project/commit/d812488d3c54c07f24d4bef79e329f17e7f19c3b>
-// "Call MarkVirtualMembersReferenced on an actual class definition" in Clang 
17:
-#if CLANG_VERSION >= 170000
     struct Local;
-#endif
     struct Local
     {
         virtual void f() {}
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx 
b/compilerplugins/clang/unnecessaryvirtual.cxx
index b376f97c9b07..86326860040e 100644
--- a/compilerplugins/clang/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -13,7 +13,6 @@
 #include <set>
 #include <unordered_set>
 #include "config_clang.h"
-#include "compat.hxx"
 #include "plugin.hxx"
 #include <fstream>
 
@@ -167,7 +166,7 @@ bool UnnecessaryVirtual::VisitCXXMethodDecl( const 
CXXMethodDecl* methodDecl )
        {
            const CXXMethodDecl *overriddenMethod = *iter;
            // we only care about the first level override to establish that a 
virtual qualifier was useful.
-           if (compat::isPureVirtual(overriddenMethod)
+           if (overriddenMethod->isPureVirtual()
                || overriddenMethod->size_overridden_methods() == 0)
            {
                std::string aOverriddenNiceName = niceName(overriddenMethod);
diff --git a/compilerplugins/clang/unoaggregation.cxx 
b/compilerplugins/clang/unoaggregation.cxx
index a3be33f395f7..f68d1e4f9f44 100644
--- a/compilerplugins/clang/unoaggregation.cxx
+++ b/compilerplugins/clang/unoaggregation.cxx
@@ -18,7 +18,6 @@
 #include <cassert>
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace
@@ -86,7 +85,7 @@ bool basesHaveOnlyPureQueryInterface(CXXRecordDecl const* 
decl)
             {
                 continue;
             }
-            if (!compat::isPureVirtual(d2))
+            if (!d2->isPureVirtual())
             {
                 return false;
             }
diff --git a/compilerplugins/clang/unreffun.cxx 
b/compilerplugins/clang/unreffun.cxx
index fcb6f04016b7..340e166b1fd9 100644
--- a/compilerplugins/clang/unreffun.cxx
+++ b/compilerplugins/clang/unreffun.cxx
@@ -16,7 +16,6 @@
 #include "clang/AST/Attr.h"
 #include "clang/Sema/SemaInternal.h" // warn_unused_function
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -153,7 +152,7 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) 
{
         return true;
     }
     LinkageInfo info(canon->getLinkageAndVisibility());
-    if (info.getLinkage() == compat::Linkage::External
+    if (info.getLinkage() == Linkage::External
         && loplugin::hasCLanguageLinkageType(canon) && canon->isDefined()
         && ((decl == canon && info.getVisibility() == DefaultVisibility)
             || ((canon->hasAttr<ConstructorAttr>()
diff --git a/compilerplugins/clang/unusedfields.cxx 
b/compilerplugins/clang/unusedfields.cxx
index 0a0cf161a9be..c231cfd77bdc 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -13,6 +13,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <unordered_set>
 #include <vector>
 #include <algorithm>
@@ -171,7 +172,7 @@ private:
     bool checkForUsingMap(const CXXMethodDecl * calleeMethodDecl);
     bool IsPassedByNonConst(const FieldDecl* fieldDecl, const Stmt * child, 
CallerWrapper callExpr,
                                         CalleeWrapper calleeFunctionDecl);
-    compat::optional<CalleeWrapper> getCallee(CallExpr const *);
+    std::optional<CalleeWrapper> getCallee(CallExpr const *);
 
     RecordDecl *   insideMoveOrCopyOrCloneDeclParent = nullptr;
     RecordDecl *   insideStreamOutputOperator = nullptr;
@@ -409,9 +410,9 @@ bool UnusedFields::TraverseCXXMethodDecl(CXXMethodDecl* 
cxxMethodDecl)
         if (cxxMethodDecl->isCopyAssignmentOperator()
             || cxxMethodDecl->isMoveAssignmentOperator()
             || (cxxMethodDecl->getIdentifier()
-                && (compat::starts_with(cxxMethodDecl->getName(), "Clone")
-                    || compat::starts_with(cxxMethodDecl->getName(), "clone")
-                    || compat::starts_with(cxxMethodDecl->getName(), 
"createClone"))))
+                && (cxxMethodDecl->getName().starts_with("Clone")
+                    || cxxMethodDecl->getName().starts_with("clone")
+                    || cxxMethodDecl->getName().starts_with("createClone"))))
             insideMoveOrCopyOrCloneDeclParent = cxxMethodDecl->getParent();
         // these are similar in that they tend to simply enumerate all the 
fields of an object without putting
         // them to some useful purpose
@@ -1215,7 +1216,7 @@ void UnusedFields::checkTouchedFromOutside(const 
FieldDecl* fieldDecl, const Exp
     }
 }
 
-compat::optional<CalleeWrapper> UnusedFields::getCallee(CallExpr const * 
callExpr)
+std::optional<CalleeWrapper> UnusedFields::getCallee(CallExpr const * callExpr)
 {
     FunctionDecl const * functionDecl = callExpr->getDirectCallee();
     if (functionDecl)
@@ -1229,7 +1230,7 @@ compat::optional<CalleeWrapper> 
UnusedFields::getCallee(CallExpr const * callExp
         }
     }
 
-    return compat::optional<CalleeWrapper>();
+    return std::optional<CalleeWrapper>();
 }
 
 loplugin::Plugin::Registration< UnusedFields > X("unusedfields", false);
diff --git a/compilerplugins/clang/unusedvarsglobal.cxx 
b/compilerplugins/clang/unusedvarsglobal.cxx
index 5b97cf8dcb11..cce822a82bdb 100644
--- a/compilerplugins/clang/unusedvarsglobal.cxx
+++ b/compilerplugins/clang/unusedvarsglobal.cxx
@@ -13,6 +13,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <unordered_set>
 #include <vector>
 #include <algorithm>
@@ -165,7 +166,7 @@ private:
     bool checkForWriteWhenUsingCollectionType(const CXXMethodDecl* 
calleeMethodDecl);
     bool IsPassedByNonConst(const VarDecl* fieldDecl, const Stmt* child, 
CallerWrapper callExpr,
                             CalleeWrapper calleeFunctionDecl);
-    compat::optional<CalleeWrapper> getCallee(CallExpr const*);
+    std::optional<CalleeWrapper> getCallee(CallExpr const*);
 
     // For reasons I do not understand, parentFunctionDecl() is not reliable, 
so
     // we store the parent function on the way down the AST.
@@ -933,7 +934,7 @@ bool UnusedVarsGlobal::IsPassedByNonConst(const VarDecl* 
varDecl, const Stmt* ch
     return false;
 }
 
-compat::optional<CalleeWrapper> UnusedVarsGlobal::getCallee(CallExpr const* 
callExpr)
+std::optional<CalleeWrapper> UnusedVarsGlobal::getCallee(CallExpr const* 
callExpr)
 {
     FunctionDecl const* functionDecl = callExpr->getDirectCallee();
     if (functionDecl)
@@ -951,7 +952,7 @@ compat::optional<CalleeWrapper> 
UnusedVarsGlobal::getCallee(CallExpr const* call
         }
     }
 
-    return compat::optional<CalleeWrapper>();
+    return std::optional<CalleeWrapper>();
 }
 
 loplugin::Plugin::Registration<UnusedVarsGlobal> X("unusedvarsglobal", false);
diff --git a/compilerplugins/clang/vclwidgets.cxx 
b/compilerplugins/clang/vclwidgets.cxx
index 06194db9d8bd..5c946f42efaf 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -851,7 +851,7 @@ bool VCLWidgets::VisitCXXConstructExpr( const 
CXXConstructExpr* constructExpr )
     if (ignoreLocation(constructExpr)) {
         return true;
     }
-    if (constructExpr->getConstructionKind() != 
compat::CXXConstructionKind::Complete) {
+    if (constructExpr->getConstructionKind() != CXXConstructionKind::Complete) 
{
         return true;
     }
     const CXXConstructorDecl* pConstructorDecl = 
constructExpr->getConstructor();
diff --git a/compilerplugins/clang/virtualdead.cxx 
b/compilerplugins/clang/virtualdead.cxx
index e3cdf2b45018..783cc4af32e0 100644
--- a/compilerplugins/clang/virtualdead.cxx
+++ b/compilerplugins/clang/virtualdead.cxx
@@ -11,6 +11,8 @@
 #include "check.hxx"
 #include "compat.hxx"
 
+#include "llvm/ADT/StringExtras.h"
+
 #include <cassert>
 #include <string>
 #include <iostream>
@@ -205,7 +207,7 @@ std::string VirtualDead::getCallValue(const Expr* arg)
     APSInt x1;
     if (compat::EvaluateAsInt(arg, x1, compiler.getASTContext()))
     {
-        return compat::toString(x1, 10);
+        return llvm::toString(x1, 10);
     }
     if (isa<CXXNullPtrLiteralExpr>(arg))
     {
diff --git a/compilerplugins/clang/writeonlyvars.cxx 
b/compilerplugins/clang/writeonlyvars.cxx
index efb5d1be1f6e..a9b62e00f02c 100644
--- a/compilerplugins/clang/writeonlyvars.cxx
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -13,6 +13,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <optional>
 #include <unordered_set>
 #include <vector>
 #include <algorithm>
@@ -162,7 +163,7 @@ private:
     bool checkForWriteWhenUsingCollectionType(const CXXMethodDecl* 
calleeMethodDecl);
     bool IsPassedByNonConst(const VarDecl* varDecl, const Stmt* child, 
CallerWrapper callExpr,
                             CalleeWrapper calleeFunctionDecl);
-    compat::optional<CalleeWrapper> getCallee(CallExpr const*);
+    std::optional<CalleeWrapper> getCallee(CallExpr const*);
 
     // For reasons I do not understand, parentFunctionDecl() is not reliable, 
so
     // we store the parent function on the way down the AST.
@@ -1110,7 +1111,7 @@ bool WriteOnlyVars::VisitDeclRefExpr(const DeclRefExpr* 
declRefExpr)
     return true;
 }
 
-compat::optional<CalleeWrapper> WriteOnlyVars::getCallee(CallExpr const* 
callExpr)
+std::optional<CalleeWrapper> WriteOnlyVars::getCallee(CallExpr const* callExpr)
 {
     FunctionDecl const* functionDecl = callExpr->getDirectCallee();
     if (functionDecl)
@@ -1128,7 +1129,7 @@ compat::optional<CalleeWrapper> 
WriteOnlyVars::getCallee(CallExpr const* callExp
         }
     }
 
-    return compat::optional<CalleeWrapper>();
+    return std::optional<CalleeWrapper>();
 }
 
 loplugin::Plugin::Registration<WriteOnlyVars> X("writeonlyvars", false);
diff --git a/compilerplugins/clang/xmlimport.cxx 
b/compilerplugins/clang/xmlimport.cxx
index 0dc18346c2ed..41e6520d90f9 100644
--- a/compilerplugins/clang/xmlimport.cxx
+++ b/compilerplugins/clang/xmlimport.cxx
@@ -370,8 +370,7 @@ bool XmlImport::isXmlTokEnum(const Expr* expr)
     auto enumConstant = dyn_cast<EnumConstantDecl>(declRefExpr->getDecl());
     if (!enumConstant)
         return false;
-    return enumConstant->getIdentifier()
-           && compat::starts_with(enumConstant->getName(), "XML_TOK_");
+    return enumConstant->getIdentifier() && 
enumConstant->getName().starts_with("XML_TOK_");
 }
 
 bool XmlImport::isUInt16(const Expr* expr)
commit fab0a9be45c4fda06c034234bf37c95c93476515
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Fri Dec 5 14:14:22 2025 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Sun Dec 7 16:46:46 2025 +0100

    Remove unused included
    
    ...that d1a2b80b9dc146c7fe63d2657e5506f49d6e5c0d "Bump compiler plugins 
Clang
    baseline to 12.0.1" forgot
    
    Change-Id: I87f2282ea076e66cb211b097dca4f0b86aecce68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195098
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 2be5e7f190a3..e8e5a44f16cc 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -20,7 +20,6 @@
 #include "clang/Basic/Specifiers.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FileSystem.h"
 
 #include "config_clang.h"
 

Reply via email to