File tree Expand file tree Collapse file tree 4 files changed +61
-3
lines changed
test/Interop/SwiftToCxx/stdlib Expand file tree Collapse file tree 4 files changed +61
-3
lines changed Original file line number Diff line number Diff line change @@ -2513,6 +2513,8 @@ static bool hasExposeAttr(const ValueDecl *VD) {
2513
2513
if (isa<NominalTypeDecl>(VD) && VD->getModuleContext ()->isStdlibModule ()) {
2514
2514
if (VD == VD->getASTContext ().getStringDecl ())
2515
2515
return true ;
2516
+ if (VD == VD->getASTContext ().getArrayDecl ())
2517
+ return true ;
2516
2518
return false ;
2517
2519
}
2518
2520
if (VD->getAttrs ().hasAttribute <ExposeAttr>())
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: split-file %s %t
3
+
4
+ // RUN: %target-swift-frontend -parse-as-library %platform-module-dir/Swift.swiftmodule/%module-target-triple.swiftinterface -enable-library-evolution -disable-objc-attr-requires-foundation-module -typecheck -module-name Swift -parse-stdlib -enable-experimental-cxx-interop -emit-clang-header-path %t/Swift.h -experimental-skip-all-function-bodies
5
+
6
+ // RUN: %target-swift-frontend -typecheck %t/use-array.swift -typecheck -module-name UseArray -enable-experimental-cxx-interop -emit-clang-header-path %t/UseArray.h
7
+
8
+ // RUN: %target-interop-build-clangxx -fno-exceptions -std=gnu++20 -c %t/array-execution.cpp -I %t -o %t/swift-stdlib-execution.o
9
+ // RUN: %target-build-swift %t/use-array.swift -o %t/swift-stdlib-execution -Xlinker %t/swift-stdlib-execution.o -module-name UseArray -Xfrontend -entry-point-function-name -Xfrontend swiftMain
10
+ // RUN: %target-codesign %t/swift-stdlib-execution
11
+ // RUN: %target-run %t/swift-stdlib-execution | %FileCheck %s
12
+
13
+ // REQUIRES: executable_test
14
+
15
+ // --- use-array.swift
16
+ @_expose(Cxx)
17
+ public func createArray (_ val: CInt) -> [CInt] {
18
+ return [val, val]
19
+ }
20
+
21
+ @_expose(Cxx)
22
+ public func passthroughArray (_ val: [CInt]) -> Array<CInt> {
23
+ return val
24
+ }
25
+
26
+ @_expose(Cxx)
27
+ public func printArray (_ val: Array<CInt>) {
28
+ print (val)
29
+ }
30
+
31
+ // --- array-execution.cpp
32
+
33
+ #include < cassert>
34
+ #include " Swift.h"
35
+ #include " UseArray.h"
36
+
37
+ int main () {
38
+ using namespace Swift ;
39
+
40
+ {
41
+ Array<int > val = UseArray::createArray (2 );
42
+ UseArray::printArray (UseArray::passthroughArray (val));
43
+ }
44
+ // CHECK: [2, 2]
45
+ return 0 ;
46
+ }
Original file line number Diff line number Diff line change 5
5
6
6
// RUN: %target-swift-frontend -typecheck %t/create_string.swift -typecheck -module-name StringCreator -enable-experimental-cxx-interop -emit-clang-header-path %t/StringCreator.h
7
7
8
- // RUN: %target-interop-build-clangxx -fobjc-arc -c %t/string-to-nsstring.mm -I %t -o %t/swift-stdlib-execution.o
8
+ // RUN: %target-interop-build-clangxx -std=gnu++20 - fobjc-arc -c %t/string-to-nsstring.mm -I %t -o %t/swift-stdlib-execution.o
9
9
// RUN: %target-build-swift %t/use_foundation.swift %t/create_string.swift -o %t/swift-stdlib-execution -Xlinker %t/swift-stdlib-execution.o -module-name StringCreator -Xfrontend -entry-point-function-name -Xfrontend swiftMain -lc++
10
10
// RUN: %target-codesign %t/swift-stdlib-execution
11
11
// RUN: %target-run %t/swift-stdlib-execution
12
12
13
- // RUN: %target-interop-build-clangxx -fobjc-arc -c %t/string-to-nsstring-one-arc-op.mm -I %t -Xclang -emit-llvm -S -o - -O1 | %FileCheck --check-prefix=CHECKARC %s
13
+ // RUN: %target-interop-build-clangxx -std=gnu++20 - fobjc-arc -c %t/string-to-nsstring-one-arc-op.mm -I %t -Xclang -emit-llvm -S -o - -O1 | %FileCheck --check-prefix=CHECKARC %s
14
14
15
15
// REQUIRES: executable_test
16
16
// REQUIRES: objc_interop
Original file line number Diff line number Diff line change 2
2
// RUN: %target-swift-frontend -parse-as-library %platform-module-dir/Swift.swiftmodule/%module-target-triple.swiftinterface -enable-library-evolution -disable-objc-attr-requires-foundation-module -typecheck -module-name Swift -parse-stdlib -enable-experimental-cxx-interop -emit-clang-header-path %t/Swift.h -experimental-skip-all-function-bodies
3
3
// RUN: %FileCheck %s < %t/Swift.h
4
4
5
- // RUN: %check-interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function)
5
+ // RUN: %check-generic- interop-cxx-header-in-clang(%t/Swift.h -Wno-unused-private-field -Wno-unused-function)
6
6
7
7
// CHECK: namespace Swift {
8
8
9
+ // CHECK: template<class T_0_0>
10
+ // CHECK: template<class T_0_0>
11
+ // CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
12
+ // CHECK-NEXT: class Array final {
13
+ // CHECK-NEXT: public:
14
+ // CHECK-NEXT: inline ~Array() {
15
+ // CHECK: }
16
+ // CHECK-NEXT: inline Array(const Array &other) {
17
+ // CHECK: }
18
+
9
19
// CHECK: class String final {
10
20
// CHECK-NEXT: public:
11
21
// CHECK-NEXT: inline ~String() {
You can’t perform that action at this time.
0 commit comments