Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Modules] Failed to scan baseline of ...: failed BeginSourceFile #1021

Closed
vagran opened this issue Feb 16, 2022 · 1 comment
Closed

[Modules] Failed to scan baseline of ...: failed BeginSourceFile #1021

vagran opened this issue Feb 16, 2022 · 1 comment

Comments

@vagran
Copy link

vagran commented Feb 16, 2022

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

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

clangd version 13.0.0 (https://github.com/llvm/llvm-project/ 24c8eaec9467b2aaf70b0db33a4e4dd415139a50)
Features: linux
Platform: x86_64-unknown-linux-gnu
@HighCommander4 HighCommander4 changed the title Failed to scan baseline of ...: failed BeginSourceFile [Modules] Failed to scan baseline of ...: failed BeginSourceFile Feb 17, 2022
@sam-mccall
Copy link
Member

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 :-(

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

No branches or pull requests

2 participants