-
Notifications
You must be signed in to change notification settings - Fork 342
[BoundsSafety][APINotes] Add support for bounds safety annotations #10728
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
[BoundsSafety][APINotes] Add support for bounds safety annotations #10728
Conversation
@swift-ci test |
@swift-ci test llvm |
I'm going to assume these failures are unrelated.
|
Ah the tests fail on Linux:
|
I probably need to cherry-pick.
|
This cherry-picks ``` commit e5e04cd Author: Henrik G. Olsson <[email protected]> Date: Mon Feb 3 10:25:30 2025 -0800 Revert "Revert "[APINotes] Add support for bounds safety annotations"" This reverts commit 7cbd1e7. ``` from the `swift/release/6.2` branch (landed in swiftlang#9942). Conflicts: clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/APINotes/APINotesFormat.h Below is the original commit message. rdar://151820159 --- [APINotes] Add support for bounds safety annotations This adds support for annotating function parameters with __counted_by, __sized_by, __counted_by_or_null, __sized_by_or_null, and __ended_by, using API notes. The main content of handlePtrCountedByEndedByAttr is extracted to applyPtrCountedByEndedByAttr and decoupled from ParsedAttr. The helper function ParseBoundsAttributeArgFromString is added to make it possible to parse count expressions from SemaAPINotes. The current implementation of __terminated_by/__null_terminated makes it harder to extract from the iterative type processing, but since it doesn't require any extra context to parse the attribute, it can be applied using the normal Type override instead. rdar://139830881
This was originally landed in `stable/20240723` (swiftlang#9901) and this patch cherry-picks it to `main`. rdar://143701027 (cherry picked from commit 013acca)
These test cases use clang modules. TypeCoupledDeclRefInfo serialization/deserialization is currently broken on Linux, so disable these tests until it's been resolved. This a cherry-pick of a change that was originally landed in swiftlang#10009 origianlly. rdar://144275431 (cherry picked from commit 9fbb19c)
3c968ed
to
6936f54
Compare
@swift-ci test llvm |
* Unguard tests that were crashing on Linux * Fix TypeCoupledDeclRefInfo (de-)serialization bug There were two issues here: 1) Deserialization relied on a specific argument evaluation order, which is unspecified. 2) IsMember was not (de-)serialized. This problem was originally tracked by rdar://144275431 and rdar://151820159 tracks landing the missing cherry-pick to the `next` branch. (cherry picked from commit aeb1272)
@swift-ci test llvm |
Adding this missing change:
|
Linux has these tests failures.
I'm going to assume these are unrelated. |
I'm going to land now to unblock myself from landing more changes. The macOS tests pass for me locally so that's fairly strong signal that this PR is ok. |
This cherry-picks e5e04cd (#9942) and 013acca (#9901) which were landed in
stable/20240723
but not themain
branch.