Skip to content

[cxx-interop] Update tests for foreign reference types #59877

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 1 commit into from
Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/Interop/Cxx/foreign-reference/Inputs/move-only.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_MOVE_ONLY_H

#include <stdlib.h>
#if defined(_WIN32)
inline void *operator new(size_t, void *p) { return p; }
#else
#include <new>
#endif

#include "visibility.h"

inline void *operator new(size_t, void *p) { return p; }

template <class _Tp>
_Tp &&move(_Tp &t) {
return static_cast<_Tp &&>(t);
Expand Down
5 changes: 4 additions & 1 deletion test/Interop/Cxx/foreign-reference/Inputs/nullable.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_NULLABLE_H

#include <stdlib.h>

#if defined(_WIN32)
inline void *operator new(size_t, void *p) { return p; }
#else
#include <new>
#endif

struct __attribute__((swift_attr("import_as_ref"))) Empty {
int test() const { return 42; }
Expand Down
7 changes: 5 additions & 2 deletions test/Interop/Cxx/foreign-reference/Inputs/pod.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_POD_H

#include <stdlib.h>
#if defined(_WIN32)
inline void *operator new(size_t, void *p) { return p; }
#else
#include <new>
#endif

#include "visibility.h"

template <class From, class To>
To __swift_interopStaticCast(From from) { return from; }

inline void *operator new(size_t, void *p) { return p; }

SWIFT_BEGIN_NULLABILITY_ANNOTATIONS

struct __attribute__((swift_attr("import_as_ref"))) Empty {
Expand Down
7 changes: 5 additions & 2 deletions test/Interop/Cxx/foreign-reference/Inputs/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_SINGLETON_H

#include <stdlib.h>
#if defined(_WIN32)
inline void *operator new(size_t, void *p) { return p; }
#else
#include <new>
#endif

#include "visibility.h"

inline void *operator new(size_t, void *p) { return p; }

SWIFT_BEGIN_NULLABILITY_ANNOTATIONS

struct __attribute__((swift_attr("import_as_ref"))) DeletedDtor {
Expand Down
5 changes: 4 additions & 1 deletion test/Interop/Cxx/foreign-reference/Inputs/witness-table.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_WITNESS_TABLE_H

#include <stdlib.h>

#if defined(_WIN32)
inline void *operator new(size_t, void *p) { return p; }
#else
#include <new>
#endif

struct __attribute__((swift_attr("import_as_ref"))) CxxLinkedList {
int value = 3;
Expand Down