commit:     88754454c980fbe0ba8287c2840d094821824891
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  9 03:44:50 2025 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat Aug  9 03:46:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88754454

dev-util/ccls: Add LLVM 20 compatibility

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 ...{ccls-9999.ebuild => ccls-0.20241108-r1.ebuild} | 10 ++-
 dev-util/ccls/ccls-9999.ebuild                     |  6 +-
 ...rg-20-init-12964-gdf9a14d7bbf1-createDiag.patch | 81 ++++++++++++++++++++++
 3 files changed, 91 insertions(+), 6 deletions(-)

diff --git a/dev-util/ccls/ccls-9999.ebuild 
b/dev-util/ccls/ccls-0.20241108-r1.ebuild
similarity index 80%
copy from dev-util/ccls/ccls-9999.ebuild
copy to dev-util/ccls/ccls-0.20241108-r1.ebuild
index 3096200e66e5..0ee2c04edbcc 100644
--- a/dev-util/ccls/ccls-9999.ebuild
+++ b/dev-util/ccls/ccls-0.20241108-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Gentoo Authors
+# Copyright 2020-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -7,9 +7,9 @@ EGIT_REPO_URI="https://github.com/MaskRay/${PN}";
 
 if [[ ${PV} = 9999* ]]; then
        GIT_ECLASS="git-r3"
-       LLVM_COMPAT=( {18..19} )
+       LLVM_COMPAT=( {18..20} )
 else
-       LLVM_COMPAT=( {18..19} )
+       LLVM_COMPAT=( {18..20} )
 fi
 
 inherit cmake llvm-r1 ${GIT_ECLASS}
@@ -34,6 +34,10 @@ DEPEND="
 "
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+       
"${FILESDIR}"/${PV}-Adapt-llvmorg-20-init-12964-gdf9a14d7bbf1-createDiag.patch
+)
+
 src_configure() {
        local mycmakeargs=(
                -DCCLS_VERSION=${PV}

diff --git a/dev-util/ccls/ccls-9999.ebuild b/dev-util/ccls/ccls-9999.ebuild
index 3096200e66e5..daccb07638b1 100644
--- a/dev-util/ccls/ccls-9999.ebuild
+++ b/dev-util/ccls/ccls-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020-2024 Gentoo Authors
+# Copyright 2020-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -7,9 +7,9 @@ EGIT_REPO_URI="https://github.com/MaskRay/${PN}";
 
 if [[ ${PV} = 9999* ]]; then
        GIT_ECLASS="git-r3"
-       LLVM_COMPAT=( {18..19} )
+       LLVM_COMPAT=( {18..20} )
 else
-       LLVM_COMPAT=( {18..19} )
+       LLVM_COMPAT=( {18..20} )
 fi
 
 inherit cmake llvm-r1 ${GIT_ECLASS}

diff --git 
a/dev-util/ccls/files/0.20241108-Adapt-llvmorg-20-init-12964-gdf9a14d7bbf1-createDiag.patch
 
b/dev-util/ccls/files/0.20241108-Adapt-llvmorg-20-init-12964-gdf9a14d7bbf1-createDiag.patch
new file mode 100644
index 000000000000..fde0de85b902
--- /dev/null
+++ 
b/dev-util/ccls/files/0.20241108-Adapt-llvmorg-20-init-12964-gdf9a14d7bbf1-createDiag.patch
@@ -0,0 +1,81 @@
+From 4331c8958698d42933bf4e132f8a7d61f3cedb8c Mon Sep 17 00:00:00 2001
+From: Fangrui Song <[email protected]>
+Date: Sat, 23 Nov 2024 18:25:48 -0800
+Subject: [PATCH] Adapt llvmorg-20-init-12964-gdf9a14d7bbf1: createDiagnostics
+
+---
+ src/clang_tu.cc     |  8 +++++---
+ src/indexer.cc      |  6 +++++-
+ src/sema_manager.cc | 13 ++++++++++---
+ 3 files changed, 20 insertions(+), 7 deletions(-)
+
+diff --git ./src/clang_tu.cc ./src/clang_tu.cc
+index 32be1733..54e04ef0 100644
+--- ./src/clang_tu.cc
++++ ./src/clang_tu.cc
+@@ -124,9 +124,11 @@ buildCompilerInvocation(const std::string &main, 
std::vector<const char *> args,
+     args.insert(args.begin() + 1, std::begin(arr), std::end(arr));
+   }
+ 
+-  IntrusiveRefCntPtr<DiagnosticsEngine> diags(
+-      CompilerInstance::createDiagnostics(new DiagnosticOptions,
+-                                          new IgnoringDiagConsumer, true));
++  IntrusiveRefCntPtr<DiagnosticsEngine> 
diags(CompilerInstance::createDiagnostics(
++#if LLVM_VERSION_MAJOR >= 20
++      *vfs,
++#endif
++      new DiagnosticOptions, new IgnoringDiagConsumer, true));
+ #if LLVM_VERSION_MAJOR < 12 // llvmorg-12-init-5498-g257b29715bb
+   driver::Driver d(args[0], llvm::sys::getDefaultTargetTriple(), *diags, vfs);
+ #else
+diff --git ./src/indexer.cc ./src/indexer.cc
+index b81f1d9f..dff4ae2d 100644
+--- ./src/indexer.cc
++++ ./src/indexer.cc
+@@ -1312,7 +1312,11 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS 
*vfs,
+   IndexDiags dc;
+   auto clang = std::make_unique<CompilerInstance>(pch);
+   clang->setInvocation(std::move(ci));
+-  clang->createDiagnostics(&dc, false);
++  clang->createDiagnostics(
++#if LLVM_VERSION_MAJOR >= 20
++      *fs,
++#endif
++      &dc, false);
+   clang->getDiagnostics().setIgnoreAllWarnings(true);
+   clang->setTarget(TargetInfo::CreateTargetInfo(
+       clang->getDiagnostics(), clang->getInvocation().TargetOpts));
+diff --git ./src/sema_manager.cc ./src/sema_manager.cc
+index bf806e47..59aaed02 100644
+--- ./src/sema_manager.cc
++++ ./src/sema_manager.cc
+@@ -288,7 +288,11 @@ buildCompilerInstance(Session &session, 
std::unique_ptr<CompilerInvocation> ci,
+ 
+   auto clang = std::make_unique<CompilerInstance>(session.pch);
+   clang->setInvocation(std::move(ci));
+-  clang->createDiagnostics(&dc, false);
++  clang->createDiagnostics(
++#if LLVM_VERSION_MAJOR >= 20
++      *fs,
++#endif
++      &dc, false);
+   clang->setTarget(TargetInfo::CreateTargetInfo(
+       clang->getDiagnostics(), clang->getInvocation().TargetOpts));
+   if (!clang->hasTarget())
+@@ -368,8 +372,11 @@ void buildPreamble(Session &session, CompilerInvocation 
&ci,
+ #endif
+ 
+   StoreDiags dc(task.path);
+-  IntrusiveRefCntPtr<DiagnosticsEngine> de =
+-      CompilerInstance::createDiagnostics(&ci.getDiagnosticOpts(), &dc, 
false);
++  IntrusiveRefCntPtr<DiagnosticsEngine> de = 
CompilerInstance::createDiagnostics(
++#if LLVM_VERSION_MAJOR >= 20
++      *fs,
++#endif
++      &ci.getDiagnosticOpts(), &dc, false);
+   if (oldP) {
+     std::lock_guard lock(session.wfiles->mutex);
+     for (auto &include : oldP->includes)
+-- 
+2.49.1
+

Reply via email to