-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[🍒][cxx-interop] Only mark projections of self-contained types as unsafe. #67413
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
zoecarver
merged 11 commits into
swiftlang:release/5.9
from
zoecarver:pick-only-methods-on-self-contained-types-are-unsafe
Jul 21, 2023
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e11a14b
[cxx-interop] Only mark projections of self-contained types as unsafe.
zoecarver 1e9980a
[cxx-interop] Fix a bug with explicit, nested, self-contained types (…
zoecarver 3e8867f
[cxx-interop] Add `NewCxxMethodSafetyHeuristics` feature and guard sw…
zoecarver 1c8486d
[cxx-interop] Add legacy implementation of is-safe-use-of-cxx-method.
zoecarver 094b9ca
[cxx-interop] ExpirementalFeature -> LanguageFeature.
zoecarver a59db73
[nfc][cxx-interop] Fix a few tests.
zoecarver 6eeb284
[cxx-interop] Mark *all* iterators as unsafe; update tests accordingl…
zoecarver 757df55
[cxx-interop][nfc] Fix last straggling test.
zoecarver 1f0d6e8
[cxx-interop] always mark begin and end methods as unsafe (to help au…
zoecarver 65dc0d3
[cxx-interop][nfc] post-rebase fallout for a few tests.
zoecarver 30c929f
[cxx-interop][nfc] Fix rebase fallout; fix typo.
zoecarver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ module Test { | |
struct Ptr { int *p; }; | ||
|
||
struct X { | ||
X(const X&); | ||
|
||
int *test() { } | ||
Ptr other() { } | ||
}; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#ifndef TEST_INTEROP_CXX_CLASS_METHOD_UNSAFE_PROJECTIONS_H | ||
#define TEST_INTEROP_CXX_CLASS_METHOD_UNSAFE_PROJECTIONS_H | ||
|
||
#include <string> | ||
|
||
struct NestedSelfContained; | ||
struct Empty; | ||
struct SelfContained; | ||
struct ExplicitSelfContained; | ||
struct NestedExplicitSelfContained; | ||
|
||
struct View { | ||
void *ptr; | ||
|
||
void *data() const; | ||
void *empty() const; | ||
std::string name() const; | ||
NestedSelfContained nested() const; | ||
ExplicitSelfContained explicitSelfContained() const; | ||
NestedExplicitSelfContained explicitNested() const; | ||
}; | ||
|
||
struct SelfContained { | ||
void *ptr; | ||
SelfContained(const SelfContained&); | ||
|
||
std::string name() const; | ||
SelfContained selfContained() const; | ||
NestedSelfContained nested() const; | ||
Empty empty() const; | ||
int value() const; | ||
View view() const; | ||
int *pointer() const; | ||
ExplicitSelfContained explicitSelfContained() const; | ||
NestedExplicitSelfContained explicitNested() const; | ||
}; | ||
|
||
struct NestedSelfContained { | ||
SelfContained member; | ||
|
||
std::string name() const; | ||
SelfContained selfContained() const; | ||
NestedSelfContained nested() const; | ||
Empty empty() const; | ||
int value() const; | ||
View view() const; | ||
int *pointer() const; | ||
ExplicitSelfContained explicitSelfContained() const; | ||
NestedExplicitSelfContained explicitNested() const; | ||
}; | ||
|
||
struct InheritSelfContained: SelfContained { | ||
std::string name() const; | ||
SelfContained selfContained() const; | ||
NestedSelfContained nested() const; | ||
Empty empty() const; | ||
int value() const; | ||
View view() const; | ||
int *pointer() const; | ||
}; | ||
|
||
struct __attribute__((swift_attr("import_owned"))) ExplicitSelfContained { | ||
void *ptr; | ||
|
||
void *pointer() const; | ||
View view() const; | ||
NestedSelfContained nested() const; | ||
}; | ||
|
||
struct NestedExplicitSelfContained { | ||
ExplicitSelfContained m; | ||
|
||
SelfContained selfContained() const; | ||
NestedSelfContained nested() const; | ||
int value() const; | ||
View view() const; | ||
int *pointer() const; | ||
}; | ||
|
||
struct Empty { | ||
Empty empty() const; | ||
void *pointer() const; | ||
SelfContained selfContained() const; | ||
}; | ||
|
||
struct IntPair { | ||
int a; int b; | ||
|
||
int first() const; | ||
void *pointer() const; | ||
SelfContained selfContained() const; | ||
}; | ||
|
||
#endif // TEST_INTEROP_CXX_CLASS_METHOD_UNSAFE_PROJECTIONS_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
@zoecarver both #if and #else branches seems to have the same code? Did you mean to say
_bridged.__bytes_beginUnsafe()
in the #else case?