Skip to content

Infer @PointerBounds macro from clang __counted_by parameters #77387

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

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

hnrklssn
Copy link
Contributor

@hnrklssn hnrklssn commented Nov 5, 2024

This results in an automatic wrapper function with safe pointer types
when the imported function has bounds attributes. This exercises similar
pathways as the recently added functionality for specifying macros from
swift_attr, and fixes some bugs related to macro source file management.

Includes some unmerged commits from #76969.

@DougGregor
Copy link
Member

With luck, #77580 should make the rebased version of this PR functional. I'm sure I missed something there, though.

@hnrklssn hnrklssn force-pushed the import-pointer-bounds branch from 313bb2b to be1db64 Compare November 16, 2024 01:35
@hnrklssn
Copy link
Contributor Author

With luck, #77580 should make the rebased version of this PR functional. I'm sure I missed something there, though.

Indeed, it works now! I'll start addressing the rest of the comments.

@hnrklssn hnrklssn force-pushed the import-pointer-bounds branch from 11a5d13 to ed1db71 Compare November 22, 2024 23:14
@DougGregor
Copy link
Member

What is the difference between a language feature and and a flag?

There's a bunch of machinery around language features and their lifecycle that we don't get from a one-off flag. Plus, flags need to be manually handled in the driver, whereas language features are already available.

@hnrklssn hnrklssn force-pushed the import-pointer-bounds branch from 8b67b03 to 77935a0 Compare December 5, 2024 22:53
@hnrklssn
Copy link
Contributor Author

hnrklssn commented Dec 5, 2024

@swift-ci please smoke test

@hnrklssn hnrklssn force-pushed the import-pointer-bounds branch from 77935a0 to 58c6cfc Compare December 5, 2024 23:02
@hnrklssn
Copy link
Contributor Author

hnrklssn commented Dec 5, 2024

@swift-ci please smoke test

This results in an automatic wrapper function with safe pointer types
when the imported function has bounds attributes. This exercises similar
pathways as the recently added functionality for specifying macros from
swift_attr. The new functionality is guarded by the experimental
language feature SafeInteropWrappers.

rdar://97942270
@hnrklssn hnrklssn force-pushed the import-pointer-bounds branch from 58c6cfc to f622a90 Compare December 9, 2024 18:57
@hnrklssn
Copy link
Contributor Author

hnrklssn commented Dec 9, 2024

@swift-ci please smoke test

@hnrklssn
Copy link
Contributor Author

hnrklssn commented Dec 9, 2024

After all the iterations of rebasing most of the intermediate commits didn't build anymore, and many contained a bunch of code that's removed in later commits, so I squashed them

@DougGregor
Copy link
Member

@swift-ci please smoke test Windows

@hnrklssn hnrklssn merged commit ec8ea94 into swiftlang:main Dec 11, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants