Skip to content

Commit 7fef4b6

Browse files
committed
test different
1 parent 8b7b134 commit 7fef4b6

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

test/Interop/Cxx/class/Inputs/copy-move-assignment.h

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#pragma once
22

3+
#define NOOPT __attribute__((optnone)) __attribute__((noinline))
4+
35
struct InstanceBalanceCounter {
46
static inline int &theCounterValue() {
57
static int counterValue = 0;
@@ -9,36 +11,40 @@ struct InstanceBalanceCounter {
911
return theCounterValue();
1012
}
1113

12-
__attribute__((optnone))
14+
NOOPT
1315
InstanceBalanceCounter() {
1416
++theCounterValue();
1517
}
16-
__attribute__((optnone))
18+
NOOPT
1719
InstanceBalanceCounter(const InstanceBalanceCounter &) {
1820
++theCounterValue();
1921
}
20-
__attribute__((optnone))
22+
NOOPT
2123
InstanceBalanceCounter(InstanceBalanceCounter &&) {
2224
++theCounterValue();
2325
}
24-
__attribute__((optnone))
26+
NOOPT
2527
~InstanceBalanceCounter() {
2628
--theCounterValue();
2729
}
2830
};
2931

30-
__attribute__((optnone))
32+
#ifdef EXTERN_FUNC
33+
extern void someFunc();
34+
#else
35+
NOOPT
3136
inline void someFunc() {}
37+
#endif
3238

3339
struct NonTrivialCopyAssign {
34-
__attribute__((optnone))
40+
NOOPT
3541
NonTrivialCopyAssign(): copyAssignCounter(0) {}
36-
__attribute__((optnone))
42+
NOOPT
3743
~NonTrivialCopyAssign() {
3844
someFunc();
3945
}
4046

41-
__attribute__((optnone))
47+
NOOPT
4248
NonTrivialCopyAssign &operator =(const NonTrivialCopyAssign &) {
4349
++copyAssignCounter;
4450
return *this;
@@ -49,16 +55,16 @@ struct NonTrivialCopyAssign {
4955
};
5056

5157
struct NonTrivialMoveAssign {
52-
__attribute__((optnone))
58+
NOOPT
5359
NonTrivialMoveAssign(): moveAssignCounter(0) {}
54-
__attribute__((optnone))
60+
NOOPT
5561
NonTrivialMoveAssign(const NonTrivialMoveAssign &) = default;
56-
__attribute__((optnone))
62+
NOOPT
5763
~NonTrivialMoveAssign() {
5864
someFunc();
5965
}
6066

61-
__attribute__((optnone))
67+
NOOPT
6268
NonTrivialMoveAssign &operator =(NonTrivialMoveAssign &&) {
6369
++moveAssignCounter;
6470
return *this;
@@ -69,27 +75,27 @@ struct NonTrivialMoveAssign {
6975
};
7076

7177
struct NonTrivialCopyAndCopyMoveAssign {
72-
__attribute__((optnone))
78+
NOOPT
7379
NonTrivialCopyAndCopyMoveAssign(): assignCounter(0) {}
74-
__attribute__((optnone))
80+
NOOPT
7581
NonTrivialCopyAndCopyMoveAssign(const NonTrivialCopyAndCopyMoveAssign &other) : assignCounter(other.assignCounter), instanceBalancer(other.instanceBalancer) {
7682
someFunc();
7783
}
78-
__attribute__((optnone))
84+
NOOPT
7985
NonTrivialCopyAndCopyMoveAssign( NonTrivialCopyAndCopyMoveAssign &&other) : assignCounter(other.assignCounter), instanceBalancer(other.instanceBalancer) {
8086
someFunc();
8187
}
82-
__attribute__((optnone))
88+
NOOPT
8389
~NonTrivialCopyAndCopyMoveAssign() {
8490
someFunc();
8591
}
8692

87-
__attribute__((optnone))
93+
NOOPT
8894
NonTrivialCopyAndCopyMoveAssign &operator =(const NonTrivialCopyAndCopyMoveAssign &) {
8995
++assignCounter;
9096
return *this;
9197
}
92-
__attribute__((optnone))
98+
NOOPT
9399
NonTrivialCopyAndCopyMoveAssign &operator =(NonTrivialCopyAndCopyMoveAssign &&) {
94100
++assignCounter;
95101
return *this;

test/Interop/Cxx/class/copy-move-assignment-irgen.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs -enable-experimental-cxx-interop -emit-ir %s -Xcc -fignore-exceptions -O | %FileCheck %s
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs -enable-experimental-cxx-interop -emit-ir %s -Xcc -fignore-exceptions -O -Xcc -DEXTERN_FUNC > %t
2+
// RUN: not cat %t
3+
4+
// RUN: cat %t | %FileCheck %s
25

36
import CopyMoveAssignment
47

0 commit comments

Comments
 (0)