File tree Expand file tree Collapse file tree 3 files changed +57
-0
lines changed
Expand file tree Collapse file tree 3 files changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,8 @@ module StdString {
77 header "std-string.h"
88 requires cplusplus
99}
10+
11+ module Sample {
12+ header "sample.h"
13+ requires cplusplus
14+ }
Original file line number Diff line number Diff line change 1+ #ifndef TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SAMPLE_H
2+ #define TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SAMPLE_H
3+
4+ #include < string>
5+
6+ #define SWIFT_CXX_REF_IMMORTAL \
7+ __attribute__ ((swift_attr(" import_as_ref" ))) \
8+ __attribute__((swift_attr(" retain:immortal" ))) \
9+ __attribute__((swift_attr(" release:immortal" )))
10+
11+
12+ struct SWIFT_CXX_REF_IMMORTAL Counter {
13+ public:
14+ typedef int64_t Value;
15+
16+ void operator +=(Value delta);
17+ void operator ++() { *this += 1 ; }
18+
19+ private:
20+ std::string name;
21+ };
22+
23+ #endif // TEST_INTEROP_CXX_STDLIB_INPUTS_STD_SAMPLE_H
Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop)
2+ //
3+ // REQUIRES: executable_test
4+ //
5+ // Enable this everywhere once we have a solution for modularizing libstdc++: rdar://87654514
6+ // REQUIRES: OS=macosx
7+
8+ import StdlibUnittest
9+ import std. map
10+ import Sample
11+
12+ var SampleTestSuite = TestSuite ( " Sample " )
13+
14+ actor X {
15+ var counter : Counter
16+
17+ init ( counter: Counter ) {
18+ self . counter = counter
19+ }
20+
21+ func test( ) {
22+ self . counter = self . counter. successor ( ) // this is ++
23+ }
24+ }
25+
26+ SampleTestSuite . test ( " test " ) {
27+ }
28+
29+ runAllTests ( )
You can’t perform that action at this time.
0 commit comments