fix: support header_contents() with clang_macro_fallback#3353
Conversation
a499369 to
e9fcc7c
Compare
| .iter() | ||
| .filter_map(|(_, contents, original_name)| { | ||
| // Sanitize the user-provided name so it always | ||
| // resolves under build_dir: |
There was a problem hiding this comment.
I'm confused, why is this needed? Is it intended to be some sort of path traversal escape prevention thing?
I'd rather avoid this, I don't think there's any use case for relative directories in header_contents(), tbh. In any case, this is just eating the FS errors etc, which seems bad. Let's either propagate it or crash?
|
I'd split the |
|
Any news on this? I opened #3381 but I think I just had to update my dependency's binding generation to have explicit target arguments for |
e9fcc7c to
50cf047
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
clang_macro_fallback with header_contents() and implicit --target|
Thanks, I split this up and rewrote this branch to be #3351-only. The implicit |
50cf047 to
36e96d6
Compare
36e96d6 to
6e57d30
Compare
Summary
Fixes #3351.
clang_macro_fallback()builds a fallback translation unit from the input headers. When the user only provides input throughheader_contents(),input_headersis empty, so fallback setup returnsNoneand macros that need fallback evaluation are silently skipped.Keep
input_header_contentsavailable to the generation context, materialize those virtual headers as temporary fallback headers while the PCH is alive, and include them in the fallback PCH setup.The implicit
--targetfix from the original version of this PR was split out to #3382.