[clangd] support the zig c++ compiler wrapper #100759
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using
zig c++
for cross-compilingclangd
removes the zig command (c++
/cc
) from the command line. Because of this the system include extraction fails. This change detects that the driver executable is namedzig
and addscc
orc++
back into the command line.I don't think there is infrastructure to test this (since it would involve executing the
zig
executable), so I did not add any tests. Screenshot of the feature working on Visual Studio Code on Windows:Trivial example project that sets up the cross compilation with CMake and generates
compile_commands.json
: https://github.com/mrexodia/zig-cross. You also need to use--query-driver=**/zig.exe
.