Files
swift-mirror/test/Interop/Cxx/class/inheritance/Inputs/fields.h
zoecarver 63c4758dad [cxx-interop] Add base classes as opaque fields when lowering in IRGen.
Much of IRGen is built around fields (example: enum packing/unpacking). This is a simpler/less bug-prone way to do it.
2022-09-20 20:20:46 -07:00

62 lines
1.0 KiB
C++

struct HasThreeFields {
int a = 1;
int b = 2;
int c = 3;
};
struct DerivedWithOneField : HasThreeFields {
int d = 4;
};
struct HasOneField {
int e = 5;
};
struct DerivedFromAll : HasOneField, DerivedWithOneField {
int f = 6;
};
struct OneField {
int value = 42;
};
struct DerivedFromOneField : OneField {};
// Non trivial types:
struct __attribute__((swift_attr("import_unsafe"))) NonTrivial {
NonTrivial() {}
~NonTrivial() {}
};
struct NonTrivialHasThreeFields : NonTrivial {
int a = 1;
int b = 2;
int c = 3;
};
struct NonTrivialDerivedWithOneField : NonTrivialHasThreeFields {
int d = 4;
};
struct __attribute__((swift_attr("import_unsafe"))) NonTrivialHasOneField {
NonTrivialHasOneField() {}
~NonTrivialHasOneField() {}
int e = 5;
};
struct __attribute__((swift_attr("import_unsafe"))) NonTrivialDerivedFromAll
: NonTrivialHasOneField,
NonTrivialDerivedWithOneField {
int f = 6;
};
// Templates:
template<class T>
struct ClassTemplate {
T value;
};
struct DerivedFromClassTemplate : ClassTemplate<int> {};