-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Classify C++ structs as loadable or address-only #31707
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
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
be4fe72
Classify C++ structs as loadable or address-only
MForster e6f5991
Update test/Interop/Cxx/class/Inputs/loadable-types.h
MForster 233b67c
Update test/Interop/Cxx/class/Inputs/loadable-types.h
MForster 1868070
Update test/Interop/Cxx/class/loadable-types-silgen.swift
MForster 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_LOADABLE_TYPES_H | ||
#define TEST_INTEROP_CXX_CLASS_INPUTS_LOADABLE_TYPES_H | ||
|
||
struct EmptyStruct {}; | ||
|
||
// Tests for individual special members | ||
|
||
struct StructWithDefaultConstructor { | ||
StructWithDefaultConstructor() {} | ||
}; | ||
|
||
struct StructWithAdditionalConstructor { | ||
StructWithAdditionalConstructor() {} | ||
StructWithAdditionalConstructor(int parameter) {} | ||
}; | ||
|
||
struct StructWithCopyConstructor { | ||
StructWithCopyConstructor(const StructWithCopyConstructor &) {} | ||
}; | ||
|
||
struct StructWithInheritedCopyConstructor : StructWithCopyConstructor {}; | ||
|
||
struct StructWithSubobjectCopyConstructor { | ||
StructWithCopyConstructor subobject; | ||
}; | ||
|
||
struct StructWithDefaultedCopyConstructor { | ||
StructWithDefaultedCopyConstructor( | ||
const StructWithDefaultedCopyConstructor &) = default; | ||
}; | ||
|
||
struct StructWithInheritedDefaultedCopyConstructor | ||
: StructWithDefaultedCopyConstructor {}; | ||
|
||
struct StructWithSubobjectDefaultedCopyConstructor { | ||
StructWithDefaultedCopyConstructor subobject; | ||
}; | ||
|
||
struct StructWithPrivateDefaultedCopyConstructor { | ||
private: | ||
StructWithPrivateDefaultedCopyConstructor( | ||
const StructWithPrivateDefaultedCopyConstructor &) = default; | ||
}; | ||
|
||
struct StructWithInheritedPrivateDefaultedCopyConstructor | ||
: StructWithPrivateDefaultedCopyConstructor {}; | ||
|
||
struct StructWithSubobjectPrivateDefaultedCopyConstructor { | ||
StructWithPrivateDefaultedCopyConstructor subobject; | ||
}; | ||
|
||
struct StructWithMoveConstructor { | ||
StructWithMoveConstructor(StructWithMoveConstructor &&) {} | ||
}; | ||
|
||
struct StructWithInheritedMoveConstructor : StructWithMoveConstructor {}; | ||
|
||
struct StructWithSubobjectMoveConstructor { | ||
StructWithMoveConstructor subobject; | ||
}; | ||
|
||
struct StructWithCopyAssignment { | ||
StructWithCopyAssignment &operator=(const StructWithCopyAssignment &) {} | ||
}; | ||
|
||
struct StructWithInheritedCopyAssignment : StructWithCopyAssignment {}; | ||
|
||
struct StructWithSubobjectCopyAssignment { | ||
StructWithCopyAssignment subobject; | ||
}; | ||
|
||
struct StructWithMoveAssignment { | ||
StructWithMoveAssignment &operator=(StructWithMoveAssignment &&) {} | ||
}; | ||
|
||
struct StructWithInheritedMoveAssignment : StructWithMoveAssignment {}; | ||
|
||
struct StructWithSubobjectMoveAssignment { | ||
StructWithMoveAssignment subobject; | ||
}; | ||
|
||
struct StructWithDestructor { | ||
~StructWithDestructor(){} | ||
}; | ||
|
||
struct StructWithInheritedDestructor : StructWithDestructor {}; | ||
|
||
struct StructWithSubobjectDestructor { | ||
StructWithDestructor subobject; | ||
}; | ||
gribozavr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
struct StructWithDefaultedDestructor { | ||
~StructWithDefaultedDestructor() = default; | ||
}; | ||
|
||
struct StructWithInheritedDefaultedDestructor : StructWithDefaultedDestructor { | ||
}; | ||
|
||
struct StructWithSubobjectDefaultedDestructor { | ||
StructWithDefaultedDestructor subobject; | ||
}; | ||
|
||
struct StructWithPrivateDefaultedDestructor { | ||
private: | ||
~StructWithPrivateDefaultedDestructor() = default; | ||
}; | ||
|
||
struct StructWithInheritedPrivateDefaultedDestructor | ||
: StructWithPrivateDefaultedDestructor {}; | ||
|
||
struct StructWithSubobjectPrivateDefaultedDestructor { | ||
StructWithPrivateDefaultedDestructor subobject; | ||
}; | ||
|
||
// Tests for common sets of special member functions. | ||
|
||
struct StructTriviallyCopyableMovable { | ||
StructTriviallyCopyableMovable(const StructTriviallyCopyableMovable &) = | ||
default; | ||
StructTriviallyCopyableMovable(StructTriviallyCopyableMovable &&) = default; | ||
StructTriviallyCopyableMovable & | ||
operator=(const StructTriviallyCopyableMovable &) = default; | ||
StructTriviallyCopyableMovable & | ||
operator=(StructTriviallyCopyableMovable &&) = default; | ||
~StructTriviallyCopyableMovable() = default; | ||
}; | ||
|
||
struct StructNonCopyableTriviallyMovable { | ||
StructNonCopyableTriviallyMovable(const StructNonCopyableTriviallyMovable &) = | ||
delete; | ||
StructNonCopyableTriviallyMovable(StructNonCopyableTriviallyMovable &&) = | ||
default; | ||
StructNonCopyableTriviallyMovable & | ||
operator=(const StructNonCopyableTriviallyMovable &) = delete; | ||
StructNonCopyableTriviallyMovable & | ||
operator=(StructNonCopyableTriviallyMovable &&) = default; | ||
~StructNonCopyableTriviallyMovable() = default; | ||
}; | ||
|
||
struct StructNonCopyableNonMovable { | ||
StructNonCopyableNonMovable(const StructNonCopyableNonMovable &) = delete; | ||
StructNonCopyableNonMovable(StructNonCopyableNonMovable &&) = default; | ||
StructNonCopyableNonMovable & | ||
operator=(const StructNonCopyableNonMovable &) = delete; | ||
StructNonCopyableNonMovable & | ||
operator=(StructNonCopyableNonMovable &&) = default; | ||
~StructNonCopyableNonMovable() = default; | ||
}; | ||
|
||
struct StructDeletedDestructor { | ||
StructDeletedDestructor(const StructDeletedDestructor &) = default; | ||
StructDeletedDestructor(StructDeletedDestructor &&) = default; | ||
StructDeletedDestructor &operator=(const StructDeletedDestructor &) = default; | ||
StructDeletedDestructor &operator=(StructDeletedDestructor &&) = default; | ||
~StructDeletedDestructor() = delete; | ||
}; | ||
|
||
#endif |
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
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.