From 5673a78936ffef9ab8f82a534b757b27f14788e344b812791df1165050326767 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Fri, 15 Nov 2024 00:47:58 +0000 Subject: [PATCH 1/5] - Update to version 0.20241108. * Sort index requests. When you open A/B/foo.cc, files under "A/B/" and "A/" will be prioritized during the initial indexing process, leading to a quicker response time. * Support for LLVM versions <= 9 has been dropped. * LSP semantic tokens are now supported. See usage guide https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens usage (including rainbow semantic highlighting). * LSP extension textDocument/switchSourceHeader is now supported. - Drop unnecessary runtime dependency to llvm/clang metapackages. OBS-URL: https://build.opensuse.org/package/show/devel:tools/ccls?expand=0&rev=45 --- .gitattributes | 23 ++++ .gitignore | 1 + _constraints | 8 ++ ccls-0.20240202.tar.gz | 3 + ccls-0.20240505.tar.gz | 3 + ccls-0.20241108.tar.gz | 3 + ccls.changes | 238 +++++++++++++++++++++++++++++++++++++++++ ccls.spec | 83 ++++++++++++++ 8 files changed, 362 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _constraints create mode 100644 ccls-0.20240202.tar.gz create mode 100644 ccls-0.20240505.tar.gz create mode 100644 ccls-0.20241108.tar.gz create mode 100644 ccls.changes create mode 100644 ccls.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..b1fa81e --- /dev/null +++ b/_constraints @@ -0,0 +1,8 @@ + + + + + 700 + + + diff --git a/ccls-0.20240202.tar.gz b/ccls-0.20240202.tar.gz new file mode 100644 index 0000000..5b997e0 --- /dev/null +++ b/ccls-0.20240202.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:355ff7f5eb5f24d278dda05cccd9157e89583272d0559d6b382630171f142d86 +size 162283 diff --git a/ccls-0.20240505.tar.gz b/ccls-0.20240505.tar.gz new file mode 100644 index 0000000..f0b8043 --- /dev/null +++ b/ccls-0.20240505.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ea6d90a9f93d5503e59c3bd0e5568ab262ff3dcf1b7539b50a0ede4a0e32fea +size 162441 diff --git a/ccls-0.20241108.tar.gz b/ccls-0.20241108.tar.gz new file mode 100644 index 0000000..f1dddc7 --- /dev/null +++ b/ccls-0.20241108.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76224663c3554eef9102dca66d804874d0252312d7c7d02941c615c87dcb68af +size 161114 diff --git a/ccls.changes b/ccls.changes new file mode 100644 index 0000000..1bafc3b --- /dev/null +++ b/ccls.changes @@ -0,0 +1,238 @@ +------------------------------------------------------------------- +Thu Nov 15 22:40:39 UTC 2024 - Aaron Puchert + +- Update to version 0.20241108. + * Sort index requests. When you open A/B/foo.cc, files under + "A/B/" and "A/" will be prioritized during the initial indexing + process, leading to a quicker response time. + * Support for LLVM versions <= 9 has been dropped. + * LSP semantic tokens are now supported. See usage guide + https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens + usage (including rainbow semantic highlighting). + * LSP extension textDocument/switchSourceHeader is now supported. +- Drop unnecessary runtime dependency to llvm/clang metapackages. + +------------------------------------------------------------------- +Wed Oct 2 21:59:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240505. + * For LLVM 19. + +------------------------------------------------------------------- +Sun Apr 21 21:56:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240202. + * Compatibility with LLVM 18. + * Disable -include b.hh => -include b.hh.{gch,pch} transition. + See https://maskray.me/blog/2023-07-16-precompiled-headers for + the behavior. +- Remove obsolete patches: + * llvm16-optional-deprecation.patch + * llvm17-precompiled-preamble-build.patch +- Thanks to Björn Bidar for the original patch! + +------------------------------------------------------------------- +Sat Sep 30 12:37:09 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm17-precompiled-preamble-build.patch + to fix build with LLVM 17. +- Remove explicit runtime dependency libclang-cpp* when we don't + need an exact version, because it will be derived automatically. + +------------------------------------------------------------------- +Thu Mar 30 21:52:42 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm16-optional-deprecation.patch to fix + build with LLVM 16. +- Relax runtime requirements with Clang 16 and newer: the resource + directory doesn't depend on the patch-level version anymore. +- Relax build requirements. + +------------------------------------------------------------------- +Sat Jul 30 11:25:52 UTC 2022 - Aaron Puchert + +- Update to version 0.20220729. +- Drop obsolete patches: + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch + * llvm14-refactor-isIdentifierBody.patch + +------------------------------------------------------------------- +Sat Jun 4 13:28:49 UTC 2022 - Aaron Puchert + +- Port back upstream patches to fix build with LLVM 14: + * llvm14-refactor-isIdentifierBody.patch + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch +- Fix build with older LLVMs by setting CLANG_LINK_CLANG_DYLIB=ON + only for versions >= 9. + +------------------------------------------------------------------- +Mon May 3 18:10:23 UTC 2021 - Ferdinand Thiessen + +- Update to version 0.20210330 + * Fix short_name_size when getNameAsString does not return + a prefix +- Update to version 0.20201219 + * Supports Clang 7~11 + * Support 3.15.0 serverInfo + * Report index status via $/progress + * Better recursive .ccls files + * New initialization option completion.placeholder: + change client.snippetSupport: false to drop ( and < + * Infer -target and --driver-mode from argv[0] + * indexer: log the number of errors and the first diagnostic + * indexer: set the kind of static data members to Field + instead of Var +- Fixed gcc dependency for upcoming Leap 15.3 + +------------------------------------------------------------------- +Mon Nov 2 17:55:02 UTC 2020 - Dan Čermák + +- New upstream release 0.20201025 + + Remove patches: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + +This release supports Clang 7~11. + +# LSP conformance + +* Support 3.15.0 `serverInfo` + +# Misc + +* Infer -target and --driver-mode from argv[0] #511 +* Support CMake variable `CLANG_LINK_CLANG_DYLIB` (some distributions use this to provide `libclang-cpp.so` instead of `libclang*.a` or `libclang*.so`. This option is needed to link against `libclang-cpp.so`) +* `textDocument/documentSymbol`: support unopened files #548 + +------------------------------------------------------------------- +Mon Aug 24 09:25:51 UTC 2020 - Martin Liška + +- Require only 500MB per core. + +------------------------------------------------------------------- +Thu Aug 20 08:33:21 UTC 2020 - Martin Liška + +- Use memoryperjob constraint instead of %limit_build macro. + +------------------------------------------------------------------- +Fri Jun 5 17:10:44 UTC 2020 - Dan Čermák + +- Drop conditional macro application for Leap 15.2 + +------------------------------------------------------------------- +Tue Apr 14 08:34:23 UTC 2020 - Dan Čermák + +- Fix build failures with LLVM 10 + + Added: + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + + Rebased: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + +------------------------------------------------------------------- +Mon Jan 20 09:27:29 UTC 2020 - Dan Čermák + +- Enable building on Leap 15.2 + +------------------------------------------------------------------- +Tue Nov 5 20:24:48 UTC 2019 - Dan Čermák + +- Switch from custom patch to upstream fix: + Drop 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (rejected upstream) + Add 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + (upstream fix: https://github.com/MaskRay/ccls/pull/519) + +------------------------------------------------------------------- +Tue Oct 29 08:53:30 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.4 + + Add 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (fixes builds with LLVM 9 that was build without the unsuported flag + BUILD_SHARED_LIBS=ON, see boo#1155416) + +------------------------------------------------------------------- +Mon Sep 30 12:01:59 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.3 + + - incorrect use of clang::FileEntry::getName on Arch Linux #487 + +------------------------------------------------------------------- +Tue Sep 17 09:52:46 UTC 2019 - Dan Čermák + +- Update to pre-release 0.20190823.2 + +------------------------------------------------------------------- +Fri Aug 23 07:54:27 UTC 2019 - Dan Čermák + +- New upstream pre-release 20190823 + + Drop 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + + LSP conformance + - Support `null` as `initializationOptions` + - Set `declarationProvider` in server capabilities. Some client may need this + capability to enable `textDocument/declaration` + - Support non-numeric request ID #437 + + Misc + - Fix a double-free of llvm::MemoryBuffer when parsing fails #350 + - Keep comments from system headers and improve `textDocument/hover` #373 + - Fix the conformance issue that `VersionedTextDocumentIdentifier.version` was + omitted. If one renames something spanning more than one document and some + documents are not opened, the client may not apply the `textDocument/rename` + change. #387 + - Some macro diagnostics were lost because Note::concerned was not propagated + to Diag::concerned #391 + - `index.onChange`: true support non-existent files #443 + - `textDocument/definition`: don't jump to the type definition + - Disable warnings and skip processed function bodies. This should provide + massive performance improvement when indexing a project. I measured 2x + improvement indexing ccls with 2 threads, more than 2x indexing + llvm/clang/extra/lld/compiler-rt with 6 threads. + + Project + - Fix some issues with hierarchical `.ccls` in #384 + - `.ccls`: support CUDA files with the `%cu` directive + - `compilationDatabaseDirectory` can be absolute. #466 + - Improve heuristics for files not described by `compile_commands.json` + "... but not so well for projects with separate include and source + directories, e.g. "inc/long/path/to/my_file.h" and + "src/long/path/to/my_file.cc" #441 + + Windows + - A Visual Studio 2017 STL bug prevented clang-cl from compiling + ccls/src/utils.hh #371 #414 + - If the file is re-saved before the previous indexing has complete, various + ambiguous errors might occur. Fixing this by making opened files volatile + #235 #453 + + Extension requests + - `$ccls/fileInfo`: can optionally dump dependencies, includes and skipped_ranges + + + +------------------------------------------------------------------- +Mon Jul 1 08:21:11 UTC 2019 - Dan Čermák + +- Drop 0001-Don-t-add-include-paths-as-SYSTEM.patch + Add 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + This fixes compilation issues with gcc9 in general and has been + upstreamed. + +------------------------------------------------------------------- +Thu Jun 20 15:44:08 UTC 2019 - Dan Čermák + +- Add 0001-Don-t-add-include-paths-as-SYSTEM.patch + This fixes compilation failures on PPC, ARM & zSystem + +------------------------------------------------------------------- +Mon Apr 1 09:48:11 UTC 2019 - Dan Čermák + +- Initial package version diff --git a/ccls.spec b/ccls.spec new file mode 100644 index 0000000..cd41020 --- /dev/null +++ b/ccls.spec @@ -0,0 +1,83 @@ +# +# spec file for package ccls +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: ccls +Version: 0.20241108 +Release: 0 +Summary: C/C++/ObjC language server +# main package is Apache 2.0 +# bundled dependencies are Boost (macro_map) and CC0 (siphash) +License: Apache-2.0 AND CC0-1.0 AND BSL-1.0 +Group: Development/Tools/IDE +URL: https://github.com/MaskRay/ccls +Source0: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz +BuildRequires: clang-devel >= 10 +BuildRequires: cmake >= 3.8 +BuildRequires: llvm-devel >= 10 +BuildRequires: rapidjson-devel +BuildRequires: zlib-devel +Provides: bundled(macro_map) +Provides: bundled(siphash) +# ccls hardcodes the paths to clang's resource dir and we thus must ensure that +# it is always shipped with the same clang version that was used to build it +# With Clang 16, the resource directory depends on the major version only and +# doesn't change with patch-level updates. +%if %{pkg_vcmp clang-devel < 16.0.0} +%{requires_eq libclang-cpp%{_llvm_sonum}} +%endif +# gcc > 7.0 is called gcc7- in Leap 15.2 and 15.3 +%if 0%{?sle_version} >= 150200 +BuildRequires: gcc7-c++ >= 7.2 +%else +BuildRequires: gcc-c++ >= 7.2 +%endif + +%description +ccls, which originates from cquery, is a C/C++/Objective-C language server. + +- code completion (with both signature help and snippets) +- definition/references, and other cross references +- cross reference extensions: $ccls/call $ccls/inheritance $ccls/member + $ccls/vars ... +- formatting +- hierarchies: call (caller/callee) hierarchy, inheritance (base/derived) + hierarchy, member hierarchy +- symbol rename +- document symbols and approximate search of workspace symbol +- hover information +- diagnostics and code actions (clang FixIts) +- semantic highlighting and preprocessor skipped regions +- semantic navigation: $ccls/navigate + +%prep +%autosetup -p1 +rm -rf third_party/rapidjson + +%build +%cmake -DUSE_SYSTEM_RAPIDJSON=ON -DCLANG_LINK_CLANG_DYLIB=ON +%cmake_build + +%install +%cmake_install + +%files +%{_bindir}/%{name} +%license LICENSE +%doc README.md + +%changelog -- 2.51.1 From ae0fcbd58c3879c65f747bea86e874cc17ce62c23e79a9e9406cac2613cc4cc5 Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Sat, 12 Apr 2025 23:07:44 +0000 Subject: [PATCH 2/5] - Add fix-llvm20-build.patch to fix build with LLVM 20. OBS-URL: https://build.opensuse.org/package/show/devel:tools/ccls?expand=0&rev=47 --- .gitattributes | 23 ++++ .gitignore | 1 + _constraints | 8 ++ ccls-0.20240202.tar.gz | 3 + ccls-0.20240505.tar.gz | 3 + ccls-0.20241108.tar.gz | 3 + ccls.changes | 243 +++++++++++++++++++++++++++++++++++++++++ ccls.spec | 84 ++++++++++++++ fix-llvm20-build.patch | 78 +++++++++++++ 9 files changed, 446 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _constraints create mode 100644 ccls-0.20240202.tar.gz create mode 100644 ccls-0.20240505.tar.gz create mode 100644 ccls-0.20241108.tar.gz create mode 100644 ccls.changes create mode 100644 ccls.spec create mode 100644 fix-llvm20-build.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..b1fa81e --- /dev/null +++ b/_constraints @@ -0,0 +1,8 @@ + + + + + 700 + + + diff --git a/ccls-0.20240202.tar.gz b/ccls-0.20240202.tar.gz new file mode 100644 index 0000000..5b997e0 --- /dev/null +++ b/ccls-0.20240202.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:355ff7f5eb5f24d278dda05cccd9157e89583272d0559d6b382630171f142d86 +size 162283 diff --git a/ccls-0.20240505.tar.gz b/ccls-0.20240505.tar.gz new file mode 100644 index 0000000..f0b8043 --- /dev/null +++ b/ccls-0.20240505.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ea6d90a9f93d5503e59c3bd0e5568ab262ff3dcf1b7539b50a0ede4a0e32fea +size 162441 diff --git a/ccls-0.20241108.tar.gz b/ccls-0.20241108.tar.gz new file mode 100644 index 0000000..f1dddc7 --- /dev/null +++ b/ccls-0.20241108.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76224663c3554eef9102dca66d804874d0252312d7c7d02941c615c87dcb68af +size 161114 diff --git a/ccls.changes b/ccls.changes new file mode 100644 index 0000000..70a92d4 --- /dev/null +++ b/ccls.changes @@ -0,0 +1,243 @@ +------------------------------------------------------------------- +Sat Apr 12 21:06:33 UTC 2025 - Aaron Puchert + +- Add fix-llvm20-build.patch to fix build with LLVM 20. + +------------------------------------------------------------------- +Thu Nov 15 22:40:39 UTC 2024 - Aaron Puchert + +- Update to version 0.20241108. + * Sort index requests. When you open A/B/foo.cc, files under + "A/B/" and "A/" will be prioritized during the initial indexing + process, leading to a quicker response time. + * Support for LLVM versions <= 9 has been dropped. + * LSP semantic tokens are now supported. See usage guide + https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens + usage (including rainbow semantic highlighting). + * LSP extension textDocument/switchSourceHeader is now supported. +- Drop unnecessary runtime dependency to llvm/clang metapackages. + +------------------------------------------------------------------- +Wed Oct 2 21:59:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240505. + * For LLVM 19. + +------------------------------------------------------------------- +Sun Apr 21 21:56:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240202. + * Compatibility with LLVM 18. + * Disable -include b.hh => -include b.hh.{gch,pch} transition. + See https://maskray.me/blog/2023-07-16-precompiled-headers for + the behavior. +- Remove obsolete patches: + * llvm16-optional-deprecation.patch + * llvm17-precompiled-preamble-build.patch +- Thanks to Björn Bidar for the original patch! + +------------------------------------------------------------------- +Sat Sep 30 12:37:09 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm17-precompiled-preamble-build.patch + to fix build with LLVM 17. +- Remove explicit runtime dependency libclang-cpp* when we don't + need an exact version, because it will be derived automatically. + +------------------------------------------------------------------- +Thu Mar 30 21:52:42 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm16-optional-deprecation.patch to fix + build with LLVM 16. +- Relax runtime requirements with Clang 16 and newer: the resource + directory doesn't depend on the patch-level version anymore. +- Relax build requirements. + +------------------------------------------------------------------- +Sat Jul 30 11:25:52 UTC 2022 - Aaron Puchert + +- Update to version 0.20220729. +- Drop obsolete patches: + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch + * llvm14-refactor-isIdentifierBody.patch + +------------------------------------------------------------------- +Sat Jun 4 13:28:49 UTC 2022 - Aaron Puchert + +- Port back upstream patches to fix build with LLVM 14: + * llvm14-refactor-isIdentifierBody.patch + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch +- Fix build with older LLVMs by setting CLANG_LINK_CLANG_DYLIB=ON + only for versions >= 9. + +------------------------------------------------------------------- +Mon May 3 18:10:23 UTC 2021 - Ferdinand Thiessen + +- Update to version 0.20210330 + * Fix short_name_size when getNameAsString does not return + a prefix +- Update to version 0.20201219 + * Supports Clang 7~11 + * Support 3.15.0 serverInfo + * Report index status via $/progress + * Better recursive .ccls files + * New initialization option completion.placeholder: + change client.snippetSupport: false to drop ( and < + * Infer -target and --driver-mode from argv[0] + * indexer: log the number of errors and the first diagnostic + * indexer: set the kind of static data members to Field + instead of Var +- Fixed gcc dependency for upcoming Leap 15.3 + +------------------------------------------------------------------- +Mon Nov 2 17:55:02 UTC 2020 - Dan Čermák + +- New upstream release 0.20201025 + + Remove patches: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + +This release supports Clang 7~11. + +# LSP conformance + +* Support 3.15.0 `serverInfo` + +# Misc + +* Infer -target and --driver-mode from argv[0] #511 +* Support CMake variable `CLANG_LINK_CLANG_DYLIB` (some distributions use this to provide `libclang-cpp.so` instead of `libclang*.a` or `libclang*.so`. This option is needed to link against `libclang-cpp.so`) +* `textDocument/documentSymbol`: support unopened files #548 + +------------------------------------------------------------------- +Mon Aug 24 09:25:51 UTC 2020 - Martin Liška + +- Require only 500MB per core. + +------------------------------------------------------------------- +Thu Aug 20 08:33:21 UTC 2020 - Martin Liška + +- Use memoryperjob constraint instead of %limit_build macro. + +------------------------------------------------------------------- +Fri Jun 5 17:10:44 UTC 2020 - Dan Čermák + +- Drop conditional macro application for Leap 15.2 + +------------------------------------------------------------------- +Tue Apr 14 08:34:23 UTC 2020 - Dan Čermák + +- Fix build failures with LLVM 10 + + Added: + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + + Rebased: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + +------------------------------------------------------------------- +Mon Jan 20 09:27:29 UTC 2020 - Dan Čermák + +- Enable building on Leap 15.2 + +------------------------------------------------------------------- +Tue Nov 5 20:24:48 UTC 2019 - Dan Čermák + +- Switch from custom patch to upstream fix: + Drop 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (rejected upstream) + Add 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + (upstream fix: https://github.com/MaskRay/ccls/pull/519) + +------------------------------------------------------------------- +Tue Oct 29 08:53:30 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.4 + + Add 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (fixes builds with LLVM 9 that was build without the unsuported flag + BUILD_SHARED_LIBS=ON, see boo#1155416) + +------------------------------------------------------------------- +Mon Sep 30 12:01:59 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.3 + + - incorrect use of clang::FileEntry::getName on Arch Linux #487 + +------------------------------------------------------------------- +Tue Sep 17 09:52:46 UTC 2019 - Dan Čermák + +- Update to pre-release 0.20190823.2 + +------------------------------------------------------------------- +Fri Aug 23 07:54:27 UTC 2019 - Dan Čermák + +- New upstream pre-release 20190823 + + Drop 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + + LSP conformance + - Support `null` as `initializationOptions` + - Set `declarationProvider` in server capabilities. Some client may need this + capability to enable `textDocument/declaration` + - Support non-numeric request ID #437 + + Misc + - Fix a double-free of llvm::MemoryBuffer when parsing fails #350 + - Keep comments from system headers and improve `textDocument/hover` #373 + - Fix the conformance issue that `VersionedTextDocumentIdentifier.version` was + omitted. If one renames something spanning more than one document and some + documents are not opened, the client may not apply the `textDocument/rename` + change. #387 + - Some macro diagnostics were lost because Note::concerned was not propagated + to Diag::concerned #391 + - `index.onChange`: true support non-existent files #443 + - `textDocument/definition`: don't jump to the type definition + - Disable warnings and skip processed function bodies. This should provide + massive performance improvement when indexing a project. I measured 2x + improvement indexing ccls with 2 threads, more than 2x indexing + llvm/clang/extra/lld/compiler-rt with 6 threads. + + Project + - Fix some issues with hierarchical `.ccls` in #384 + - `.ccls`: support CUDA files with the `%cu` directive + - `compilationDatabaseDirectory` can be absolute. #466 + - Improve heuristics for files not described by `compile_commands.json` + "... but not so well for projects with separate include and source + directories, e.g. "inc/long/path/to/my_file.h" and + "src/long/path/to/my_file.cc" #441 + + Windows + - A Visual Studio 2017 STL bug prevented clang-cl from compiling + ccls/src/utils.hh #371 #414 + - If the file is re-saved before the previous indexing has complete, various + ambiguous errors might occur. Fixing this by making opened files volatile + #235 #453 + + Extension requests + - `$ccls/fileInfo`: can optionally dump dependencies, includes and skipped_ranges + + + +------------------------------------------------------------------- +Mon Jul 1 08:21:11 UTC 2019 - Dan Čermák + +- Drop 0001-Don-t-add-include-paths-as-SYSTEM.patch + Add 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + This fixes compilation issues with gcc9 in general and has been + upstreamed. + +------------------------------------------------------------------- +Thu Jun 20 15:44:08 UTC 2019 - Dan Čermák + +- Add 0001-Don-t-add-include-paths-as-SYSTEM.patch + This fixes compilation failures on PPC, ARM & zSystem + +------------------------------------------------------------------- +Mon Apr 1 09:48:11 UTC 2019 - Dan Čermák + +- Initial package version diff --git a/ccls.spec b/ccls.spec new file mode 100644 index 0000000..983d625 --- /dev/null +++ b/ccls.spec @@ -0,0 +1,84 @@ +# +# spec file for package ccls +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: ccls +Version: 0.20241108 +Release: 0 +Summary: C/C++/ObjC language server +# main package is Apache 2.0 +# bundled dependencies are Boost (macro_map) and CC0 (siphash) +License: Apache-2.0 AND CC0-1.0 AND BSL-1.0 +Group: Development/Tools/IDE +URL: https://github.com/MaskRay/ccls +Source0: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0: fix-llvm20-build.patch +BuildRequires: clang-devel >= 10 +BuildRequires: cmake >= 3.8 +BuildRequires: llvm-devel >= 10 +BuildRequires: rapidjson-devel +BuildRequires: zlib-devel +Provides: bundled(macro_map) +Provides: bundled(siphash) +# ccls hardcodes the paths to clang's resource dir and we thus must ensure that +# it is always shipped with the same clang version that was used to build it +# With Clang 16, the resource directory depends on the major version only and +# doesn't change with patch-level updates. +%if %{pkg_vcmp clang-devel < 16.0.0} +%{requires_eq libclang-cpp%{_llvm_sonum}} +%endif +# gcc > 7.0 is called gcc7- in Leap 15.2 and 15.3 +%if 0%{?sle_version} >= 150200 +BuildRequires: gcc7-c++ >= 7.2 +%else +BuildRequires: gcc-c++ >= 7.2 +%endif + +%description +ccls, which originates from cquery, is a C/C++/Objective-C language server. + +- code completion (with both signature help and snippets) +- definition/references, and other cross references +- cross reference extensions: $ccls/call $ccls/inheritance $ccls/member + $ccls/vars ... +- formatting +- hierarchies: call (caller/callee) hierarchy, inheritance (base/derived) + hierarchy, member hierarchy +- symbol rename +- document symbols and approximate search of workspace symbol +- hover information +- diagnostics and code actions (clang FixIts) +- semantic highlighting and preprocessor skipped regions +- semantic navigation: $ccls/navigate + +%prep +%autosetup -p1 +rm -rf third_party/rapidjson + +%build +%cmake -DUSE_SYSTEM_RAPIDJSON=ON -DCLANG_LINK_CLANG_DYLIB=ON +%cmake_build + +%install +%cmake_install + +%files +%{_bindir}/%{name} +%license LICENSE +%doc README.md + +%changelog diff --git a/fix-llvm20-build.patch b/fix-llvm20-build.patch new file mode 100644 index 0000000..4cf6af4 --- /dev/null +++ b/fix-llvm20-build.patch @@ -0,0 +1,78 @@ +From 4331c8958698d42933bf4e132f8a7d61f3cedb8c Mon Sep 17 00:00:00 2001 +From: Fangrui Song +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 a/src/clang_tu.cc b/src/clang_tu.cc +index 32be1733f..54e04ef0e 100644 +--- a/src/clang_tu.cc ++++ b/src/clang_tu.cc +@@ -124,9 +124,11 @@ buildCompilerInvocation(const std::string &main, std::vector args, + args.insert(args.begin() + 1, std::begin(arr), std::end(arr)); + } + +- IntrusiveRefCntPtr diags( +- CompilerInstance::createDiagnostics(new DiagnosticOptions, +- new IgnoringDiagConsumer, true)); ++ IntrusiveRefCntPtr 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 a/src/indexer.cc b/src/indexer.cc +index b81f1d9f6..dff4ae2d8 100644 +--- a/src/indexer.cc ++++ b/src/indexer.cc +@@ -1312,7 +1312,11 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + IndexDiags dc; + auto clang = std::make_unique(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 a/src/sema_manager.cc b/src/sema_manager.cc +index bf806e47d..59aaed021 100644 +--- a/src/sema_manager.cc ++++ b/src/sema_manager.cc +@@ -288,7 +288,11 @@ buildCompilerInstance(Session &session, std::unique_ptr ci, + + auto clang = std::make_unique(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 de = +- CompilerInstance::createDiagnostics(&ci.getDiagnosticOpts(), &dc, false); ++ IntrusiveRefCntPtr 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.51.1 From d6497ce6a7df9c4d203cac7f2a0fad6412f08dd99773d5bf1414bd565facfc2f Mon Sep 17 00:00:00 2001 From: Aaron Puchert Date: Wed, 17 Sep 2025 02:02:11 +0000 Subject: [PATCH 3/5] - Add llvm21-CompilerInstance-and-PointerUnion.patch and fix-llvm21-build.patch to fix build with LLVM 21. - Add reformat.patch to ease applying patches from upstream. OBS-URL: https://build.opensuse.org/package/show/devel:tools/ccls?expand=0&rev=49 --- .gitattributes | 23 + .gitignore | 1 + _constraints | 8 + ccls-0.20241108.tar.gz | 3 + ccls.changes | 250 + ccls.spec | 87 + fix-llvm20-build.patch | 78 + fix-llvm21-build.patch | 82 + ...21-CompilerInstance-and-PointerUnion.patch | 102 + reformat.patch | 6294 +++++++++++++++++ 10 files changed, 6928 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _constraints create mode 100644 ccls-0.20241108.tar.gz create mode 100644 ccls.changes create mode 100644 ccls.spec create mode 100644 fix-llvm20-build.patch create mode 100644 fix-llvm21-build.patch create mode 100644 llvm21-CompilerInstance-and-PointerUnion.patch create mode 100644 reformat.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_constraints b/_constraints new file mode 100644 index 0000000..b1fa81e --- /dev/null +++ b/_constraints @@ -0,0 +1,8 @@ + + + + + 700 + + + diff --git a/ccls-0.20241108.tar.gz b/ccls-0.20241108.tar.gz new file mode 100644 index 0000000..f1dddc7 --- /dev/null +++ b/ccls-0.20241108.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:76224663c3554eef9102dca66d804874d0252312d7c7d02941c615c87dcb68af +size 161114 diff --git a/ccls.changes b/ccls.changes new file mode 100644 index 0000000..52d2b31 --- /dev/null +++ b/ccls.changes @@ -0,0 +1,250 @@ +------------------------------------------------------------------- +Tue Sep 16 21:57:46 UTC 2025 - Aaron Puchert + +- Add llvm21-CompilerInstance-and-PointerUnion.patch and + fix-llvm21-build.patch to fix build with LLVM 21. +- Add reformat.patch to ease applying patches from upstream. + +------------------------------------------------------------------- +Sat Apr 12 21:06:33 UTC 2025 - Aaron Puchert + +- Add fix-llvm20-build.patch to fix build with LLVM 20. + +------------------------------------------------------------------- +Thu Nov 15 22:40:39 UTC 2024 - Aaron Puchert + +- Update to version 0.20241108. + * Sort index requests. When you open A/B/foo.cc, files under + "A/B/" and "A/" will be prioritized during the initial indexing + process, leading to a quicker response time. + * Support for LLVM versions <= 9 has been dropped. + * LSP semantic tokens are now supported. See usage guide + https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens + usage (including rainbow semantic highlighting). + * LSP extension textDocument/switchSourceHeader is now supported. +- Drop unnecessary runtime dependency to llvm/clang metapackages. + +------------------------------------------------------------------- +Wed Oct 2 21:59:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240505. + * For LLVM 19. + +------------------------------------------------------------------- +Sun Apr 21 21:56:58 UTC 2024 - Aaron Puchert + +- Update to version 0.20240202. + * Compatibility with LLVM 18. + * Disable -include b.hh => -include b.hh.{gch,pch} transition. + See https://maskray.me/blog/2023-07-16-precompiled-headers for + the behavior. +- Remove obsolete patches: + * llvm16-optional-deprecation.patch + * llvm17-precompiled-preamble-build.patch +- Thanks to Björn Bidar for the original patch! + +------------------------------------------------------------------- +Sat Sep 30 12:37:09 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm17-precompiled-preamble-build.patch + to fix build with LLVM 17. +- Remove explicit runtime dependency libclang-cpp* when we don't + need an exact version, because it will be derived automatically. + +------------------------------------------------------------------- +Thu Mar 30 21:52:42 UTC 2023 - Aaron Puchert + +- Backport upstream patch llvm16-optional-deprecation.patch to fix + build with LLVM 16. +- Relax runtime requirements with Clang 16 and newer: the resource + directory doesn't depend on the patch-level version anymore. +- Relax build requirements. + +------------------------------------------------------------------- +Sat Jul 30 11:25:52 UTC 2022 - Aaron Puchert + +- Update to version 0.20220729. +- Drop obsolete patches: + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch + * llvm14-refactor-isIdentifierBody.patch + +------------------------------------------------------------------- +Sat Jun 4 13:28:49 UTC 2022 - Aaron Puchert + +- Port back upstream patches to fix build with LLVM 14: + * llvm14-refactor-isIdentifierBody.patch + * llvm14-braced-constructor-call.patch + * llvm14-include-STLExtras.patch +- Fix build with older LLVMs by setting CLANG_LINK_CLANG_DYLIB=ON + only for versions >= 9. + +------------------------------------------------------------------- +Mon May 3 18:10:23 UTC 2021 - Ferdinand Thiessen + +- Update to version 0.20210330 + * Fix short_name_size when getNameAsString does not return + a prefix +- Update to version 0.20201219 + * Supports Clang 7~11 + * Support 3.15.0 serverInfo + * Report index status via $/progress + * Better recursive .ccls files + * New initialization option completion.placeholder: + change client.snippetSupport: false to drop ( and < + * Infer -target and --driver-mode from argv[0] + * indexer: log the number of errors and the first diagnostic + * indexer: set the kind of static data members to Field + instead of Var +- Fixed gcc dependency for upcoming Leap 15.3 + +------------------------------------------------------------------- +Mon Nov 2 17:55:02 UTC 2020 - Dan Čermák + +- New upstream release 0.20201025 + + Remove patches: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + +This release supports Clang 7~11. + +# LSP conformance + +* Support 3.15.0 `serverInfo` + +# Misc + +* Infer -target and --driver-mode from argv[0] #511 +* Support CMake variable `CLANG_LINK_CLANG_DYLIB` (some distributions use this to provide `libclang-cpp.so` instead of `libclang*.a` or `libclang*.so`. This option is needed to link against `libclang-cpp.so`) +* `textDocument/documentSymbol`: support unopened files #548 + +------------------------------------------------------------------- +Mon Aug 24 09:25:51 UTC 2020 - Martin Liška + +- Require only 500MB per core. + +------------------------------------------------------------------- +Thu Aug 20 08:33:21 UTC 2020 - Martin Liška + +- Use memoryperjob constraint instead of %limit_build macro. + +------------------------------------------------------------------- +Fri Jun 5 17:10:44 UTC 2020 - Dan Čermák + +- Drop conditional macro application for Leap 15.2 + +------------------------------------------------------------------- +Tue Apr 14 08:34:23 UTC 2020 - Dan Čermák + +- Fix build failures with LLVM 10 + + Added: + * 0002-Adapt-llvmorg-10-init-12036-g3b9715cb2193-handleDecl.patch + + Rebased: + * 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + +------------------------------------------------------------------- +Mon Jan 20 09:27:29 UTC 2020 - Dan Čermák + +- Enable building on Leap 15.2 + +------------------------------------------------------------------- +Tue Nov 5 20:24:48 UTC 2019 - Dan Čermák + +- Switch from custom patch to upstream fix: + Drop 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (rejected upstream) + Add 0001-cmake-support-CLANG_LINK_CLANG_DYLIB.patch + (upstream fix: https://github.com/MaskRay/ccls/pull/519) + +------------------------------------------------------------------- +Tue Oct 29 08:53:30 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.4 + + Add 0001-Fix-builds-for-LLVM-9-for-LLVM-build-without-BUILD_S.patch + (fixes builds with LLVM 9 that was build without the unsuported flag + BUILD_SHARED_LIBS=ON, see boo#1155416) + +------------------------------------------------------------------- +Mon Sep 30 12:01:59 UTC 2019 - Dan Čermák + +- Update to release 0.20190823.3 + + - incorrect use of clang::FileEntry::getName on Arch Linux #487 + +------------------------------------------------------------------- +Tue Sep 17 09:52:46 UTC 2019 - Dan Čermák + +- Update to pre-release 0.20190823.2 + +------------------------------------------------------------------- +Fri Aug 23 07:54:27 UTC 2019 - Dan Čermák + +- New upstream pre-release 20190823 + + Drop 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + + LSP conformance + - Support `null` as `initializationOptions` + - Set `declarationProvider` in server capabilities. Some client may need this + capability to enable `textDocument/declaration` + - Support non-numeric request ID #437 + + Misc + - Fix a double-free of llvm::MemoryBuffer when parsing fails #350 + - Keep comments from system headers and improve `textDocument/hover` #373 + - Fix the conformance issue that `VersionedTextDocumentIdentifier.version` was + omitted. If one renames something spanning more than one document and some + documents are not opened, the client may not apply the `textDocument/rename` + change. #387 + - Some macro diagnostics were lost because Note::concerned was not propagated + to Diag::concerned #391 + - `index.onChange`: true support non-existent files #443 + - `textDocument/definition`: don't jump to the type definition + - Disable warnings and skip processed function bodies. This should provide + massive performance improvement when indexing a project. I measured 2x + improvement indexing ccls with 2 threads, more than 2x indexing + llvm/clang/extra/lld/compiler-rt with 6 threads. + + Project + - Fix some issues with hierarchical `.ccls` in #384 + - `.ccls`: support CUDA files with the `%cu` directive + - `compilationDatabaseDirectory` can be absolute. #466 + - Improve heuristics for files not described by `compile_commands.json` + "... but not so well for projects with separate include and source + directories, e.g. "inc/long/path/to/my_file.h" and + "src/long/path/to/my_file.cc" #441 + + Windows + - A Visual Studio 2017 STL bug prevented clang-cl from compiling + ccls/src/utils.hh #371 #414 + - If the file is re-saved before the previous indexing has complete, various + ambiguous errors might occur. Fixing this by making opened files volatile + #235 #453 + + Extension requests + - `$ccls/fileInfo`: can optionally dump dependencies, includes and skipped_ranges + + + +------------------------------------------------------------------- +Mon Jul 1 08:21:11 UTC 2019 - Dan Čermák + +- Drop 0001-Don-t-add-include-paths-as-SYSTEM.patch + Add 0001-Only-add-include-directories-for-LLVM-clang-rapidjso.patch + This fixes compilation issues with gcc9 in general and has been + upstreamed. + +------------------------------------------------------------------- +Thu Jun 20 15:44:08 UTC 2019 - Dan Čermák + +- Add 0001-Don-t-add-include-paths-as-SYSTEM.patch + This fixes compilation failures on PPC, ARM & zSystem + +------------------------------------------------------------------- +Mon Apr 1 09:48:11 UTC 2019 - Dan Čermák + +- Initial package version diff --git a/ccls.spec b/ccls.spec new file mode 100644 index 0000000..1a9a57a --- /dev/null +++ b/ccls.spec @@ -0,0 +1,87 @@ +# +# spec file for package ccls +# +# Copyright (c) 2025 SUSE LLC and contributors +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: ccls +Version: 0.20241108 +Release: 0 +Summary: C/C++/ObjC language server +# main package is Apache 2.0 +# bundled dependencies are Boost (macro_map) and CC0 (siphash) +License: Apache-2.0 AND CC0-1.0 AND BSL-1.0 +Group: Development/Tools/IDE +URL: https://github.com/MaskRay/ccls +Source0: %{URL}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0: fix-llvm20-build.patch +Patch1: reformat.patch +Patch2: llvm21-CompilerInstance-and-PointerUnion.patch +Patch3: fix-llvm21-build.patch +BuildRequires: clang-devel >= 10 +BuildRequires: cmake >= 3.8 +BuildRequires: llvm-devel >= 10 +BuildRequires: rapidjson-devel +BuildRequires: zlib-devel +Provides: bundled(macro_map) +Provides: bundled(siphash) +# ccls hardcodes the paths to clang's resource dir and we thus must ensure that +# it is always shipped with the same clang version that was used to build it +# With Clang 16, the resource directory depends on the major version only and +# doesn't change with patch-level updates. +%if %{pkg_vcmp clang-devel < 16.0.0} +%{requires_eq libclang-cpp%{_llvm_sonum}} +%endif +# gcc > 7.0 is called gcc7- in Leap 15.2 and 15.3 +%if 0%{?sle_version} >= 150200 +BuildRequires: gcc7-c++ >= 7.2 +%else +BuildRequires: gcc-c++ >= 7.2 +%endif + +%description +ccls, which originates from cquery, is a C/C++/Objective-C language server. + +- code completion (with both signature help and snippets) +- definition/references, and other cross references +- cross reference extensions: $ccls/call $ccls/inheritance $ccls/member + $ccls/vars ... +- formatting +- hierarchies: call (caller/callee) hierarchy, inheritance (base/derived) + hierarchy, member hierarchy +- symbol rename +- document symbols and approximate search of workspace symbol +- hover information +- diagnostics and code actions (clang FixIts) +- semantic highlighting and preprocessor skipped regions +- semantic navigation: $ccls/navigate + +%prep +%autosetup -p1 +rm -rf third_party/rapidjson + +%build +%cmake -DUSE_SYSTEM_RAPIDJSON=ON -DCLANG_LINK_CLANG_DYLIB=ON +%cmake_build + +%install +%cmake_install + +%files +%{_bindir}/%{name} +%license LICENSE +%doc README.md + +%changelog diff --git a/fix-llvm20-build.patch b/fix-llvm20-build.patch new file mode 100644 index 0000000..4cf6af4 --- /dev/null +++ b/fix-llvm20-build.patch @@ -0,0 +1,78 @@ +From 4331c8958698d42933bf4e132f8a7d61f3cedb8c Mon Sep 17 00:00:00 2001 +From: Fangrui Song +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 a/src/clang_tu.cc b/src/clang_tu.cc +index 32be1733f..54e04ef0e 100644 +--- a/src/clang_tu.cc ++++ b/src/clang_tu.cc +@@ -124,9 +124,11 @@ buildCompilerInvocation(const std::string &main, std::vector args, + args.insert(args.begin() + 1, std::begin(arr), std::end(arr)); + } + +- IntrusiveRefCntPtr diags( +- CompilerInstance::createDiagnostics(new DiagnosticOptions, +- new IgnoringDiagConsumer, true)); ++ IntrusiveRefCntPtr 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 a/src/indexer.cc b/src/indexer.cc +index b81f1d9f6..dff4ae2d8 100644 +--- a/src/indexer.cc ++++ b/src/indexer.cc +@@ -1312,7 +1312,11 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + IndexDiags dc; + auto clang = std::make_unique(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 a/src/sema_manager.cc b/src/sema_manager.cc +index bf806e47d..59aaed021 100644 +--- a/src/sema_manager.cc ++++ b/src/sema_manager.cc +@@ -288,7 +288,11 @@ buildCompilerInstance(Session &session, std::unique_ptr ci, + + auto clang = std::make_unique(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 de = +- CompilerInstance::createDiagnostics(&ci.getDiagnosticOpts(), &dc, false); ++ IntrusiveRefCntPtr 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) diff --git a/fix-llvm21-build.patch b/fix-llvm21-build.patch new file mode 100644 index 0000000..6a0612f --- /dev/null +++ b/fix-llvm21-build.patch @@ -0,0 +1,82 @@ +From 4427527ed8107719457b5260443e8cad024e446f Mon Sep 17 00:00:00 2001 +From: Stephen Senran Zhang +Date: Thu, 7 Aug 2025 00:54:25 +0800 +Subject: [PATCH] Accommodate changes of LLVM 21 & 22 to fix builds (#985) + +--- + src/clang_tu.cc | 9 ++++++++- + src/messages/textDocument_completion.cc | 2 +- + src/sema_manager.cc | 16 ++++++++++++++-- + 3 files changed, 23 insertions(+), 4 deletions(-) + +diff --git a/src/clang_tu.cc b/src/clang_tu.cc +index 5c880b32c..b96ab4a59 100644 +--- a/src/clang_tu.cc ++++ b/src/clang_tu.cc +@@ -116,11 +116,18 @@ std::unique_ptr buildCompilerInvocation(const std::string &m + args.insert(args.begin() + 1, std::begin(arr), std::end(arr)); + } + ++#if (LLVM_VERSION_MAJOR == 21 && LLVM_VERSION_MINOR >= 1) || \ ++ (LLVM_VERSION_MAJOR >= 22) // llvmorg-21-init-12923-g13e1a2cb2246 ++ DiagnosticOptions DiagOpt; ++#else ++ DiagnosticOptions *DiagOpt = new DiagnosticOptions; ++#endif ++ + IntrusiveRefCntPtr diags(CompilerInstance::createDiagnostics( + #if LLVM_VERSION_MAJOR >= 20 + *vfs, + #endif +- new DiagnosticOptions, new IgnoringDiagConsumer, true)); ++ DiagOpt, 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 a/src/messages/textDocument_completion.cc b/src/messages/textDocument_completion.cc +index a5065515e..7ffde8553 100644 +--- a/src/messages/textDocument_completion.cc ++++ b/src/messages/textDocument_completion.cc +@@ -350,7 +350,7 @@ class CompletionConsumer : public CodeCompleteConsumer { + if (fd->getTemplatedDecl()->getKind() == Decl::CXXDeductionGuide) + continue; + } +- if (auto *rd = dyn_cast(r.Declaration)) ++ if (auto *rd = dyn_cast(r.Declaration)) + if (rd->isInjectedClassName()) + continue; + auto nk = r.Declaration->getDeclName().getNameKind(); +diff --git a/src/sema_manager.cc b/src/sema_manager.cc +index 325c9a9c4..9ae1c132a 100644 +--- a/src/sema_manager.cc ++++ b/src/sema_manager.cc +@@ -352,7 +352,13 @@ void buildPreamble(Session &session, CompilerInvocation &ci, IntrusiveRefCntPtr< + #if LLVM_VERSION_MAJOR >= 20 + *fs, + #endif +- &ci.getDiagnosticOpts(), &dc, false); ++#if (LLVM_VERSION_MAJOR == 21 && LLVM_VERSION_MINOR >= 1) || \ ++ (LLVM_VERSION_MAJOR >= 22) // llvmorg-21-init-12923-g13e1a2cb2246 ++ ci.getDiagnosticOpts(), ++#else ++ &ci.getDiagnosticOpts(), ++#endif ++ &dc, false); + if (oldP) { + std::lock_guard lock(session.wfiles->mutex); + for (auto &include : oldP->includes) +@@ -362,7 +368,13 @@ void buildPreamble(Session &session, CompilerInvocation &ci, IntrusiveRefCntPtr< + } + + CclsPreambleCallbacks pc; +- if (auto newPreamble = PrecompiledPreamble::Build(ci, buf.get(), bounds, *de, fs, session.pch, true, ++ if (auto newPreamble = PrecompiledPreamble::Build(ci, buf.get(), bounds, ++#if LLVM_VERSION_MAJOR >= 22 // llvmorg-22-init-2136-gc7f343750744 ++ de, ++#else ++ *de, ++#endif ++ fs, session.pch, true, + #if LLVM_VERSION_MAJOR >= 17 // llvmorg-17-init-4072-gcc929590ad30 + "", + #endif diff --git a/llvm21-CompilerInstance-and-PointerUnion.patch b/llvm21-CompilerInstance-and-PointerUnion.patch new file mode 100644 index 0000000..3536ed5 --- /dev/null +++ b/llvm21-CompilerInstance-and-PointerUnion.patch @@ -0,0 +1,102 @@ +From 44fb405d00dead04de43891c9818d798f10fc41e Mon Sep 17 00:00:00 2001 +From: Fangrui Song +Date: Sun, 11 May 2025 23:01:55 -0700 +Subject: [PATCH] Adapt llvmorg-21 changes: clang::CompilerInstance and + llvm::PointerUnion + +--- + src/indexer.cc | 22 ++++++++++++++++++++++ + src/sema_manager.cc | 8 ++++++++ + 2 files changed, 30 insertions(+) + +diff --git a/src/indexer.cc b/src/indexer.cc +index 17d8cc2d8..770712267 100644 +--- a/src/indexer.cc ++++ b/src/indexer.cc +@@ -377,10 +377,17 @@ const Decl *getAdjustedDecl(const Decl *d) { + if (!s->isExplicitSpecialization()) { + llvm::PointerUnion result = + s->getSpecializedTemplateOrPartial(); ++#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-10510-gaab5bd180a42 ++ if (auto *ctd = dyn_cast(result)) ++ d = ctd; ++ else ++ d = cast(result); ++#else + if (result.is()) + d = result.get(); + else + d = result.get(); ++#endif + continue; + } + } else if (auto *d1 = r->getInstantiatedFromMemberClass()) { +@@ -964,10 +971,17 @@ class IndexDataConsumer : public index::IndexDataConsumer { + else if (auto *sd = dyn_cast(rd)) { + llvm::PointerUnion result = + sd->getSpecializedTemplateOrPartial(); ++#if LLVM_VERSION_MAJOR >= 15 // llvmorg-15-init-10510-gaab5bd180a42 ++ if (auto *ctd = dyn_cast(result)) ++ d1 = ctd; ++ else ++ d1 = cast(result); ++#else + if (result.is()) + d1 = result.get(); + else + d1 = result.get(); ++#endif + + } else + d1 = rd->getInstantiatedFromMemberClass(); +@@ -1241,15 +1255,23 @@ IndexResult index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, const st + } + + IndexDiags dc; ++#if LLVM_VERSION_MAJOR >= 21 ++ auto clang = std::make_unique(std::move(ci), pch); ++#else + auto clang = std::make_unique(pch); + clang->setInvocation(std::move(ci)); ++#endif + clang->createDiagnostics( + #if LLVM_VERSION_MAJOR >= 20 + *fs, + #endif + &dc, false); + clang->getDiagnostics().setIgnoreAllWarnings(true); ++#if LLVM_VERSION_MAJOR >= 21 ++ clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getTargetOpts())); ++#else + clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts)); ++#endif + if (!clang->hasTarget()) + return {}; + clang->getPreprocessorOpts().RetainRemappedFileBuffers = true; +diff --git a/src/sema_manager.cc b/src/sema_manager.cc +index b6b3df971..325c9a9c4 100644 +--- a/src/sema_manager.cc ++++ b/src/sema_manager.cc +@@ -261,14 +261,22 @@ std::unique_ptr buildCompilerInstance(Session &session, std::u + else + ci->getPreprocessorOpts().addRemappedFile(main, buf.get()); + ++#if LLVM_VERSION_MAJOR >= 21 ++ auto clang = std::make_unique(std::move(ci), session.pch); ++#else + auto clang = std::make_unique(session.pch); + clang->setInvocation(std::move(ci)); ++#endif + clang->createDiagnostics( + #if LLVM_VERSION_MAJOR >= 20 + *fs, + #endif + &dc, false); ++#if LLVM_VERSION_MAJOR >= 21 ++ clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getTargetOpts())); ++#else + clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts)); ++#endif + if (!clang->hasTarget()) + return nullptr; + clang->getPreprocessorOpts().RetainRemappedFileBuffers = true; diff --git a/reformat.patch b/reformat.patch new file mode 100644 index 0000000..f4b7452 --- /dev/null +++ b/reformat.patch @@ -0,0 +1,6294 @@ +From 48f1a006b78944a944cdc0c98fb4b447e19fce7d Mon Sep 17 00:00:00 2001 +From: Ka Ho Ng +Date: Fri, 6 Dec 2024 20:58:19 -0500 +Subject: [PATCH] Reformat all the files after 192a82b (#979) + +Since the introduction of "ColumnLimit: 120" in .clang-format, the +column limit has become 120 characters instead of 80 characters. + +This prevents clang-format from generating too much changes even if just +a small portion of a source file or header file is modified. +--- + src/clang_tu.cc | 32 ++- + src/clang_tu.hh | 19 +- + src/config.hh | 44 ++-- + src/filesystem.cc | 9 +- + src/filesystem.hh | 3 +- + src/fuzzy_match.cc | 14 +- + src/hierarchy.hh | 3 +- + src/indexer.cc | 234 +++++++-------------- + src/indexer.hh | 83 +++----- + src/log.cc | 6 +- + src/log.hh | 13 +- + src/lsp.cc | 15 +- + src/lsp.hh | 47 ++--- + src/main.cc | 41 ++-- + src/message_handler.cc | 61 ++---- + src/message_handler.hh | 45 ++-- + src/messages/ccls_call.cc | 74 ++----- + src/messages/ccls_info.cc | 6 +- + src/messages/ccls_inheritance.cc | 32 +-- + src/messages/ccls_member.cc | 48 ++--- + src/messages/ccls_navigate.cc | 25 +-- + src/messages/ccls_vars.cc | 3 +- + src/messages/initialize.cc | 53 ++--- + src/messages/textDocument_code.cc | 46 ++-- + src/messages/textDocument_completion.cc | 157 ++++++-------- + src/messages/textDocument_definition.cc | 36 ++-- + src/messages/textDocument_did.cc | 6 +- + src/messages/textDocument_document.cc | 74 +++---- + src/messages/textDocument_foldingRange.cc | 9 +- + src/messages/textDocument_formatting.cc | 35 ++- + src/messages/textDocument_hover.cc | 16 +- + src/messages/textDocument_references.cc | 11 +- + src/messages/textDocument_rename.cc | 9 +- + src/messages/textDocument_signatureHelp.cc | 41 ++-- + src/messages/workspace.cc | 38 ++-- + src/pipeline.cc | 136 +++++------- + src/pipeline.hh | 13 +- + src/platform_win.cc | 7 +- + src/position.cc | 7 +- + src/position.hh | 12 +- + src/project.cc | 69 ++---- + src/project.hh | 3 +- + src/query.cc | 216 ++++++++----------- + src/query.hh | 50 ++--- + src/sema_manager.cc | 230 +++++++------------- + src/sema_manager.hh | 38 ++-- + src/serializer.cc | 53 ++--- + src/serializer.hh | 105 ++++----- + src/test.cc | 230 +++++++++----------- + src/threaded_queue.hh | 21 +- + src/utils.cc | 31 +-- + src/utils.hh | 40 ++-- + src/working_files.cc | 76 +++---- + src/working_files.hh | 9 +- + 54 files changed, 974 insertions(+), 1760 deletions(-) + +diff --git a/src/clang_tu.cc b/src/clang_tu.cc +index 54e04ef0e..5c880b32c 100644 +--- a/src/clang_tu.cc ++++ b/src/clang_tu.cc +@@ -57,10 +57,8 @@ bool isInsideMainFile(const SourceManager &sm, SourceLocation sl) { + return fid == sm.getMainFileID() || fid == sm.getPreambleFileID(); + } + +-static Pos decomposed2LineAndCol(const SourceManager &sm, +- std::pair i) { +- int l = (int)sm.getLineNumber(i.first, i.second) - 1, +- c = (int)sm.getColumnNumber(i.first, i.second) - 1; ++static Pos decomposed2LineAndCol(const SourceManager &sm, std::pair i) { ++ int l = (int)sm.getLineNumber(i.first, i.second) - 1, c = (int)sm.getColumnNumber(i.first, i.second) - 1; + bool invalid = false; + StringRef buf = sm.getBufferData(i.first, &invalid); + if (!invalid) { +@@ -71,15 +69,12 @@ static Pos decomposed2LineAndCol(const SourceManager &sm, + while (i < p.size() && (uint8_t)p[i] >= 128 && (uint8_t)p[i] < 192) + i++; + } +- return {(uint16_t)std::min(l, UINT16_MAX), +- (int16_t)std::min(c, INT16_MAX)}; ++ return {(uint16_t)std::min(l, UINT16_MAX), (int16_t)std::min(c, INT16_MAX)}; + } + +-Range fromCharSourceRange(const SourceManager &sm, const LangOptions &lang, +- CharSourceRange csr, FileID *fid) { ++Range fromCharSourceRange(const SourceManager &sm, const LangOptions &lang, CharSourceRange csr, FileID *fid) { + SourceLocation bloc = csr.getBegin(), eloc = csr.getEnd(); +- std::pair binfo = sm.getDecomposedLoc(bloc), +- einfo = sm.getDecomposedLoc(eloc); ++ std::pair binfo = sm.getDecomposedLoc(bloc), einfo = sm.getDecomposedLoc(eloc); + if (csr.isTokenRange()) + einfo.second += Lexer::MeasureTokenLength(eloc, sm, lang); + if (fid) +@@ -87,13 +82,12 @@ Range fromCharSourceRange(const SourceManager &sm, const LangOptions &lang, + return {decomposed2LineAndCol(sm, binfo), decomposed2LineAndCol(sm, einfo)}; + } + +-Range fromTokenRange(const SourceManager &sm, const LangOptions &lang, +- SourceRange sr, FileID *fid) { ++Range fromTokenRange(const SourceManager &sm, const LangOptions &lang, SourceRange sr, FileID *fid) { + return fromCharSourceRange(sm, lang, CharSourceRange::getTokenRange(sr), fid); + } + +-Range fromTokenRangeDefaulted(const SourceManager &sm, const LangOptions &lang, +- SourceRange sr, FileID fid, Range range) { ++Range fromTokenRangeDefaulted(const SourceManager &sm, const LangOptions &lang, SourceRange sr, FileID fid, ++ Range range) { + auto decomposed = sm.getDecomposedLoc(sm.getExpansionLoc(sr.getBegin())); + if (decomposed.first == fid) + range.start = decomposed2LineAndCol(sm, decomposed); +@@ -106,17 +100,15 @@ Range fromTokenRangeDefaulted(const SourceManager &sm, const LangOptions &lang, + return range; + } + +-std::unique_ptr +-buildCompilerInvocation(const std::string &main, std::vector args, +- IntrusiveRefCntPtr vfs) { ++std::unique_ptr buildCompilerInvocation(const std::string &main, std::vector args, ++ IntrusiveRefCntPtr vfs) { + std::string save = "-resource-dir=" + g_config->clang.resourceDir; + args.push_back(save.c_str()); + args.push_back("-fsyntax-only"); + + // Similar to clang/tools/driver/driver.cpp:insertTargetAndModeArgs but don't + // require llvm::InitializeAllTargetInfos(). +- auto target_and_mode = +- driver::ToolChain::getTargetAndModeFromProgramName(args[0]); ++ auto target_and_mode = driver::ToolChain::getTargetAndModeFromProgramName(args[0]); + if (target_and_mode.DriverMode) + args.insert(args.begin() + 1, target_and_mode.DriverMode); + if (!target_and_mode.TargetPrefix.empty()) { +@@ -145,7 +137,7 @@ buildCompilerInvocation(const std::string &main, std::vector args, + const driver::JobList &jobs = comp->getJobs(); + bool offload_compilation = false; + if (jobs.size() > 1) { +- for (auto &a : comp->getActions()){ ++ for (auto &a : comp->getActions()) { + // On MacOSX real actions may end up being wrapped in BindArchAction + if (isa(a)) + a = *a->input_begin(); +diff --git a/src/clang_tu.hh b/src/clang_tu.hh +index fd98ced11..b786c1696 100644 +--- a/src/clang_tu.hh ++++ b/src/clang_tu.hh +@@ -28,23 +28,18 @@ std::string pathFromFileEntry(clang::FileEntryRef file); + + bool isInsideMainFile(const clang::SourceManager &sm, clang::SourceLocation sl); + +-Range fromCharSourceRange(const clang::SourceManager &sm, +- const clang::LangOptions &lang, +- clang::CharSourceRange csr, ++Range fromCharSourceRange(const clang::SourceManager &sm, const clang::LangOptions &lang, clang::CharSourceRange csr, + clang::FileID *fid = nullptr); + +-Range fromTokenRange(const clang::SourceManager &sm, +- const clang::LangOptions &lang, clang::SourceRange sr, ++Range fromTokenRange(const clang::SourceManager &sm, const clang::LangOptions &lang, clang::SourceRange sr, + clang::FileID *fid = nullptr); + +-Range fromTokenRangeDefaulted(const clang::SourceManager &sm, +- const clang::LangOptions &lang, +- clang::SourceRange sr, clang::FileID fid, +- Range range); ++Range fromTokenRangeDefaulted(const clang::SourceManager &sm, const clang::LangOptions &lang, clang::SourceRange sr, ++ clang::FileID fid, Range range); + +-std::unique_ptr +-buildCompilerInvocation(const std::string &main, std::vector args, +- llvm::IntrusiveRefCntPtr VFS); ++std::unique_ptr buildCompilerInvocation(const std::string &main, ++ std::vector args, ++ llvm::IntrusiveRefCntPtr VFS); + + const char *clangBuiltinTypeName(int); + } // namespace ccls +diff --git a/src/config.hh b/src/config.hh +index b768e4760..0faeadaf5 100644 +--- a/src/config.hh ++++ b/src/config.hh +@@ -324,42 +324,30 @@ struct Config { + int maxNum = 2000; + } xref; + }; +-REFLECT_STRUCT(Config::Cache, directory, format, hierarchicalPath, +- retainInMemory); +-REFLECT_STRUCT(Config::ServerCap::DocumentOnTypeFormattingOptions, +- firstTriggerCharacter, moreTriggerCharacter); +-REFLECT_STRUCT(Config::ServerCap::Workspace::WorkspaceFolders, supported, +- changeNotifications); ++REFLECT_STRUCT(Config::Cache, directory, format, hierarchicalPath, retainInMemory); ++REFLECT_STRUCT(Config::ServerCap::DocumentOnTypeFormattingOptions, firstTriggerCharacter, moreTriggerCharacter); ++REFLECT_STRUCT(Config::ServerCap::Workspace::WorkspaceFolders, supported, changeNotifications); + REFLECT_STRUCT(Config::ServerCap::Workspace, workspaceFolders); +-REFLECT_STRUCT(Config::ServerCap, documentOnTypeFormattingProvider, +- foldingRangeProvider, workspace); +-REFLECT_STRUCT(Config::Clang, excludeArgs, extraArgs, pathMappings, +- resourceDir); +-REFLECT_STRUCT(Config::ClientCapability, diagnosticsRelatedInformation, +- hierarchicalDocumentSymbolSupport, linkSupport, snippetSupport); ++REFLECT_STRUCT(Config::ServerCap, documentOnTypeFormattingProvider, foldingRangeProvider, workspace); ++REFLECT_STRUCT(Config::Clang, excludeArgs, extraArgs, pathMappings, resourceDir); ++REFLECT_STRUCT(Config::ClientCapability, diagnosticsRelatedInformation, hierarchicalDocumentSymbolSupport, linkSupport, ++ snippetSupport); + REFLECT_STRUCT(Config::CodeLens, localVariables); +-REFLECT_STRUCT(Config::Completion::Include, blacklist, maxPathSize, +- suffixWhitelist, whitelist); +-REFLECT_STRUCT(Config::Completion, caseSensitivity, detailedLabel, +- dropOldRequests, duplicateOptional, filterAndSort, include, +- maxNum, placeholder); +-REFLECT_STRUCT(Config::Diagnostics, blacklist, onChange, onOpen, onSave, +- spellChecking, whitelist) ++REFLECT_STRUCT(Config::Completion::Include, blacklist, maxPathSize, suffixWhitelist, whitelist); ++REFLECT_STRUCT(Config::Completion, caseSensitivity, detailedLabel, dropOldRequests, duplicateOptional, filterAndSort, ++ include, maxNum, placeholder); ++REFLECT_STRUCT(Config::Diagnostics, blacklist, onChange, onOpen, onSave, spellChecking, whitelist) + REFLECT_STRUCT(Config::Highlight, largeFileSize, rainbow, blacklist, whitelist) + REFLECT_STRUCT(Config::Index::Name, suppressUnwrittenScope); +-REFLECT_STRUCT(Config::Index, blacklist, comments, initialNoLinkage, +- initialBlacklist, initialWhitelist, maxInitializerLines, +- multiVersion, multiVersionBlacklist, multiVersionWhitelist, name, +- onChange, parametersInDeclarations, threads, trackDependency, +- whitelist); ++REFLECT_STRUCT(Config::Index, blacklist, comments, initialNoLinkage, initialBlacklist, initialWhitelist, ++ maxInitializerLines, multiVersion, multiVersionBlacklist, multiVersionWhitelist, name, onChange, ++ parametersInDeclarations, threads, trackDependency, whitelist); + REFLECT_STRUCT(Config::Request, timeout); + REFLECT_STRUCT(Config::Session, maxNum); + REFLECT_STRUCT(Config::WorkspaceSymbol, caseSensitivity, maxNum, sort); + REFLECT_STRUCT(Config::Xref, maxNum); +-REFLECT_STRUCT(Config, compilationDatabaseCommand, compilationDatabaseDirectory, +- cache, capabilities, clang, client, codeLens, completion, +- diagnostics, highlight, index, request, session, workspaceSymbol, +- xref); ++REFLECT_STRUCT(Config, compilationDatabaseCommand, compilationDatabaseDirectory, cache, capabilities, clang, client, ++ codeLens, completion, diagnostics, highlight, index, request, session, workspaceSymbol, xref); + + extern Config *g_config; + +diff --git a/src/filesystem.cc b/src/filesystem.cc +index dad07dddb..3e7882846 100644 +--- a/src/filesystem.cc ++++ b/src/filesystem.cc +@@ -29,12 +29,10 @@ void getFilesInFolder(std::string folder, bool recursive, bool dir_prefix, + std::error_code ec; + std::string folder1 = curr.back(); + curr.pop_back(); +- for (sys::fs::directory_iterator i(folder1, ec, false), e; i != e && !ec; +- i.increment(ec)) { ++ for (sys::fs::directory_iterator i(folder1, ec, false), e; i != e && !ec; i.increment(ec)) { + std::string path = i->path(); + std::string filename(sys::path::filename(path)); +- if ((filename[0] == '.' && filename != ".ccls") || +- sys::fs::status(path, status, false)) ++ if ((filename[0] == '.' && filename != ".ccls") || sys::fs::status(path, status, false)) + continue; + if (sys::fs::is_symlink_file(status)) { + if (sys::fs::status(path, status, true)) +@@ -49,8 +47,7 @@ void getFilesInFolder(std::string folder, bool recursive, bool dir_prefix, + if (!dir_prefix) + path = path.substr(folder.size()); + handler(sys::path::convert_to_slash(path)); +- } else if (recursive && sys::fs::is_directory(status) && +- !seen.count(id = status.getUniqueID())) { ++ } else if (recursive && sys::fs::is_directory(status) && !seen.count(id = status.getUniqueID())) { + curr.push_back(path); + seen.insert(id); + } +diff --git a/src/filesystem.hh b/src/filesystem.hh +index 81222a55a..6b7f9876f 100644 +--- a/src/filesystem.hh ++++ b/src/filesystem.hh +@@ -9,6 +9,5 @@ + #include + #include + +-void getFilesInFolder(std::string folder, bool recursive, +- bool add_folder_to_path, ++void getFilesInFolder(std::string folder, bool recursive, bool add_folder_to_path, + const std::function &handler); +diff --git a/src/fuzzy_match.cc b/src/fuzzy_match.cc +index ddb2c3a64..df0ce8c6c 100644 +--- a/src/fuzzy_match.cc ++++ b/src/fuzzy_match.cc +@@ -32,9 +32,7 @@ void calculateRoles(std::string_view s, int roles[], int *class_set) { + if (cur == Other) + return None; + // U(U)L is Head while U(U)U is Tail +- return pre == Other || (cur == Upper && (pre == Lower || suc == Lower)) +- ? Head +- : Tail; ++ return pre == Other || (cur == Upper && (pre == Lower || suc == Lower)) ? Head : Tail; + }; + for (size_t i = 0; i < s.size() - 1; i++) { + suc = getCharClass(s[i + 1]); +@@ -117,16 +115,12 @@ int FuzzyMatcher::match(std::string_view text, bool strict) { + int(*cur)[2] = dp[(i + 1) & 1]; + cur[i][0] = cur[i][1] = kMinScore; + for (int j = i; j < n; j++) { +- cur[j + 1][0] = std::max(cur[j][0] + missScore(j, false), +- cur[j][1] + missScore(j, true)); ++ cur[j + 1][0] = std::max(cur[j][0] + missScore(j, false), cur[j][1] + missScore(j, true)); + // For the first char of pattern, apply extra restriction to filter bad + // candidates (e.g. |int| in |PRINT|) + cur[j + 1][1] = (case_sensitivity ? pat[i] == text[j] +- : low_pat[i] == low_text[j] && +- (i || text_role[j] != Tail || +- pat[i] == text[j])) +- ? std::max(pre[j][0] + matchScore(i, j, false), +- pre[j][1] + matchScore(i, j, true)) ++ : low_pat[i] == low_text[j] && (i || text_role[j] != Tail || pat[i] == text[j])) ++ ? std::max(pre[j][0] + matchScore(i, j, false), pre[j][1] + matchScore(i, j, true)) + : kMinScore * 2; + } + } +diff --git a/src/hierarchy.hh b/src/hierarchy.hh +index 24c2882c9..7387aa92b 100644 +--- a/src/hierarchy.hh ++++ b/src/hierarchy.hh +@@ -9,8 +9,7 @@ + #include + + namespace ccls { +-template +-std::vector flattenHierarchy(const std::optional &root) { ++template std::vector flattenHierarchy(const std::optional &root) { + if (!root) + return {}; + std::vector ret; +diff --git a/src/indexer.cc b/src/indexer.cc +index dff4ae2d8..17d8cc2d8 100644 +--- a/src/indexer.cc ++++ b/src/indexer.cc +@@ -86,8 +86,7 @@ struct IndexParam { + + if (!vfs.stamp(path, it->second.mtime, no_linkage ? 3 : 1)) + return; +- it->second.db = +- std::make_unique(path, it->second.content, no_linkage); ++ it->second.db = std::make_unique(path, it->second.content, no_linkage); + } + } + +@@ -110,19 +109,14 @@ struct IndexParam { + } + }; + +-StringRef getSourceInRange(const SourceManager &sm, const LangOptions &langOpts, +- SourceRange sr) { ++StringRef getSourceInRange(const SourceManager &sm, const LangOptions &langOpts, SourceRange sr) { + SourceLocation bloc = sr.getBegin(), eLoc = sr.getEnd(); +- std::pair bInfo = sm.getDecomposedLoc(bloc), +- eInfo = sm.getDecomposedLoc(eLoc); ++ std::pair bInfo = sm.getDecomposedLoc(bloc), eInfo = sm.getDecomposedLoc(eLoc); + bool invalid = false; + StringRef buf = sm.getBufferData(bInfo.first, &invalid); + if (invalid) + return ""; +- return buf.substr(bInfo.second, +- eInfo.second + +- Lexer::MeasureTokenLength(eLoc, sm, langOpts) - +- bInfo.second); ++ return buf.substr(bInfo.second, eInfo.second + Lexer::MeasureTokenLength(eLoc, sm, langOpts) - bInfo.second); + } + + Kind getKind(const Decl *d, SymbolKind &kind) { +@@ -350,9 +344,7 @@ const Decl *getTypeDecl(QualType t, bool *specialization = nullptr) { + if (const RecordType *record = tp->getAs()) + d = record->getDecl(); + else +- d = cast(tp) +- ->getTemplateName() +- .getAsTemplateDecl(); ++ d = cast(tp)->getTemplateName().getAsTemplateDecl(); + break; + + case Type::Auto: +@@ -383,9 +375,8 @@ const Decl *getAdjustedDecl(const Decl *d) { + if (auto *r = dyn_cast(d)) { + if (auto *s = dyn_cast(r)) { + if (!s->isExplicitSpecialization()) { +- llvm::PointerUnion +- result = s->getSpecializedTemplateOrPartial(); ++ llvm::PointerUnion result = ++ s->getSpecializedTemplateOrPartial(); + if (result.is()) + d = result.get(); + else +@@ -465,8 +456,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + } else { + // Other lines, skip |pad| bytes + int prefix = pad; +- while (prefix > 0 && p < e && +- (*p == ' ' || *p == '/' || *p == '*' || *p == '<' || *p == '!')) ++ while (prefix > 0 && p < e && (*p == ' ' || *p == '/' || *p == '*' || *p == '<' || *p == '!')) + prefix--, p++; + } + ret.insert(ret.end(), p, q); +@@ -527,8 +517,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + } + + template +- void setName(const Decl *d, std::string_view short_name, +- std::string_view qualified, Def &def) { ++ void setName(const Decl *d, std::string_view short_name, std::string_view qualified, Def &def) { + SmallString<256> str; + llvm::raw_svector_ostream os(str); + d->print(os, getDefaultPolicy()); +@@ -544,8 +533,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + auto i = name.find(short_name); + if (short_name.size()) + while (i != std::string::npos && +- ((i && isAsciiIdentifierContinue(name[i - 1])) || +- isAsciiIdentifierContinue(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 +@@ -569,16 +557,14 @@ class IndexDataConsumer : public index::IndexDataConsumer { + paren++; + else if (name[i - 1] == '(') + paren--; +- else if (!(paren > 0 || isAsciiIdentifierContinue(name[i - 1]) || +- name[i - 1] == ':')) ++ else if (!(paren > 0 || isAsciiIdentifierContinue(name[i - 1]) || name[i - 1] == ':')) + break; + } + def.qual_name_offset = i; + def.detailed_name = intern(name); + } + +- void setVarName(const Decl *d, std::string_view short_name, +- std::string_view qualified, IndexVar::Def &def) { ++ void setVarName(const Decl *d, std::string_view short_name, std::string_view qualified, IndexVar::Def &def) { + QualType t; + const Expr *init = nullptr; + bool deduced = false; +@@ -610,8 +596,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + llvm::raw_svector_ostream os(str); + PrintingPolicy pp = getDefaultPolicy(); + t.print(os, pp); +- if (str.size() && +- (str.back() != ' ' && str.back() != '*' && str.back() != '&')) ++ if (str.size() && (str.back() != ' ' && str.back() != '*' && str.back() != '&')) + str += ' '; + def.qual_name_offset = str.size(); + def.short_name_offset = str.size() + qualified.size() - short_name.size(); +@@ -624,21 +609,17 @@ class IndexDataConsumer : public index::IndexDataConsumer { + if (init) { + SourceManager &sm = ctx->getSourceManager(); + const LangOptions &lang = ctx->getLangOpts(); +- SourceRange sr = +- sm.getExpansionRange(init->getSourceRange()).getAsRange(); ++ SourceRange sr = sm.getExpansionRange(init->getSourceRange()).getAsRange(); + SourceLocation l = d->getLocation(); + if (l.isMacroID() || !sm.isBeforeInTranslationUnit(l, sr.getBegin())) + return; + StringRef buf = getSourceInRange(sm, lang, sr); + Twine init = buf.count('\n') <= g_config->index.maxInitializerLines - 1 +- ? buf.size() && buf[0] == ':' ? Twine(" ", buf) +- : Twine(" = ", buf) ++ ? buf.size() && buf[0] == ':' ? Twine(" ", buf) : Twine(" = ", buf) + : Twine(); + Twine t = def.detailed_name + init; +- def.hover = +- def.storage == SC_Static && strncmp(def.detailed_name, "static ", 7) +- ? intern(("static " + t).str()) +- : intern(t.str()); ++ def.hover = def.storage == SC_Static && strncmp(def.detailed_name, "static ", 7) ? intern(("static " + t).str()) ++ : intern(t.str()); + } + } + +@@ -660,8 +641,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + return it->second.first; + } + +- void addMacroUse(IndexFile *db, SourceManager &sm, Usr usr, Kind kind, +- SourceLocation sl) const { ++ void addMacroUse(IndexFile *db, SourceManager &sm, Usr usr, Kind kind, SourceLocation sl) const { + FileID fid = sm.getFileID(sl); + int lid = getFileLID(db, sm, fid); + if (lid < 0) +@@ -691,8 +671,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + int offset; + std::tie(rd, offset) = stack.back(); + stack.pop_back(); +- if (!rd->isCompleteDefinition() || rd->isDependentType() || +- rd->isInvalidDecl() || !validateRecord(rd)) ++ if (!rd->isCompleteDefinition() || rd->isDependentType() || rd->isInvalidDecl() || !validateRecord(rd)) + offset = -1; + for (FieldDecl *fd : rd->fields()) { + int offset1 = offset < 0 ? -1 : int(offset + ctx->getFieldOffset(fd)); +@@ -710,10 +689,8 @@ class IndexDataConsumer : public index::IndexDataConsumer { + public: + IndexDataConsumer(IndexParam ¶m) : param(param) {} + void initialize(ASTContext &ctx) override { this->ctx = param.ctx = &ctx; } +- bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles, +- ArrayRef relations, +- SourceLocation src_loc, +- ASTNodeInfo ast_node) override { ++ bool handleDeclOccurrence(const Decl *d, index::SymbolRoleSet roles, ArrayRef relations, ++ SourceLocation src_loc, ASTNodeInfo ast_node) override { + if (!param.no_linkage) { + if (auto *nd = dyn_cast(d); nd && nd->hasLinkage()) + ; +@@ -725,9 +702,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + FileID fid; + SourceLocation spell = sm.getSpellingLoc(src_loc); + Range loc; +- auto r = sm.isMacroArgExpansion(src_loc) +- ? CharSourceRange::getTokenRange(spell) +- : sm.getExpansionRange(src_loc); ++ auto r = sm.isMacroArgExpansion(src_loc) ? CharSourceRange::getTokenRange(spell) : sm.getExpansionRange(src_loc); + loc = fromCharSourceRange(sm, lang, r); + fid = sm.getFileID(r.getBegin()); + if (fid.isInvalid()) +@@ -753,11 +728,9 @@ class IndexDataConsumer : public index::IndexDataConsumer { + const DeclContext *lex_dc = ast_node.ContainerDC->getRedeclContext(); + { + const NamespaceDecl *nd; +- while ((nd = dyn_cast(cast(sem_dc))) && +- nd->isAnonymousNamespace()) ++ while ((nd = dyn_cast(cast(sem_dc))) && nd->isAnonymousNamespace()) + sem_dc = nd->getDeclContext()->getRedeclContext(); +- while ((nd = dyn_cast(cast(lex_dc))) && +- nd->isAnonymousNamespace()) ++ while ((nd = dyn_cast(cast(lex_dc))) && nd->isAnonymousNamespace()) + lex_dc = nd->getDeclContext()->getRedeclContext(); + } + Role role = static_cast(roles); +@@ -780,8 +753,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + case Decl::CXXMethod: // *operator*= => *operator=* + case Decl::Function: // operator delete + if (src_loc.isFileID()) { +- SourceRange sr = +- cast(origD)->getNameInfo().getSourceRange(); ++ SourceRange sr = cast(origD)->getNameInfo().getSourceRange(); + if (sr.getEnd().isFileID()) + loc = fromTokenRange(sm, lang, sr); + } +@@ -803,14 +775,12 @@ class IndexDataConsumer : public index::IndexDataConsumer { + Use use{{loc, role}, lid}; + if (is_def) { + SourceRange sr = origD->getSourceRange(); +- entity->def.spell = {use, +- fromTokenRangeDefaulted(sm, lang, sr, fid, loc)}; ++ entity->def.spell = {use, fromTokenRangeDefaulted(sm, lang, sr, fid, loc)}; + entity->def.parent_kind = SymbolKind::File; + getKind(cast(sem_dc), entity->def.parent_kind); + } else if (is_decl) { + SourceRange sr = origD->getSourceRange(); +- entity->declarations.push_back( +- {use, fromTokenRangeDefaulted(sm, lang, sr, fid, loc)}); ++ entity->declarations.push_back({use, fromTokenRangeDefaulted(sm, lang, sr, fid, loc)}); + } else { + entity->uses.push_back(use); + return; +@@ -821,8 +791,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + switch (kind) { + case Kind::Invalid: + if (ls_kind == SymbolKind::Unknown) +- LOG_S(INFO) << "Unhandled " << int(d->getKind()) << " " +- << info->qualified << " in " << db->path << ":" ++ LOG_S(INFO) << "Unhandled " << int(d->getKind()) << " " << info->qualified << " in " << db->path << ":" + << (loc.start.line + 1) << ":" << (loc.start.column + 1); + return true; + case Kind::File: +@@ -831,9 +800,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + func = &db->toFunc(usr); + func->def.kind = ls_kind; + // Mark as Role::Implicit to span one more column to the left/right. +- if (!is_def && !is_decl && +- (d->getKind() == Decl::CXXConstructor || +- d->getKind() == Decl::CXXConversion)) ++ if (!is_def && !is_decl && (d->getKind() == Decl::CXXConstructor || d->getKind() == Decl::CXXConversion)) + role = Role(role | Role::Implicit); + do_def_decl(func); + if (spell != src_loc) +@@ -847,8 +814,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + } else { + const Decl *dc = cast(lex_dc); + if (getKind(dc, ls_kind) == Kind::Func) +- db->toFunc(getUsr(dc)) +- .def.callees.push_back({loc, usr, Kind::Func, role}); ++ db->toFunc(getUsr(dc)).def.callees.push_back({loc, usr, Kind::Func, role}); + } + break; + case Kind::Type: +@@ -857,8 +823,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + do_def_decl(type); + if (spell != src_loc) + addMacroUse(db, sm, usr, Kind::Type, spell); +- if ((is_def || type->def.detailed_name[0] == '\0') && +- info->short_name.size()) { ++ if ((is_def || type->def.detailed_name[0] == '\0') && info->short_name.size()) { + if (d->getKind() == Decl::TemplateTypeParm) + type->def.detailed_name = intern(info->short_name); + else +@@ -907,9 +872,8 @@ class IndexDataConsumer : public index::IndexDataConsumer { + // e.g. lambda parameter + SourceLocation l = d->getLocation(); + if (sm.getFileID(l) == fid) { +- var->def.spell = { +- Use{{fromTokenRange(sm, lang, {l, l}), Role::Definition}, lid}, +- fromTokenRange(sm, lang, d->getSourceRange())}; ++ var->def.spell = {Use{{fromTokenRange(sm, lang, {l, l}), Role::Definition}, lid}, ++ fromTokenRange(sm, lang, d->getSourceRange())}; + var->def.parent_kind = SymbolKind::Method; + } + } +@@ -942,8 +906,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + auto *rd = dyn_cast(d); + if (rd && rd->hasDefinition()) + for (const CXXBaseSpecifier &base : rd->bases()) +- if (const Decl *baseD = +- getAdjustedDecl(getTypeDecl(base.getType()))) { ++ if (const Decl *baseD = getAdjustedDecl(getTypeDecl(base.getType()))) { + Usr usr1 = getUsr(baseD); + type->def.bases.push_back(usr1); + db->toType(usr1).derived.push_back(usr); +@@ -999,9 +962,8 @@ class IndexDataConsumer : public index::IndexDataConsumer { + if (auto *sd = dyn_cast(rd)) + d1 = sd->getSpecializedTemplate(); + else if (auto *sd = dyn_cast(rd)) { +- llvm::PointerUnion +- result = sd->getSpecializedTemplateOrPartial(); ++ llvm::PointerUnion result = ++ sd->getSpecializedTemplateOrPartial(); + if (result.is()) + d1 = result.get(); + else +@@ -1032,8 +994,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + const TypeSourceInfo *tsi = td->getTypeSourceInfo(); + SourceLocation l1 = tsi->getTypeLoc().getBeginLoc(); + if (sm.getFileID(l1) == fid) +- type1.uses.push_back( +- {{fromTokenRange(sm, lang, {l1, l1}), Role::Reference}, lid}); ++ type1.uses.push_back({{fromTokenRange(sm, lang, {l1, l1}), Role::Reference}, lid}); + } + } + } +@@ -1056,8 +1017,7 @@ class IndexDataConsumer : public index::IndexDataConsumer { + auto *ecd = cast(d); + const auto &val = ecd->getInitVal(); + std::string init = +- " = " + (val.isSigned() ? std::to_string(val.getSExtValue()) +- : std::to_string(val.getZExtValue())); ++ " = " + (val.isSigned() ? std::to_string(val.getSExtValue()) : std::to_string(val.getZExtValue())); + var->def.hover = intern(var->def.detailed_name + init); + } + break; +@@ -1080,15 +1040,12 @@ class IndexPPCallbacks : public PPCallbacks { + } + + public: +- IndexPPCallbacks(SourceManager &sm, IndexParam ¶m) +- : sm(sm), param(param) {} +- void FileChanged(SourceLocation sl, FileChangeReason reason, +- SrcMgr::CharacteristicKind, FileID) override { ++ IndexPPCallbacks(SourceManager &sm, IndexParam ¶m) : sm(sm), param(param) {} ++ void FileChanged(SourceLocation sl, FileChangeReason reason, SrcMgr::CharacteristicKind, FileID) override { + if (reason == FileChangeReason::EnterFile) + (void)param.consumeFile(sm.getFileID(sl)); + } +- void InclusionDirective(SourceLocation hashLoc, const Token &tok, +- StringRef included, bool isAngled, ++ void InclusionDirective(SourceLocation hashLoc, const Token &tok, StringRef included, bool isAngled, + CharSourceRange filenameRange, + #if LLVM_VERSION_MAJOR >= 16 // llvmorg-16-init-15080-g854c10f8d185 + OptionalFileEntryRef fileRef, +@@ -1097,8 +1054,7 @@ class IndexPPCallbacks : public PPCallbacks { + #else + const FileEntry *file, + #endif +- StringRef searchPath, StringRef relativePath, +- const clang::Module *suggestedModule, ++ StringRef searchPath, StringRef relativePath, const clang::Module *suggestedModule, + #if LLVM_VERSION_MAJOR >= 19 // llvmorg-19-init-1720-gda95d926f6fc + bool moduleImported, + #endif +@@ -1108,8 +1064,7 @@ class IndexPPCallbacks : public PPCallbacks { + #endif + if (!file) + return; +- auto spell = fromCharSourceRange(sm, param.ctx->getLangOpts(), +- filenameRange, nullptr); ++ auto spell = fromCharSourceRange(sm, param.ctx->getLangOpts(), filenameRange, nullptr); + FileID fid = sm.getFileID(filenameRange.getBegin()); + if (IndexFile *db = param.consumeFile(fid)) { + #if LLVM_VERSION_MAJOR < 19 +@@ -1141,34 +1096,28 @@ class IndexPPCallbacks : public PPCallbacks { + var.def.detailed_name = intern(name); + var.def.short_name_size = name.size(); + StringRef buf = getSourceInRange(sm, lang, sr); +- var.def.hover = +- intern(buf.count('\n') <= g_config->index.maxInitializerLines - 1 +- ? Twine("#define ", getSourceInRange(sm, lang, sr)).str() +- : Twine("#define ", name).str()); ++ var.def.hover = intern(buf.count('\n') <= g_config->index.maxInitializerLines - 1 ++ ? Twine("#define ", getSourceInRange(sm, lang, sr)).str() ++ : Twine("#define ", name).str()); + } + } + } +- void MacroExpands(const Token &tok, const MacroDefinition &, SourceRange sr, +- const MacroArgs *) override { ++ void MacroExpands(const Token &tok, const MacroDefinition &, SourceRange sr, const MacroArgs *) override { + SourceLocation sl = sm.getSpellingLoc(sr.getBegin()); + FileID fid = sm.getFileID(sl); + if (IndexFile *db = param.consumeFile(fid)) { + IndexVar &var = db->toVar(getMacro(tok).second); +- var.uses.push_back( +- {{fromTokenRange(sm, param.ctx->getLangOpts(), {sl, sl}, nullptr), +- Role::Dynamic}}); ++ var.uses.push_back({{fromTokenRange(sm, param.ctx->getLangOpts(), {sl, sl}, nullptr), Role::Dynamic}}); + } + } +- void MacroUndefined(const Token &tok, const MacroDefinition &md, +- const MacroDirective *ud) override { ++ void MacroUndefined(const Token &tok, const MacroDefinition &md, const MacroDirective *ud) override { + if (ud) { + SourceLocation sl = ud->getLocation(); + MacroExpands(tok, md, {sl, sl}, nullptr); + } + } + void SourceRangeSkipped(SourceRange sr, SourceLocation) override { +- Range range = fromCharSourceRange(sm, param.ctx->getLangOpts(), +- CharSourceRange::getCharRange(sr)); ++ Range range = fromCharSourceRange(sm, param.ctx->getLangOpts(), CharSourceRange::getCharRange(sr)); + FileID fid = sm.getFileID(sr.getBegin()); + if (fid.isValid()) + if (IndexFile *db = param.consumeFile(fid)) +@@ -1182,13 +1131,10 @@ class IndexFrontendAction : public ASTFrontendAction { + IndexParam ¶m; + + public: +- IndexFrontendAction(std::shared_ptr dataConsumer, +- const index::IndexingOptions &indexOpts, ++ IndexFrontendAction(std::shared_ptr dataConsumer, const index::IndexingOptions &indexOpts, + IndexParam ¶m) +- : dataConsumer(std::move(dataConsumer)), indexOpts(indexOpts), +- param(param) {} +- std::unique_ptr CreateASTConsumer(CompilerInstance &ci, +- StringRef inFile) override { ++ : dataConsumer(std::move(dataConsumer)), indexOpts(indexOpts), param(param) {} ++ std::unique_ptr CreateASTConsumer(CompilerInstance &ci, StringRef inFile) override { + class SkipProcessed : public ASTConsumer { + IndexParam ¶m; + const ASTContext *ctx = nullptr; +@@ -1199,18 +1145,15 @@ class IndexFrontendAction : public ASTFrontendAction { + bool shouldSkipFunctionBody(Decl *d) override { + const SourceManager &sm = ctx->getSourceManager(); + FileID fid = sm.getFileID(sm.getExpansionLoc(d->getLocation())); +- return !(g_config->index.multiVersion && param.useMultiVersion(fid)) && +- !param.consumeFile(fid); ++ return !(g_config->index.multiVersion && param.useMultiVersion(fid)) && !param.consumeFile(fid); + } + }; + + std::shared_ptr pp = ci.getPreprocessorPtr(); +- pp->addPPCallbacks( +- std::make_unique(pp->getSourceManager(), param)); ++ pp->addPPCallbacks(std::make_unique(pp->getSourceManager(), param)); + std::vector> consumers; + consumers.push_back(std::make_unique(param)); +- consumers.push_back(index::createIndexingASTConsumer( +- dataConsumer, indexOpts, std::move(pp))); ++ consumers.push_back(index::createIndexingASTConsumer(dataConsumer, indexOpts, std::move(pp))); + return std::make_unique(std::move(consumers)); + } + }; +@@ -1218,8 +1161,7 @@ class IndexFrontendAction : public ASTFrontendAction { + class IndexDiags : public DiagnosticConsumer { + public: + llvm::SmallString<64> message; +- void HandleDiagnostic(DiagnosticsEngine::Level level, +- const clang::Diagnostic &info) override { ++ void HandleDiagnostic(DiagnosticsEngine::Level level, const clang::Diagnostic &info) override { + DiagnosticConsumer::HandleDiagnostic(level, info); + if (message.empty()) + info.FormatDiagnostic(message); +@@ -1230,8 +1172,7 @@ class IndexDiags : public DiagnosticConsumer { + const int IndexFile::kMajorVersion = 21; + const int IndexFile::kMinorVersion = 0; + +-IndexFile::IndexFile(const std::string &path, const std::string &contents, +- bool no_linkage) ++IndexFile::IndexFile(const std::string &path, const std::string &contents, bool no_linkage) + : path(path), no_linkage(no_linkage), file_contents(contents) {} + + IndexFunc &IndexFile::toFunc(Usr usr) { +@@ -1255,9 +1196,7 @@ IndexVar &IndexFile::toVar(Usr usr) { + return it->second; + } + +-std::string IndexFile::toString() { +- return ccls::serialize(SerializeFormat::Json, *this); +-} ++std::string IndexFile::toString() { return ccls::serialize(SerializeFormat::Json, *this); } + + template void uniquify(std::vector &a) { + std::unordered_set seen; +@@ -1270,22 +1209,16 @@ template void uniquify(std::vector &a) { + + namespace idx { + void init() { +- multiVersionMatcher = new GroupMatch(g_config->index.multiVersionWhitelist, +- g_config->index.multiVersionBlacklist); ++ multiVersionMatcher = new GroupMatch(g_config->index.multiVersionWhitelist, g_config->index.multiVersionBlacklist); + } + +-IndexResult +-index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, +- const std::string &opt_wdir, const std::string &main, +- const std::vector &args, +- const std::vector> &remapped, +- bool no_linkage, bool &ok) { ++IndexResult index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, const std::string &opt_wdir, ++ const std::string &main, const std::vector &args, ++ const std::vector> &remapped, bool no_linkage, bool &ok) { + ok = true; + auto pch = std::make_shared(); +- llvm::IntrusiveRefCntPtr fs = +- llvm::vfs::getRealFileSystem(); +- std::shared_ptr ci = +- buildCompilerInvocation(main, args, fs); ++ llvm::IntrusiveRefCntPtr fs = llvm::vfs::getRealFileSystem(); ++ std::shared_ptr ci = buildCompilerInvocation(main, args, fs); + // e.g. .s + if (!ci) + return {}; +@@ -1293,12 +1226,10 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + // -fparse-all-comments enables documentation in the indexer and in + // code completion. + #if LLVM_VERSION_MAJOR >= 18 +- ci->getLangOpts().CommentOpts.ParseAllComments = +- g_config->index.comments > 1; ++ ci->getLangOpts().CommentOpts.ParseAllComments = g_config->index.comments > 1; + ci->getLangOpts().RetainCommentsFromSystemHeaders = true; + #else +- ci->getLangOpts()->CommentOpts.ParseAllComments = +- g_config->index.comments > 1; ++ ci->getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1; + ci->getLangOpts()->RetainCommentsFromSystemHeaders = true; + #endif + std::string buf = wfiles->getContent(main); +@@ -1318,30 +1249,25 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + #endif + &dc, false); + clang->getDiagnostics().setIgnoreAllWarnings(true); +- clang->setTarget(TargetInfo::CreateTargetInfo( +- clang->getDiagnostics(), clang->getInvocation().TargetOpts)); ++ clang->setTarget(TargetInfo::CreateTargetInfo(clang->getDiagnostics(), clang->getInvocation().TargetOpts)); + if (!clang->hasTarget()) + return {}; + clang->getPreprocessorOpts().RetainRemappedFileBuffers = true; + clang->createFileManager(fs); +- clang->setSourceManager(new SourceManager(clang->getDiagnostics(), +- clang->getFileManager(), true)); ++ clang->setSourceManager(new SourceManager(clang->getDiagnostics(), clang->getFileManager(), true)); + + IndexParam param(*vfs, no_linkage); + + index::IndexingOptions indexOpts; +- indexOpts.SystemSymbolFilter = +- index::IndexingOptions::SystemSymbolFilterKind::All; ++ indexOpts.SystemSymbolFilter = index::IndexingOptions::SystemSymbolFilterKind::All; + if (no_linkage) { + indexOpts.IndexFunctionLocals = true; + indexOpts.IndexImplicitInstantiation = true; +- indexOpts.IndexParametersInDeclarations = +- g_config->index.parametersInDeclarations; ++ indexOpts.IndexParametersInDeclarations = g_config->index.parametersInDeclarations; + indexOpts.IndexTemplateParameters = true; + } + +- auto action = std::make_unique( +- std::make_shared(param), indexOpts, param); ++ auto action = std::make_unique(std::make_shared(param), indexOpts, param); + std::string reason; + { + llvm::CrashRecoveryContext crc; +@@ -1361,8 +1287,7 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + } + } + if (!ok) { +- LOG_S(ERROR) << "failed to index " << main +- << (reason.empty() ? "" : ": " + reason); ++ LOG_S(ERROR) << "failed to index " << main << (reason.empty() ? "" : ": " + reason); + return {}; + } + +@@ -1403,8 +1328,7 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs, + if (path == entry->path) + entry->mtime = file.mtime; + else if (path != entry->import_file) +- entry->dependencies[llvm::CachedHashStringRef(intern(path))] = +- file.mtime; ++ entry->dependencies[llvm::CachedHashStringRef(intern(path))] = file.mtime; + } + result.indexes.push_back(std::move(entry)); + } +@@ -1443,22 +1367,20 @@ void reflect(JsonReader &vis, DeclRef &v) { + + void reflect(JsonWriter &vis, SymbolRef &v) { + char buf[99]; +- snprintf(buf, sizeof buf, "%s|%" PRIu64 "|%d|%d", v.range.toString().c_str(), +- v.usr, int(v.kind), int(v.role)); ++ snprintf(buf, sizeof buf, "%s|%" PRIu64 "|%d|%d", v.range.toString().c_str(), v.usr, int(v.kind), int(v.role)); + std::string s(buf); + reflect(vis, s); + } + void reflect(JsonWriter &vis, Use &v) { + char buf[99]; +- snprintf(buf, sizeof buf, "%s|%d|%d", v.range.toString().c_str(), int(v.role), +- v.file_id); ++ snprintf(buf, sizeof buf, "%s|%d|%d", v.range.toString().c_str(), int(v.role), v.file_id); + std::string s(buf); + reflect(vis, s); + } + void reflect(JsonWriter &vis, DeclRef &v) { + char buf[99]; +- snprintf(buf, sizeof buf, "%s|%s|%d|%d", v.range.toString().c_str(), +- v.extent.toString().c_str(), int(v.role), v.file_id); ++ snprintf(buf, sizeof buf, "%s|%s|%d|%d", v.range.toString().c_str(), v.extent.toString().c_str(), int(v.role), ++ v.file_id); + std::string s(buf); + reflect(vis, s); + } +diff --git a/src/indexer.hh b/src/indexer.hh +index 8aea31e6a..d72a440eb 100644 +--- a/src/indexer.hh ++++ b/src/indexer.hh +@@ -51,23 +51,15 @@ enum class Role : uint16_t { + All = (1 << 9) - 1, + }; + REFLECT_UNDERLYING_B(Role); +-inline uint16_t operator&(Role lhs, Role rhs) { +- return uint16_t(lhs) & uint16_t(rhs); +-} +-inline Role operator|(Role lhs, Role rhs) { +- return Role(uint16_t(lhs) | uint16_t(rhs)); +-} ++inline uint16_t operator&(Role lhs, Role rhs) { return uint16_t(lhs) & uint16_t(rhs); } ++inline Role operator|(Role lhs, Role rhs) { return Role(uint16_t(lhs) | uint16_t(rhs)); } + + struct SymbolIdx { + Usr usr; + Kind kind; + +- bool operator==(const SymbolIdx &o) const { +- return usr == o.usr && kind == o.kind; +- } +- bool operator<(const SymbolIdx &o) const { +- return usr != o.usr ? usr < o.usr : kind < o.kind; +- } ++ bool operator==(const SymbolIdx &o) const { return usr == o.usr && kind == o.kind; } ++ bool operator<(const SymbolIdx &o) const { return usr != o.usr ? usr < o.usr : kind < o.kind; } + }; + + // |id,kind| refer to the referenced entity. +@@ -77,18 +69,14 @@ struct SymbolRef { + Kind kind; + Role role; + operator SymbolIdx() const { return {usr, kind}; } +- std::tuple toTuple() const { +- return std::make_tuple(range, usr, kind, role); +- } ++ std::tuple toTuple() const { return std::make_tuple(range, usr, kind, role); } + bool operator==(const SymbolRef &o) const { return toTuple() == o.toTuple(); } + bool valid() const { return range.valid(); } + }; + + struct ExtentRef : SymbolRef { + Range extent; +- std::tuple toTuple() const { +- return std::make_tuple(range, usr, kind, role, extent); +- } ++ std::tuple toTuple() const { return std::make_tuple(range, usr, kind, role, extent); } + bool operator==(const ExtentRef &o) const { return toTuple() == o.toTuple(); } + }; + +@@ -97,9 +85,7 @@ struct Ref { + Role role; + + bool valid() const { return range.valid(); } +- std::tuple toTuple() const { +- return std::make_tuple(range, role); +- } ++ std::tuple toTuple() const { return std::make_tuple(range, role); } + bool operator==(const Ref &o) const { return toTuple() == o.toTuple(); } + bool operator<(const Ref &o) const { return toTuple() < o.toTuple(); } + }; +@@ -143,18 +129,13 @@ template using VectorAdapter = std::vector>; + template struct NameMixin { + std::string_view name(bool qualified) const { + auto self = static_cast(this); +- return qualified +- ? std::string_view(self->detailed_name + self->qual_name_offset, +- self->short_name_offset - +- self->qual_name_offset + +- self->short_name_size) +- : std::string_view(self->detailed_name + self->short_name_offset, +- self->short_name_size); ++ return qualified ? std::string_view(self->detailed_name + self->qual_name_offset, ++ self->short_name_offset - self->qual_name_offset + self->short_name_size) ++ : std::string_view(self->detailed_name + self->short_name_offset, self->short_name_size); + } + }; + +-template