You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use clangd for working with C++20 modules. I have created working build system for C++20 modules (based on Gradle) but still no luck with any IDE to have fully functional code navigation and other services. The most close attempt seems to be with VSCode and clangd extension. But it still does not work due to clangd crashes.
Here is the sample project: https://github.com/vagran/cpp20-modules-sample-app. It should be built as per instructions and compilation database should be created. Then open it in VSCode. Workspace settings should be adjusted to point to Clang-13 binaries. Then open e.g. src/sample_app/main.cpp. clangd crashes after that. Last messages in the log:
I[12:32:01.062] --> $/progress
V[12:32:01.062] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"end"}}}
V[12:32:01.418] <<< {"id":4,"jsonrpc":"2.0","method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///home/artyom/projects/water-valve/source/src/sample_app/main.cpp"}}}
I[12:32:01.418] <-- textDocument/semanticTokens/full(4)
V[12:32:02.004] indexed preamble AST for /home/artyom/projects/water-valve/source/src/sample_app/main.cpp version 1:
symbol slab: 30687 symbols, 8767599 bytes
ref slab: 0 symbols, 0 refs, 128 bytes
relations slab: 1557 relations, 34840 bytes
V[12:32:02.115] Build dynamic index for header symbols with estimated memory usage of 19367076 bytes
V[12:32:02.123] Built preamble of size 313612 for file /home/artyom/projects/water-valve/source/src/sample_app/main.cpp version 1
I[12:32:02.123] --> workspace/semanticTokens/refresh(1)
V[12:32:02.123] >>> {"id":1,"jsonrpc":"2.0","method":"workspace/semanticTokens/refresh","params":null}
V[12:32:02.124] <<< {"id":1,"jsonrpc":"2.0","result":null}
I[12:32:02.124] <-- reply(1)
E[12:32:02.124] Failed to scan baseline of /home/artyom/projects/water-valve/source/src/sample_app/main.cpp: failed BeginSourceFile
Opening some small files from this project sometimes work.
It also would be nice to know if there is some workaround for this problem (e.g. some command line flag or compilation option for the project).
Note that clangd always adds -fretain-comments-from-system-headers which requires this flags also to be used when compiling project PCM files otherwise they cannot be loaded by clangd (which looks suspicious for me). BTW Clang-12 crashes when trying to compile project with this flag.
System information
Ubuntu 20.04.3 LTS
clangd version 13.0.0 (https://github.com/llvm/llvm-project/ 24c8eaec9467b2aaf70b0db33a4e4dd415139a50)
Features: linux
Platform: x86_64-unknown-linux-gnu
The text was updated successfully, but these errors were encountered:
HighCommander4
changed the title
Failed to scan baseline of ...: failed BeginSourceFile
[Modules] Failed to scan baseline of ...: failed BeginSourceFile
Feb 17, 2022
Sorry, clangd doesn't have any modules support.
Clang does, and clangd allows flags to be passed through to clang so some things may work or appear to work. But it would need significant design/implementation effort to get it into a usable state.
#1293 is the tracking bug for this, but nobody is currently working on it :-(
I am trying to use clangd for working with C++20 modules. I have created working build system for C++20 modules (based on Gradle) but still no luck with any IDE to have fully functional code navigation and other services. The most close attempt seems to be with VSCode and clangd extension. But it still does not work due to clangd crashes.
Here is the sample project: https://github.com/vagran/cpp20-modules-sample-app. It should be built as per instructions and compilation database should be created. Then open it in VSCode. Workspace settings should be adjusted to point to Clang-13 binaries. Then open e.g.
src/sample_app/main.cpp
. clangd crashes after that. Last messages in the log:Full log attached
Opening some small files from this project sometimes work.
It also would be nice to know if there is some workaround for this problem (e.g. some command line flag or compilation option for the project).
Note that clangd always adds
-fretain-comments-from-system-headers
which requires this flags also to be used when compiling project PCM files otherwise they cannot be loaded by clangd (which looks suspicious for me). BTW Clang-12 crashes when trying to compile project with this flag.System information
Ubuntu 20.04.3 LTS
The text was updated successfully, but these errors were encountered: