[gentoo-commits] repo/gentoo:master commit in: dev-util/ccls/, dev-util/ccls/files/

2022-03-27 Thread Sam James
commit: bf70fc6f858192032083797585be058d5091bf2f
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 28 01:20:26 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 28 01:20:26 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf70fc6f

dev-util/ccls: fix CMake configure error

Closes: https://bugs.gentoo.org/835916
Signed-off-by: Sam James  gentoo.org>

 dev-util/ccls/ccls-0.20210330.ebuild |  6 +-
 dev-util/ccls/files/ccls-0.20210330-llvm-cmake.patch | 18 ++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/dev-util/ccls/ccls-0.20210330.ebuild 
b/dev-util/ccls/ccls-0.20210330.ebuild
index 377cc36c8068..9b48ac669633 100644
--- a/dev-util/ccls/ccls-0.20210330.ebuild
+++ b/dev-util/ccls/ccls-0.20210330.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -32,6 +32,10 @@ DEPEND="
 "
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+   "${FILESDIR}"/${P}-llvm-cmake.patch
+)
+
 src_configure() {
local mycmakeargs=(
-DCCLS_VERSION=${PV}

diff --git a/dev-util/ccls/files/ccls-0.20210330-llvm-cmake.patch 
b/dev-util/ccls/files/ccls-0.20210330-llvm-cmake.patch
new file mode 100644
index ..8d8db4483db5
--- /dev/null
+++ b/dev-util/ccls/files/ccls-0.20210330-llvm-cmake.patch
@@ -0,0 +1,18 @@
+https://github.com/MaskRay/ccls/commit/dce86b1362acbabb8f997869fdaa27adc67f9a55.patch
+https://bugs.gentoo.org/835916
+
+From: Fangrui Song 
+Date: Wed, 15 Dec 2021 10:13:29 -0800
+Subject: [PATCH] cmake: Add LANGUAGE C to fix find_package(Clang REQUIRED)
+ error
+
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -1,5 +1,5 @@
+ cmake_minimum_required(VERSION 3.8)
+-project(ccls LANGUAGES CXX)
++project(ccls LANGUAGES CXX C)
+ 
+ option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git 
submodule if exists" ON)
+ 
+



[gentoo-commits] repo/gentoo:master commit in: dev-util/ccls/, dev-util/ccls/files/

2022-03-27 Thread Sam James
commit: 649e483cce1e297b115e2267540e12e978413098
Author: Sam James  gentoo  org>
AuthorDate: Mon Mar 28 01:29:20 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Mar 28 01:29:20 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=649e483c

dev-util/ccls: add LLVM 14 patches; use llvm.eclass

Signed-off-by: Sam James  gentoo.org>

 ...{ccls-.ebuild => ccls-0.20210330-r1.ebuild} |  17 ++-
 dev-util/ccls/ccls-.ebuild |  17 ++-
 dev-util/ccls/files/ccls-0.20210330-llvm14.patch   | 139 +
 3 files changed, 165 insertions(+), 8 deletions(-)

diff --git a/dev-util/ccls/ccls-.ebuild 
b/dev-util/ccls/ccls-0.20210330-r1.ebuild
similarity index 65%
copy from dev-util/ccls/ccls-.ebuild
copy to dev-util/ccls/ccls-0.20210330-r1.ebuild
index 377cc36c8068..f2069853b3f4 100644
--- a/dev-util/ccls/ccls-.ebuild
+++ b/dev-util/ccls/ccls-0.20210330-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -7,9 +7,12 @@ EGIT_REPO_URI="https://github.com/MaskRay/${PN};
 
 if [[ ${PV} = * ]]; then
GIT_ECLASS="git-r3"
+   LLVM_MAX_SLOT=
+else
+   LLVM_MAX_SLOT=14
 fi
 
-inherit cmake ${GIT_ECLASS}
+inherit cmake llvm ${GIT_ECLASS}
 
 DESCRIPTION="C/C++/ObjC language server"
 HOMEPAGE="https://github.com/MaskRay/ccls;
@@ -25,13 +28,19 @@ LICENSE="Apache-2.0"
 SLOT="0"
 IUSE=""
 
+# We only depend on Clang because of a quirk in how dependencies work
+# See comment in llvm.eclass docs
 DEPEND="
dev-libs/rapidjson
-   sys-devel/clang:=
-   sys-devel/llvm:=
+   https://github.com/MaskRay/${PN};
 
 if [[ ${PV} = * ]]; then
GIT_ECLASS="git-r3"
+   LLVM_MAX_SLOT=
+else
+   LLVM_MAX_SLOT=14
 fi
 
-inherit cmake ${GIT_ECLASS}
+inherit cmake llvm ${GIT_ECLASS}
 
 DESCRIPTION="C/C++/ObjC language server"
 HOMEPAGE="https://github.com/MaskRay/ccls;
@@ -25,13 +28,19 @@ LICENSE="Apache-2.0"
 SLOT="0"
 IUSE=""
 
+# We only depend on Clang because of a quirk in how dependencies work
+# See comment in llvm.eclass docs
 DEPEND="
dev-libs/rapidjson
-   sys-devel/clang:=
-   sys-devel/llvm:=
+   https://github.com/MaskRay/ccls/commit/3ce756e39ae48204f016a58684652ad62b4dd9f9.patch
+https://github.com/MaskRay/ccls/commit/8422f0a522b6fbcb4412a8ec73d80b4acbc7e00f.patch
+https://github.com/MaskRay/ccls/commit/790daca4b2d9d5873623fee86283cd61212df674.patch
+
+From: Fangrui Song 
+Date: Thu, 23 Sep 2021 13:36:01 -0700
+Subject: [PATCH] Adaopt llvmorg-14-init-3863-g601102d282d5: refactor
+ clang::isIdentifierBody
+
+---
+ src/clang_tu.hh  | 4 
+ src/indexer.cc   | 6 +++---
+ src/working_files.cc | 9 ++---
+ 3 files changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/src/clang_tu.hh b/src/clang_tu.hh
+index b37950926..7dbfc4a88 100644
+--- a/src/clang_tu.hh
 b/src/clang_tu.hh
+@@ -17,6 +17,10 @@ namespace vfs = clang::vfs;
+ }
+ #endif
+ 
++#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5
++#define isAsciiIdentifierContinue isIdentifierBody
++#endif
++
+ namespace ccls {
+ std::string pathFromFileEntry(const clang::FileEntry );
+ 
+diff --git a/src/indexer.cc b/src/indexer.cc
+index 89d78959e..644c0ccbb 100644
+--- a/src/indexer.cc
 b/src/indexer.cc
+@@ -527,8 +527,8 @@ class IndexDataConsumer : public index::IndexDataConsumer {
+ auto i = name.find(short_name);
+ if (short_name.size())
+   while (i != std::string::npos &&
+- ((i && isIdentifierBody(name[i - 1])) ||
+-  isIdentifierBody(name[i + short_name.size()])))
++ ((i && isAsciiIdentifierContinue(name[i - 1])) ||
++  isAsciiIdentifierContinue(name[i + short_name.size()])))
+ i = name.find(short_name, i + short_name.size());
+ if (i == std::string::npos) {
+   // e.g. operator type-parameter-1
+@@ -552,7 +552,7 @@ class IndexDataConsumer : public index::IndexDataConsumer {
+ paren++;
+   else if (name[i - 1] == '(')
+ paren--;
+-  else if (!(paren > 0 || isIdentifierBody(name[i - 1]) ||
++  else if (!(paren > 0 || isAsciiIdentifierContinue(name[i - 1]) ||
+  name[i - 1] == ':'))
+ break;
+ }
+diff --git a/src/working_files.cc b/src/working_files.cc
+index f80f21053..4904388be 100644
+--- a/src/working_files.cc
 b/src/working_files.cc
+@@ -342,7 +342,10 @@ std::optional 
WorkingFile::getIndexPosFromBufferPos(int line, int *column,
+ Position WorkingFile::getCompletionPosition(Position pos, std::string 
*filter) const {
+   int start = getOffsetForPosition(pos, buffer_content);
+   int i = start;
+-  while (i > 0 && isIdentifierBody(buffer_content[i - 1]))
++#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5
++#define isAsciiIdentifierContinue isIdentifierBody
++#endif
++  while (i > 0 &&