Skip to content

Conversation

Xazax-hun
Copy link
Contributor

@Xazax-hun Xazax-hun commented Jun 2, 2025

It looks like in the latest version of clang, it needs parameters to be named for the lifetimebound attribute to be applicable.

rdar://151918181

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Jun 2, 2025
@Xazax-hun Xazax-hun requested a review from hnrklssn as a code owner June 2, 2025 10:54
@Xazax-hun Xazax-hun requested a review from AnthonyLatsis June 2, 2025 10:55
It looks like in the latest version of clang needs parameters to be
named for the lifetimebound attribute to be applicable.

rdar://151918181
@Xazax-hun Xazax-hun force-pushed the gaborh/rebranch-test-fix branch from 6ca98dc to 64babf5 Compare June 2, 2025 12:01
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@j-hui j-hui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Xazax-hun Xazax-hun enabled auto-merge June 2, 2025 16:06
@Xazax-hun Xazax-hun merged commit db47bfd into main Jun 2, 2025
3 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/rebranch-test-fix branch June 2, 2025 16:38
AnthonyLatsis referenced this pull request Jul 9, 2025
The `stable/20250601` Clang apparently wants an attributed parameter to
have a name, and that the attributes follow the name:

```
/Users/alatsis/Desktop/rebranch/swift/test/Interop/C/swiftify-import/Inputs/counted-by-lifetimebound.h:7:76: error: 'lifetimebound' attribute only applies to parameters and implicit object parameters
int * __counted_by(len) simple(int len, int len2, int * __counted_by(len2) __lifetimebound p);
                                                                           ^
/Users/alatsis/Desktop/rebranch/swift/test/Interop/C/swiftify-import/Inputs/counted-by-lifetimebound.h:5:40: note: expanded from macro '__lifetimebound'
                                       ^
```

Also humor the compiler here:

```
 3 | #define __counted_by(x) __attribute__((__counted_by__(x)))
   |                                                       `- note: expanded from macro '__counted_by'
 4 | #define __counted_by_or_null(x) __attribute__((__counted_by_or_null__(x)))
 5 | #define __lifetimebound __attribute__((lifetimebound))
   :
22 | int * __counted_by(len) noncountedLifetime(int len, int * p __lifetimebound);
23 |
24 | int * __counted_by(13) _Nullable constant(int * _Nullable p __counted_by(13) __lifetimebound);
   |                                                                          `- error: combining '__counted_by' with non-zero count (which cannot be null) and '_Nullable'; did you mean '__counted_by_or_null' instead?
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants