Skip to content

Commit c88a157

Browse files
authored
Merge pull request #59877 from apple/egorzhdan/cxx-move-only-test
[cxx-interop] Update tests for foreign reference types
2 parents 295ec46 + 5aea919 commit c88a157

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

test/Interop/Cxx/foreign-reference/Inputs/move-only.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_MOVE_ONLY_H
33

44
#include <stdlib.h>
5+
#if defined(_WIN32)
6+
inline void *operator new(size_t, void *p) { return p; }
7+
#else
8+
#include <new>
9+
#endif
510

611
#include "visibility.h"
712

8-
inline void *operator new(size_t, void *p) { return p; }
9-
1013
template <class _Tp>
1114
_Tp &&move(_Tp &t) {
1215
return static_cast<_Tp &&>(t);

test/Interop/Cxx/foreign-reference/Inputs/nullable.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_NULLABLE_H
33

44
#include <stdlib.h>
5-
5+
#if defined(_WIN32)
66
inline void *operator new(size_t, void *p) { return p; }
7+
#else
8+
#include <new>
9+
#endif
710

811
struct __attribute__((swift_attr("import_as_ref"))) Empty {
912
int test() const { return 42; }

test/Interop/Cxx/foreign-reference/Inputs/pod.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_POD_H
33

44
#include <stdlib.h>
5+
#if defined(_WIN32)
6+
inline void *operator new(size_t, void *p) { return p; }
7+
#else
8+
#include <new>
9+
#endif
510

611
#include "visibility.h"
712

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

11-
inline void *operator new(size_t, void *p) { return p; }
12-
1316
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
1417

1518
struct __attribute__((swift_attr("import_as_ref"))) Empty {

test/Interop/Cxx/foreign-reference/Inputs/singleton.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_SINGLETON_H
33

44
#include <stdlib.h>
5+
#if defined(_WIN32)
6+
inline void *operator new(size_t, void *p) { return p; }
7+
#else
8+
#include <new>
9+
#endif
510

611
#include "visibility.h"
712

8-
inline void *operator new(size_t, void *p) { return p; }
9-
1013
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
1114

1215
struct __attribute__((swift_attr("import_as_ref"))) DeletedDtor {

test/Interop/Cxx/foreign-reference/Inputs/witness-table.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
#define TEST_INTEROP_CXX_FOREIGN_REFERENCE_INPUTS_WITNESS_TABLE_H
33

44
#include <stdlib.h>
5-
5+
#if defined(_WIN32)
66
inline void *operator new(size_t, void *p) { return p; }
7+
#else
8+
#include <new>
9+
#endif
710

811
struct __attribute__((swift_attr("import_as_ref"))) CxxLinkedList {
912
int value = 3;

0 commit comments

Comments
 (0)