compilerplugins/clang/compat.hxx                 |   10 ++++++++++
 compilerplugins/clang/implicitboolconversion.cxx |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit aa674ac4b5018c7e1ba8e60135ac5202fa67529a
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Mon Oct 17 16:23:51 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Tue Oct 18 08:06:18 2022 +0200

    Adapt compilerplugins to recent Clang 16 trunk change
    
    
<https://github.com/llvm/llvm-project/commit/bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c>
    "[clang] Track the templated entity in type substitution."
    
    Change-Id: I314d1567512dc0332b3c61c95978b0230f52b274
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141462
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 625e43220206..b5941c52fced 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -152,6 +152,16 @@ inline bool isOrdinary(clang::StringLiteral const * expr) {
 #endif
 }
 
+inline clang::TemplateTypeParmDecl const * getReplacedParameter(
+    clang::SubstTemplateTypeParmType const * type)
+{
+#if CLANG_VERSION >= 160000
+    return type->getReplacedParameter();
+#else
+    return type->getReplacedParameter()->getDecl();
+#endif
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/implicitboolconversion.cxx 
b/compilerplugins/clang/implicitboolconversion.cxx
index 29b82d8eae25..b6ab52ea5798 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(), 
parmType->getReplacedParameter()->getDecl());
+    auto i = std::find(ps->begin(), ps->end(), 
compat::getReplacedParameter(parmType));
     if (i == ps->end()) {
         return {};
     }
@@ -844,7 +844,7 @@ void ImplicitBoolConversion::checkCXXConstructExpr(
                             = td->getTemplateParameters();
                         auto k = std::find(
                             ps->begin(), ps->end(),
-                            t2->getReplacedParameter()->getDecl());
+                            compat::getReplacedParameter(t2));
                         if (k != ps->end()) {
                             if (ps->size() == t1->getNumArgs()) { //TODO
                                 TemplateArgument const & arg = t1->getArg(

Reply via email to