-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clangd] Forward --target to system include extraction #65824
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch!
There is some prior work on this which I've looked over and will summarize:
- This change was previously proposed in D138546
- During its review, we discovered that clangd would run a processing step on the compile command that sometimes adds a
-target
flag, inferred from the compiler name, to the command, before runningSystemIncludeExtractor
, and propagating-target
to the extraction command then caused an error if the compiler was a gcc (since gcc does not support-target
).- The patch was updated to fix this (by moving that processing step to happen after
SystemIncludeExtractor
). That change was since independently made and merged in D143436.
- The patch was updated to fix this (by moving that processing step to happen after
- We also discovered that
SystemIncludeExtractor
was failing to include arguments like--sysroot
in the key under which it caches its results (and adding-target
would have compounded that problem).- That has since been fixed in D146941.
Activity on D138546 has since stalled, but the next step would have been to rebase it on top of D143436 and D146941... which is basically what this patch does!
So, I think this patch should be good to go (modulo a small bug I commented on inline).
Some clang multilib configurations (such as the one currently used in the beta ARM LLVM toolchain) wind up only reporting the C++ include paths properly if they get passed the correct target.
dac47fe
to
e5f74b0
Compare
Thanks so much for carrying this forward, Nathan. |
🎉 |
Some clang multilib configurations (such as the one currently used in the [beta ARM LLVM toolchain](https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm)) wind up only reporting the C++ include paths properly if they get passed the correct target. This patch ensures the `--target` (or `-target`) arguments are correctly sent to the queried driver.
Some clang multilib configurations (such as the one currently used in the beta ARM LLVM toolchain) wind up only reporting the C++ include paths properly if they get passed the correct target. This patch ensures the
--target
(or-target
) arguments are correctly sent to the queried driver.