-
Notifications
You must be signed in to change notification settings - Fork 593
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
bazel: add compile commands generator #24596
base: dev
Are you sure you want to change the base?
Conversation
This will make generating a compilation database much easier with pre-defined shortcuts.
Any details on why? This part seems like it will be an ongoing PITA? Is it a limitation of the underlying hedron thing? |
It's a bad interaction between our custom toolchain and hedron thing. I can fix it with post-processing the compilation_commands.json file, or forking the hedron thing... I'll look into fixing this later, this at least makes the json file a reasonable size (65MiB instead of 900MiB) and the stdlib headers works for me on Ubuntu Noble. |
The Hedron compile commands generator does this automatically, but it's better to be explicit, especially if we fork the tool.
This matches the root include we do in cmake and helps prevent jumping into symlinks from the sandbox due to all the virtual includes we have. This also prevents accidently adding `src/v` versions of various headers when auto adding headers using clangd. Additionally rewrite the args copy loop to be a single pass.
For toolchains llvm, the compiler is a shell script that just points to the actual directory containing the LLVM toolchain. clangd uses the directory of the first arg (assumed to be the real compiler, not a shell wrapper) for search paths of stdlib headers. If we remap that then clangd can find libc++ headers and we can then resolve the headers for our Bazel provided compiler 🎉
I pushed two commits @travisdowns:
With both of these changes I get a pretty darn good clangd experience IMO, and no red squiggles from my initial tests 🎉 |
We've now replaced this with our own homegrown solution that is much simpler and works much better for us.
Add seastar to the list of sources we support compiling, and also remove the list of tool compilation commands from the json file, those result in duplicates.
I will also update the Wiki if we like this and merge it 😄 |
Replace the hedron compilation database generator with a homegrown one. It's much simpler (the hedron thing is much more complex than what we want due to adding entries for headers as well as platforms/compilers we don't care about), and works much better for our setup.
The two main changes from the hedron thing is that we add
-iquote src/v
as the first header search path to make sure we resolve headers not in the sandbox, as well as remapping compiler paths to be something that works with clangd.Backports Required
Release Notes