File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -205,17 +205,17 @@ swift::cxx_translation::getDeclRepresentation(const ValueDecl *VD) {
205
205
if (getActorIsolation (const_cast <ValueDecl *>(VD)).isActorIsolated ())
206
206
return {Unsupported, UnrepresentableIsolatedInActor};
207
207
Optional<CanGenericSignature> genericSignature;
208
+ // Don't expose @_alwaysEmitIntoClient decls as they require their
209
+ // bodies to be emitted into client.
210
+ if (VD->getAttrs ().hasAttribute <AlwaysEmitIntoClientAttr>())
211
+ return {Unsupported, UnrepresentableRequiresClientEmission};
208
212
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(VD)) {
209
213
if (AFD->hasAsync ())
210
214
return {Unsupported, UnrepresentableAsync};
211
215
if (AFD->hasThrows () &&
212
216
!AFD->getASTContext ().LangOpts .hasFeature (
213
217
Feature::GenerateBindingsForThrowingFunctionsInCXX))
214
218
return {Unsupported, UnrepresentableThrows};
215
- // Don't expose @_alwaysEmitIntoClient functions as they require their
216
- // bodies to be emitted into client.
217
- if (AFD->getAttrs ().hasAttribute <AlwaysEmitIntoClientAttr>())
218
- return {Unsupported, UnrepresentableRequiresClientEmission};
219
219
if (AFD->isGeneric ())
220
220
genericSignature = AFD->getGenericSignature ().getCanonicalSignature ();
221
221
}
Original file line number Diff line number Diff line change 3
3
4
4
// RUN: %target-swift-frontend -typecheck %t/print-string.swift -typecheck -module-name Stringer -enable-experimental-cxx-interop -emit-clang-header-path %t/Stringer.h
5
5
6
- // RUN: %target-interop-build-clangxx -std=gnu++20 -c %t/string-conversions.cpp -I %t -o %t/swift-stdlib-execution.o
6
+ // RUN: %target-interop-build-clangxx -std=gnu++20 -c %t/string-conversions.cpp -I %t -o %t/swift-stdlib-execution.o -DDEBUG=1
7
7
// RUN: %target-build-swift %t/print-string.swift -o %t/swift-stdlib-execution -Xlinker %t/swift-stdlib-execution.o -module-name Stringer -Xfrontend -entry-point-function-name -Xfrontend swiftMain %target-cxx-lib
8
8
// RUN: %target-codesign %t/swift-stdlib-execution
9
9
// RUN: %target-run %t/swift-stdlib-execution | %FileCheck %s
10
10
11
+ // Ensure that this works in optimized mode:
12
+
13
+ // RUN: %target-interop-build-clangxx -std=gnu++20 -c %t/string-conversions.cpp -I %t -o %t/swift-stdlib-execution-opt.o -O
14
+ // RUN: %target-build-swift %t/print-string.swift -o %t/swift-stdlib-execution-opt -Xlinker %t/swift-stdlib-execution-opt.o -module-name Stringer -Xfrontend -entry-point-function-name -Xfrontend swiftMain %target-cxx-lib -O
15
+ // RUN: %target-codesign %t/swift-stdlib-execution-opt
16
+ // RUN: %target-run %t/swift-stdlib-execution-opt | %FileCheck %s
17
+
11
18
// REQUIRES: executable_test
12
19
13
20
// --- print-string.swift
Original file line number Diff line number Diff line change 77
77
// CHECK: SWIFT_INLINE_THUNK void append(const String& other)
78
78
// CHECK: SWIFT_INLINE_THUNK UTF8View getUtf8() const SWIFT_SYMBOL({{.*}});
79
79
// CHECK-NEXT: SWIFT_INLINE_THUNK void setUtf8(const UTF8View& newValue) SWIFT_SYMBOL({{.*}});
80
- // CHECK: SWIFT_INLINE_THUNK bool isContiguousUTF8() const SWIFT_SYMBOL({{.*}});
81
80
// CHECK: #if defined(__OBJC__)
82
81
// CHECK-NEXT: SWIFT_INLINE_THUNK operator NSString * _Nonnull () const noexcept {
83
82
// CHECK-NEXT: return (__bridge_transfer NSString *)(_impl::$sSS10FoundationE19_bridgeToObjectiveCSo8NSStringCyF(_impl::swift_interop_passDirect_Swift_String(_getOpaquePointer())));
Original file line number Diff line number Diff line change 8
8
// CHECK-NOT: unsupported
9
9
// CHECK: HasMethods
10
10
// CHECK: supported
11
+ // CHECK-NOT: unsupported
11
12
12
13
public func supported( ) { }
13
14
@@ -36,4 +37,10 @@ public struct HasMethods {
36
37
return 42
37
38
}
38
39
}
40
+
41
+ @_expose ( Cxx) // expected-error {{property 'unsupportedAEICProp' can not be exposed to C++ as it requires code to be emitted into client}}
42
+ @_alwaysEmitIntoClient
43
+ public var unsupportedAEICProp : Bool {
44
+ return false
45
+ }
39
46
}
You can’t perform that action at this time.
0 commit comments