1 |
commit: 649e483cce1e297b115e2267540e12e978413098 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Mar 28 01:29:20 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Mar 28 01:29:20 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=649e483c |
7 |
|
8 |
dev-util/ccls: add LLVM 14 patches; use llvm.eclass |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
|
12 |
...{ccls-9999.ebuild => ccls-0.20210330-r1.ebuild} | 17 ++- |
13 |
dev-util/ccls/ccls-9999.ebuild | 17 ++- |
14 |
dev-util/ccls/files/ccls-0.20210330-llvm14.patch | 139 +++++++++++++++++++++ |
15 |
3 files changed, 165 insertions(+), 8 deletions(-) |
16 |
|
17 |
diff --git a/dev-util/ccls/ccls-9999.ebuild b/dev-util/ccls/ccls-0.20210330-r1.ebuild |
18 |
similarity index 65% |
19 |
copy from dev-util/ccls/ccls-9999.ebuild |
20 |
copy to dev-util/ccls/ccls-0.20210330-r1.ebuild |
21 |
index 377cc36c8068..f2069853b3f4 100644 |
22 |
--- a/dev-util/ccls/ccls-9999.ebuild |
23 |
+++ b/dev-util/ccls/ccls-0.20210330-r1.ebuild |
24 |
@@ -1,4 +1,4 @@ |
25 |
-# Copyright 2020 Gentoo Authors |
26 |
+# Copyright 2020-2022 Gentoo Authors |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
EAPI=7 |
30 |
@@ -7,9 +7,12 @@ EGIT_REPO_URI="https://github.com/MaskRay/${PN}" |
31 |
|
32 |
if [[ ${PV} = 9999* ]]; then |
33 |
GIT_ECLASS="git-r3" |
34 |
+ LLVM_MAX_SLOT=9999 |
35 |
+else |
36 |
+ LLVM_MAX_SLOT=14 |
37 |
fi |
38 |
|
39 |
-inherit cmake ${GIT_ECLASS} |
40 |
+inherit cmake llvm ${GIT_ECLASS} |
41 |
|
42 |
DESCRIPTION="C/C++/ObjC language server" |
43 |
HOMEPAGE="https://github.com/MaskRay/ccls" |
44 |
@@ -25,13 +28,19 @@ LICENSE="Apache-2.0" |
45 |
SLOT="0" |
46 |
IUSE="" |
47 |
|
48 |
+# We only depend on Clang because of a quirk in how dependencies work |
49 |
+# See comment in llvm.eclass docs |
50 |
DEPEND=" |
51 |
dev-libs/rapidjson |
52 |
- sys-devel/clang:= |
53 |
- sys-devel/llvm:= |
54 |
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):= |
55 |
" |
56 |
RDEPEND="${DEPEND}" |
57 |
|
58 |
+PATCHES=( |
59 |
+ "${FILESDIR}"/${P}-llvm-cmake.patch |
60 |
+ "${FILESDIR}"/${P}-llvm14.patch |
61 |
+) |
62 |
+ |
63 |
src_configure() { |
64 |
local mycmakeargs=( |
65 |
-DCCLS_VERSION=${PV} |
66 |
|
67 |
diff --git a/dev-util/ccls/ccls-9999.ebuild b/dev-util/ccls/ccls-9999.ebuild |
68 |
index 377cc36c8068..f2069853b3f4 100644 |
69 |
--- a/dev-util/ccls/ccls-9999.ebuild |
70 |
+++ b/dev-util/ccls/ccls-9999.ebuild |
71 |
@@ -1,4 +1,4 @@ |
72 |
-# Copyright 2020 Gentoo Authors |
73 |
+# Copyright 2020-2022 Gentoo Authors |
74 |
# Distributed under the terms of the GNU General Public License v2 |
75 |
|
76 |
EAPI=7 |
77 |
@@ -7,9 +7,12 @@ EGIT_REPO_URI="https://github.com/MaskRay/${PN}" |
78 |
|
79 |
if [[ ${PV} = 9999* ]]; then |
80 |
GIT_ECLASS="git-r3" |
81 |
+ LLVM_MAX_SLOT=9999 |
82 |
+else |
83 |
+ LLVM_MAX_SLOT=14 |
84 |
fi |
85 |
|
86 |
-inherit cmake ${GIT_ECLASS} |
87 |
+inherit cmake llvm ${GIT_ECLASS} |
88 |
|
89 |
DESCRIPTION="C/C++/ObjC language server" |
90 |
HOMEPAGE="https://github.com/MaskRay/ccls" |
91 |
@@ -25,13 +28,19 @@ LICENSE="Apache-2.0" |
92 |
SLOT="0" |
93 |
IUSE="" |
94 |
|
95 |
+# We only depend on Clang because of a quirk in how dependencies work |
96 |
+# See comment in llvm.eclass docs |
97 |
DEPEND=" |
98 |
dev-libs/rapidjson |
99 |
- sys-devel/clang:= |
100 |
- sys-devel/llvm:= |
101 |
+ <sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):= |
102 |
" |
103 |
RDEPEND="${DEPEND}" |
104 |
|
105 |
+PATCHES=( |
106 |
+ "${FILESDIR}"/${P}-llvm-cmake.patch |
107 |
+ "${FILESDIR}"/${P}-llvm14.patch |
108 |
+) |
109 |
+ |
110 |
src_configure() { |
111 |
local mycmakeargs=( |
112 |
-DCCLS_VERSION=${PV} |
113 |
|
114 |
diff --git a/dev-util/ccls/files/ccls-0.20210330-llvm14.patch b/dev-util/ccls/files/ccls-0.20210330-llvm14.patch |
115 |
new file mode 100644 |
116 |
index 000000000000..79bf0f124422 |
117 |
--- /dev/null |
118 |
+++ b/dev-util/ccls/files/ccls-0.20210330-llvm14.patch |
119 |
@@ -0,0 +1,139 @@ |
120 |
+https://github.com/MaskRay/ccls/commit/3ce756e39ae48204f016a58684652ad62b4dd9f9.patch |
121 |
+https://github.com/MaskRay/ccls/commit/8422f0a522b6fbcb4412a8ec73d80b4acbc7e00f.patch |
122 |
+https://github.com/MaskRay/ccls/commit/790daca4b2d9d5873623fee86283cd61212df674.patch |
123 |
+ |
124 |
+From: Fangrui Song <i@×××××××.me> |
125 |
+Date: Thu, 23 Sep 2021 13:36:01 -0700 |
126 |
+Subject: [PATCH] Adaopt llvmorg-14-init-3863-g601102d282d5: refactor |
127 |
+ clang::isIdentifierBody |
128 |
+ |
129 |
+--- |
130 |
+ src/clang_tu.hh | 4 ++++ |
131 |
+ src/indexer.cc | 6 +++--- |
132 |
+ src/working_files.cc | 9 ++++++--- |
133 |
+ 3 files changed, 13 insertions(+), 6 deletions(-) |
134 |
+ |
135 |
+diff --git a/src/clang_tu.hh b/src/clang_tu.hh |
136 |
+index b37950926..7dbfc4a88 100644 |
137 |
+--- a/src/clang_tu.hh |
138 |
++++ b/src/clang_tu.hh |
139 |
+@@ -17,6 +17,10 @@ namespace vfs = clang::vfs; |
140 |
+ } |
141 |
+ #endif |
142 |
+ |
143 |
++#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5 |
144 |
++#define isAsciiIdentifierContinue isIdentifierBody |
145 |
++#endif |
146 |
++ |
147 |
+ namespace ccls { |
148 |
+ std::string pathFromFileEntry(const clang::FileEntry &file); |
149 |
+ |
150 |
+diff --git a/src/indexer.cc b/src/indexer.cc |
151 |
+index 89d78959e..644c0ccbb 100644 |
152 |
+--- a/src/indexer.cc |
153 |
++++ b/src/indexer.cc |
154 |
+@@ -527,8 +527,8 @@ class IndexDataConsumer : public index::IndexDataConsumer { |
155 |
+ auto i = name.find(short_name); |
156 |
+ if (short_name.size()) |
157 |
+ while (i != std::string::npos && |
158 |
+- ((i && isIdentifierBody(name[i - 1])) || |
159 |
+- isIdentifierBody(name[i + short_name.size()]))) |
160 |
++ ((i && isAsciiIdentifierContinue(name[i - 1])) || |
161 |
++ isAsciiIdentifierContinue(name[i + short_name.size()]))) |
162 |
+ i = name.find(short_name, i + short_name.size()); |
163 |
+ if (i == std::string::npos) { |
164 |
+ // e.g. operator type-parameter-1 |
165 |
+@@ -552,7 +552,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { |
166 |
+ paren++; |
167 |
+ else if (name[i - 1] == '(') |
168 |
+ paren--; |
169 |
+- else if (!(paren > 0 || isIdentifierBody(name[i - 1]) || |
170 |
++ else if (!(paren > 0 || isAsciiIdentifierContinue(name[i - 1]) || |
171 |
+ name[i - 1] == ':')) |
172 |
+ break; |
173 |
+ } |
174 |
+diff --git a/src/working_files.cc b/src/working_files.cc |
175 |
+index f80f21053..4904388be 100644 |
176 |
+--- a/src/working_files.cc |
177 |
++++ b/src/working_files.cc |
178 |
+@@ -342,7 +342,10 @@ std::optional<int> WorkingFile::getIndexPosFromBufferPos(int line, int *column, |
179 |
+ Position WorkingFile::getCompletionPosition(Position pos, std::string *filter) const { |
180 |
+ int start = getOffsetForPosition(pos, buffer_content); |
181 |
+ int i = start; |
182 |
+- while (i > 0 && isIdentifierBody(buffer_content[i - 1])) |
183 |
++#if LLVM_VERSION_MAJOR < 14 // llvmorg-14-init-3863-g601102d282d5 |
184 |
++#define isAsciiIdentifierContinue isIdentifierBody |
185 |
++#endif |
186 |
++ while (i > 0 && isAsciiIdentifierContinue(buffer_content[i - 1])) |
187 |
+ --i; |
188 |
+ *filter = buffer_content.substr(i, start - i); |
189 |
+ return getPositionForOffset(buffer_content, i); |
190 |
+@@ -455,10 +458,10 @@ std::string_view lexIdentifierAroundPos(Position position, |
191 |
+ c = content[start - 1]; |
192 |
+ if (c == ':' && start > 1 && content[start - 2] == ':') |
193 |
+ start--; |
194 |
+- else if (!isIdentifierBody(c)) |
195 |
++ else if (!isAsciiIdentifierContinue(c)) |
196 |
+ break; |
197 |
+ } |
198 |
+- for (; end < content.size() && isIdentifierBody(content[end]); end++) |
199 |
++ for (; end < content.size() && isAsciiIdentifierContinue(content[end]); end++) |
200 |
+ ; |
201 |
+ |
202 |
+ return content.substr(start, end - start); |
203 |
+ |
204 |
+ |
205 |
+From: Fangrui Song <i@×××××××.me> |
206 |
+Date: Sun, 9 Jan 2022 12:25:07 -0800 |
207 |
+Subject: [PATCH] Adapt llvmorg-14-init-13600-g92417eaf3329: braced constructor |
208 |
+ call |
209 |
+ |
210 |
+--- |
211 |
+ src/messages/textDocument_signatureHelp.cc | 8 ++++++++ |
212 |
+ 1 file changed, 8 insertions(+) |
213 |
+ |
214 |
+diff --git a/src/messages/textDocument_signatureHelp.cc b/src/messages/textDocument_signatureHelp.cc |
215 |
+index 8e8a7277..4192272a 100644 |
216 |
+--- a/src/messages/textDocument_signatureHelp.cc |
217 |
++++ b/src/messages/textDocument_signatureHelp.cc |
218 |
+@@ -80,6 +80,10 @@ class SignatureHelpConsumer : public CodeCompleteConsumer { |
219 |
+ #if LLVM_VERSION_MAJOR >= 8 |
220 |
+ , |
221 |
+ SourceLocation openParLoc |
222 |
++#endif |
223 |
++#if LLVM_VERSION_MAJOR >= 14 |
224 |
++ , |
225 |
++ bool braced |
226 |
+ #endif |
227 |
+ ) override { |
228 |
+ ls_sighelp.activeParameter = (int)currentArg; |
229 |
+@@ -93,7 +97,11 @@ class SignatureHelpConsumer : public CodeCompleteConsumer { |
230 |
+ cand = OverloadCandidate(pattern); |
231 |
+ |
232 |
+ const auto *ccs = |
233 |
++#if LLVM_VERSION_MAJOR >= 14 |
234 |
++ cand.CreateSignatureString(currentArg, s, *alloc, cCTUInfo, true, braced); |
235 |
++#else |
236 |
+ cand.CreateSignatureString(currentArg, s, *alloc, cCTUInfo, true); |
237 |
++#endif |
238 |
+ |
239 |
+ const char *ret_type = nullptr; |
240 |
+ SignatureInformation &ls_sig = ls_sighelp.signatures.emplace_back(); |
241 |
+ |
242 |
+ |
243 |
+From: Fangrui Song <i@×××××××.me> |
244 |
+Date: Sun, 30 Jan 2022 11:17:32 -0800 |
245 |
+Subject: [PATCH] query: include llvm/ADT/STLExtras.h |
246 |
+ |
247 |
+The header is no longer transitively included in 2022-01. |
248 |
+--- a/src/query.cc |
249 |
++++ b/src/query.cc |
250 |
+@@ -9,6 +9,8 @@ |
251 |
+ |
252 |
+ #include <rapidjson/document.h> |
253 |
+ |
254 |
++#include <llvm/ADT/STLExtras.h> |
255 |
++ |
256 |
+ #include <assert.h> |
257 |
+ #include <functional> |
258 |
+ #include <limits.h> |