Skip to content

🍒[APINotes] Support annotating C++ methods #9014

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 2 commits into from
Jul 26, 2024

Conversation

egorzhdan
Copy link

This adds support for adding Clang attributes to C++ methods declared
within C++ records by using API Notes.

For instance:

Tags:
- Name: IntWrapper
  Methods:
  - Name: getIncremented
    Availability: none

This is the first instance of something within a C++ record being
annotated with API Notes, so it adds the necessary infra to make a C++
record an "API Notes context".

Notably this does not add support for nested C++ tags. That will be
added in a follow-up patch.

rdar://131387880
(cherry picked from commit 8a79dc7)

We were storing extraneous data for certain Objective-C/C++ entities.
Specifically, for declarations that can be nested in another context
(such as functions) we were storing the kind of the parent context in
addition to its ID. The ID is always sufficient.

This removes the logically incorrect usages of `ContextTableKey` that
don't actually describe a context, but rather describe a single
declaration. This introduces `SingleDeclTableKey` to store that kind of
entities in a more compact and reasonable way.

(cherry picked from commit c5f402f)
This adds support for adding Clang attributes to C++ methods declared
within C++ records by using API Notes.

For instance:
```
Tags:
- Name: IntWrapper
  Methods:
  - Name: getIncremented
    Availability: none
```

This is the first instance of something within a C++ record being
annotated with API Notes, so it adds the necessary infra to make a C++
record an "API Notes context".

Notably this does not add support for nested C++ tags. That will be
added in a follow-up patch.

rdar://131387880
(cherry picked from commit 8a79dc7)
@egorzhdan egorzhdan requested a review from compnerd July 26, 2024 15:51
@egorzhdan
Copy link
Author

@swift-ci please test llvm

@egorzhdan egorzhdan merged commit 8ea33e8 into stable/20240625 Jul 26, 2024
0 of 2 checks passed
@egorzhdan egorzhdan deleted the egorzhdan/20240625-apinotes-methods branch July 26, 2024 17:25
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.

2 participants