Extend `counted_by` support beyond struct fields
Currently, counted_by and related attributes are only supported in struct fields. This issue tracks extending support to:
- Function parameters
- Return types
- Global variables
- Local variables
For typedef, support would only make sense if the attribute argument is a constexpr or constant literal.
Hello! I plan to work on this issue. I have been reading the RFC and the Bounds Safety documentation to understand the intended semantics for the past couple of days.
To keep the work reviewable, I am planning on starting with function parameter support only and send an initial PR as Part of #167365. After, I plan follow-up with PRs for locals, globals, typedef, and then return types.
If there is any preferred order or there are any constraints I should be following for parameter semantics then please let me know
Hello, I have been looking through the codebase over the past couple of days to add support for global and local variables, and I'm planning on opening a PR soon for global variables.
@Vincent-Lin-UF @Holo-xy Hi thanks for your interest.
This issue depends on a large patch for proper late parsing of type attributes: github.com/llvm/llvm-project/pull/179612. Many features are blocked on this one.
As a follow-up, I'll need to backport it to the swiftlang repo. This will require refactoring to match the upstream PR and verify it works in the full bounds-safety context, since swiftlang took a different approach.
I'd prefer we start preparing other patches after this one; otherwise, we'll have to redo much of the work.
Once that's complete, I expect we can parallelize some of the upstream work.
Also, please let me know if you are interested in trying to back port github.com/llvm/llvm-project/pull/179612 to the swiftlang repo. We can discuss it separately.
Also, please let me know if you are interested in trying to back port github.com//pull/179612 to the swiftlang repo. We can discuss it separately.
Yes, I’m interested in backporting it.
Also, please let me know if you are interested in trying to back port github.com//pull/179612 to the swiftlang repo. We can discuss it separately.
Thanks for the context @rapidsna ! I’ll pause work on the counted_by extensions until #179612 is merged and backported.
I’m also interested in helping with the swiftlang backport. If you share the target branch, I can start preparing the backport and tests.
Hey, I'd also like to help with the backporting to swiftlang repo.
Thanks everyone for your interest! After further consideration, back-porting #179612 would be too complex for a starter task, as it requires familiarity with -fbounds-safety functionality that hasn't yet been upstreamed.
If you're still looking to contribute, there are other back-porting/refactoring tasks that would make great starter issues:
github.com/swiftlang/llvm-project/issues/12435 github.com/swiftlang/llvm-project/issues/12436
Please let me know if you have any trouble assigning yourself to the issues or opening a PR!
Thanks for the guidance @rapidsna ! That makes sense. I will take a look at both issues and pick one to work on. I will comment on the issue I choose so it is clear who is taking what