-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[cxx-interop] Import iterator dereference operators #59465
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
Conversation
e7dfa93
to
8e3e243
Compare
@swift-ci please smoke test |
@@ -8101,6 +8123,47 @@ SwiftDeclConverter::makeSubscript(FuncDecl *getter, FuncDecl *setter) { | |||
return subscript; | |||
} | |||
|
|||
VarDecl * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: ImportDecl.cpp
is way too big, I'll move the decl synthesis logic into a separate file in another PR.
ca4cb6a
to
4c38e37
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! One naming question: Is operator*()
known as an iterator dereference or just "dereference" ? Sounds like if a class has operator*()
its by def an Iterator
, just want to confirm thats the case
Hmm, I can't find the conventional name of this operator in C++ reference. |
Actually that's a good point @Huddie. Calling |
C++ iterator dereference operator is mapped to a Swift computed property called `pointee`. For example: ```cpp struct ConstIterator { // ... const int &operator*() const { /* ... */ } }; ``` is imported as ```swift struct ConstIterator { var pointee: Int32 { get } @available(*, unavailable, message: "use .pointee property") func __operatorStar() -> UnsafePointer<Int32> } ```
4c38e37
to
40a7e68
Compare
@swift-ci please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely, as per usual :)
C++ iterator dereference operator is mapped to a Swift computed property called
pointee
.For example:
is imported as