Skip to content

Add more extensions for clangd and ccls#1423

Open
silvanshade wants to merge 3 commits intooraios:mainfrom
silvanshade:cpp-extensions
Open

Add more extensions for clangd and ccls#1423
silvanshade wants to merge 3 commits intooraios:mainfrom
silvanshade:cpp-extensions

Conversation

@silvanshade
Copy link
Copy Markdown
Contributor

This is a follow up to #1410.

This PR registers several more extensions for clangd and ccls.

Most of these extensions are taken directly from the clang driver frontend source:

https://github.com/llvm/llvm-project/blob/08992737d23113d3b9a78974b87b1ba3e7ecb6cb/clang/lib/Driver/Types.cpp#L309

The one exception is *.ixx. This is the default extension Visual Studio uses for C++20 module interface files:

https://learn.microsoft.com/en-us/cpp/cpp/modules-cpp?view=msvc-170#single-partition-modules

The clang source doesn't reference the extension but clangd does read the files without issue.

The additional extensions add support for the following:

language clangd ccls
Objective-C
C++20 module interface files
CUDA
HIP
OpenCL

I opted not to associate C++20 module interface files with ccls since it sounds like that isn't actually supported: MaskRay/ccls#798 If enabling it in the tests, it does seem to return symbols for the very simple case we have in the test repo though.

Same story for CUDA, HIP, and OpenCL. However, in those cases ccls also seems to be returning keywords (e.g, __global) as symbols, suggesting it doesn't properly recognize the AST and likely the results would not be reliable.

Related: #1259

@silvanshade silvanshade force-pushed the cpp-extensions branch 2 times, most recently from 49ec9d9 to 0b00a3f Compare April 27, 2026 04:30
@MischaPanch
Copy link
Copy Markdown
Contributor

Thanks for the PR! ccls tests on windows fail and then hang forever, I will review once tests run through in CI

test/solidlsp/cpp/test_cpp_basic.py::TestCppLanguageServer::test_find_symbol[cpp_ccls] FAILED [ 51%]

@silvanshade
Copy link
Copy Markdown
Contributor Author

Thanks for the PR! ccls tests on windows fail and then hang forever, I will review once tests run through in CI

test/solidlsp/cpp/test_cpp_basic.py::TestCppLanguageServer::test_find_symbol[cpp_ccls] FAILED [ 51%]

@MischaPanch

The windows CI installs ccls version 0.20220729 which is quote old and corresponds to LLVM-15. For whatever reason, that version crashes when launched in the test directory.

I didn't modify test_find_symbol and the crash still happens if I revert the changes to the associated extensions. That suggests the crashing behavior is caused just by ccls initializing in the directory with those files.

I didn't debug further since I don't see much point in trying to track down the error in the old version.

Building a recent ccls binary locally is an option but that would add both a lot of complexity to the configuration and a lot of build time overhead to the Windows test. You'd need to check out the llvm-project source locally, build Clang+LLVM first, then build ccls. Doesn't seem worth all the hassle.

Simplest fix seems to be just to disable the ccls test on Windows, so that's what I opted for.

The most recent binary available for ccls on Windows is 0.20220729 from
chocolatey. This is an old version corresponding to LLVM-15 and crashes
when parsing the test files.
The CPP_CCLS tests are disabled on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants