-
Notifications
You must be signed in to change notification settings - Fork 699
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
Fix source order sorting. #2561
base: main
Are you sure you want to change the base?
Conversation
.header_contents("test.h", "int bar(const char* a);") | ||
.header_contents("test2.h", "float bar2(const char* b);") | ||
.header(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/headers/char.h")) |
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.
Note: This doesn't change anything, it simply reflects the order these are stored internally and eventually generated in.
5fe6d48
to
5c4cf4f
Compare
83f43a0
to
7f79e16
Compare
☔ The latest upstream changes (presumably ee980e1) made this pull request unmergeable. Please resolve the merge conflicts. |
e6a48a2
to
21d14df
Compare
7fe4d02
to
79ad27e
Compare
I refactored |
f287853
to
6553527
Compare
@pvdrz, I fixed the edge case you gave and added a test for it. |
I changed all file names from |
83cd42b
to
909d926
Compare
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.
I still think this is quite complicated for the benefit it brings fwiw... :/
@emilio, do you have an alternative? The status quo is simply incorrect in some cases. The only alternative I can see is to never generate constants for variable-like macros and only ever generate Rust macros instead. That way there is never a naming or ordering conflict. Note that this is also needed for the same reason for function-like macros and functions in #2369. |
@reitermarkus I'm confused, my understanding is that this sorting fixes some cases but breaks others, is that not the case? |
No, it only broke some cases due to the sorting being wrong/incomplete previously. Otherwise nothing should break, except for some auto-generated names having a different index. |
Confirmed that this works for one of my projects. |
☔ The latest upstream changes (presumably 5ff913a) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
I still think we should have some measurements of the overhead of the source order sorting, and turn it off by default if it's non-trivial.
Some of the refactoring like refactoring to use the clang::SourceLocation enum seems nice. Though that said, I'd rather keep the CXFile rather than reading the path and doing IO to absolutize it eagerly for most callers that don't need that...
This is a prerequisite for supporting complex macros (#2369), so it can't be optional. |
☔ The latest upstream changes (presumably 46c06e5) made this pull request unmergeable. Please resolve the merge conflicts. |
a1f48ff
to
a440b2b
Compare
☔ The latest upstream changes (presumably 285eb56) made this pull request unmergeable. Please resolve the merge conflicts. |
a440b2b
to
415470c
Compare
3e8bc61
to
c3536a5
Compare
☔ The latest upstream changes (presumably 3b5ce9c) made this pull request unmergeable. Please resolve the merge conflicts. |
c6d4a55
to
920211c
Compare
920211c
to
d1fb25b
Compare
☔ The latest upstream changes (presumably 93648e4) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixes #2556.
Previously, headers included with
-include
were not added to theincludes
map since they don't have a source file. This is now fixed.Also, some wrong match arms were removed/fixed.