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

Provide more specifics about headers in compile_commands.json #213

Open
keith opened this issue Aug 28, 2024 · 1 comment
Open

Provide more specifics about headers in compile_commands.json #213

keith opened this issue Aug 28, 2024 · 1 comment

Comments

@keith
Copy link

keith commented Aug 28, 2024

While debugging the perf of this tool in our project I discovered this:

# Note: We need to apply commands to headers and sources.
# Why? clangd currently tries to infer commands for headers using files with similar paths. This often works really poorly for header-only libraries. The commands should instead have been inferred from the source files using those libraries... See https://github.com/clangd/clangd/issues/123 for more.
# When that issue is resolved, we can stop looking for headers and just return the single source file.

It sounds like there might be some poor devx cases being solved here, but it's not entirely clear to me if it's something we will be affected by or not. Do you remember some more specifics I could test on our project to determine if this time is worth spending? For reference >75% of the generating time is eliminated if we don't generate commands for headers, which is pretty tempting for us. Also we're migrating from cmake and the cmake generated file doesn't include headers either, so I'm definitely interested in the bazel specifics that cause this.

@rockwotj
Copy link

clangd/clangd#123

# Using ccls or another tool that doesn't want or need headers in compile_commands.json?
# exclude_headers = "all", # By default, we include entries for headers to support clangd, working around https://github.com/clangd/clangd/issues/123
# ^ excluding headers will speed up compile_commands.json generation *considerably* because we won't need to preprocess your code to figure out which headers you use.
# However, if you use clangd and are looking for speed, we strongly recommend you follow the instructions below instead, since clangd is going to regularly infer the wrong commands for headers and give you lots of annoyingly unnecessary red squigglies.

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