From 000c2604b05eb31d709ab5405620828a3b14d57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 23 Oct 2025 13:57:45 -0700 Subject: [PATCH 1/3] SE-495: Make @c an official feature --- include/swift/AST/DiagnosticsSema.def | 3 --- include/swift/Basic/Features.def | 4 +--- lib/Sema/TypeCheckAttr.cpp | 6 ------ .../bridge-cxx-struct-back-to-cxx.swift | 1 + test/Parse/objc_enum.swift | 2 +- ...g-header-nonmodular-includes-mock-sdk.swift | 1 + ...includes-modulemap-not-in-include-dir.swift | 1 + ...onmodular-includes-path-normalization.swift | 1 + ...-nonmodular-includes-symlinked-header.swift | 1 + test/PrintAsObjC/empty.swift | 7 +++++++ test/PrintAsObjC/enums.swift | 18 +++++++++--------- test/PrintAsObjC/mixed-framework-fwd.swift | 3 ++- test/PrintAsObjC/mixed-framework.swift | 3 ++- test/Sema/objc_property_wrappers.swift | 2 +- test/attr/attr_cdecl.swift | 2 +- test/attr/attr_cdecl_official_rejected.swift | 11 ++++------- test/attr/attr_ibaction.swift | 2 +- test/attr/attr_ibsegueaction.swift | 8 ++++---- test/attr/attr_objc.swift | 10 +++++----- 19 files changed, 43 insertions(+), 43 deletions(-) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 87d6440a32e15..9c5587ce0614f 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -2114,9 +2114,6 @@ ERROR(cdecl_throws,none, ERROR(cdecl_incompatible_with_objc,none, "cannot apply both '@c' and '@objc' to %kindonly0", (const Decl *)) -ERROR(cdecl_feature_required,none, - "'@c' requires '-enable-experimental-feature CDecl'", - ()) // @used and @section ERROR(section_empty_name,none, diff --git a/include/swift/Basic/Features.def b/include/swift/Basic/Features.def index 0acb4b2c732de..fa037d2175ca7 100644 --- a/include/swift/Basic/Features.def +++ b/include/swift/Basic/Features.def @@ -277,6 +277,7 @@ LANGUAGE_FEATURE(LifetimeDependenceMutableAccessors, 0, "Support mutable accesso LANGUAGE_FEATURE(InoutLifetimeDependence, 0, "Support @_lifetime(&)") SUPPRESSIBLE_LANGUAGE_FEATURE(NonexhaustiveAttribute, 487, "Nonexhaustive Enums") LANGUAGE_FEATURE(ModuleSelector, 491, "Module selectors (`Module::name` syntax)") +LANGUAGE_FEATURE(CDecl, 495, "C compatible functions and enums with @c") // Swift 6 UPCOMING_FEATURE(ConciseMagicFile, 274, 6) @@ -529,9 +530,6 @@ EXPERIMENTAL_FEATURE(ClosureBodyMacro, true) /// Allow declarations of Swift runtime symbols using @_silgen_name. EXPERIMENTAL_FEATURE(AllowRuntimeSymbolDeclarations, true) -/// Allow use of `@c` -EXPERIMENTAL_FEATURE(CDecl, false) - /// Allow use of `using` declaration that control default isolation /// in a file scope. EXPERIMENTAL_FEATURE(DefaultIsolationPerFile, false) diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index 8f21b894835cf..f8352574796aa 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -2486,12 +2486,6 @@ void AttributeChecker::visitCDeclAttr(CDeclAttr *attr) { if (D->getAttrs().getAttribute()) { diagnose(attr->getLocation(), diag::cdecl_incompatible_with_objc, D); } - - // @c needs to be enabled via a feature flag. - if (!attr->Underscored && - !Ctx.LangOpts.hasFeature(Feature::CDecl)) { - diagnose(attr->getLocation(), diag::cdecl_feature_required); - } } void AttributeChecker::visitExposeAttr(ExposeAttr *attr) { diff --git a/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift b/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift index cae37b20351fb..4bb4e05d3d99c 100644 --- a/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift +++ b/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift @@ -181,6 +181,7 @@ public struct Strct { public let transform2: ns.anonStructInNS } +// CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") diff --git a/test/Parse/objc_enum.swift b/test/Parse/objc_enum.swift index b6c5237daf2b4..083a590734197 100644 --- a/test/Parse/objc_enum.swift +++ b/test/Parse/objc_enum.swift @@ -26,7 +26,7 @@ enum NonObjCEnum: Int { class Bar { @objc func foo(x: Foo) {} - @objc func nonObjC(x: NonObjCEnum) {} //expected-error{{type of the parameter cannot be represented in Objective-C}} //expected-note{{non-'@objc' enums cannot be represented in Objective-C}} + @objc func nonObjC(x: NonObjCEnum) {} //expected-error{{type of the parameter cannot be represented in Objective-C}} //expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} } // @objc enums with payloads rejected with no source location info diff --git a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-mock-sdk.swift b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-mock-sdk.swift index d053c463c5488..504694626269c 100644 --- a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-mock-sdk.swift +++ b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-mock-sdk.swift @@ -24,6 +24,7 @@ public class HelloWorld: NSObject { } } +// CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") // CHECK-NEXT: #pragma clang diagnostic ignored "-Watimport-in-framework-header" diff --git a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-modulemap-not-in-include-dir.swift b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-modulemap-not-in-include-dir.swift index d2e5454b787df..1dd2aee154a94 100644 --- a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-modulemap-not-in-include-dir.swift +++ b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-modulemap-not-in-include-dir.swift @@ -11,6 +11,7 @@ import EmitClangHeaderNonmodularIncludesStressTest public class Bar : Baz {} +// CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") // CHECK-NEXT: #pragma clang diagnostic ignored "-Watimport-in-framework-header" diff --git a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-path-normalization.swift b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-path-normalization.swift index 3e4ca18b47648..5a2ee3431f935 100644 --- a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-path-normalization.swift +++ b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-path-normalization.swift @@ -9,6 +9,7 @@ import EmitClangHeaderNonmodularIncludesStressTest public class Bar : Baz {} +// CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") // CHECK-NEXT: #pragma clang diagnostic ignored "-Watimport-in-framework-header" diff --git a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-symlinked-header.swift b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-symlinked-header.swift index 4ac059c77112c..24d4bade22bc6 100644 --- a/test/PrintAsObjC/emit-clang-header-nonmodular-includes-symlinked-header.swift +++ b/test/PrintAsObjC/emit-clang-header-nonmodular-includes-symlinked-header.swift @@ -11,6 +11,7 @@ import EmitClangHeaderNonmodularIncludesStressTest public class Bar : Foo {} +// CHECK: #if __has_feature(objc_modules) // CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") // CHECK-NEXT: #pragma clang diagnostic ignored "-Watimport-in-framework-header" diff --git a/test/PrintAsObjC/empty.swift b/test/PrintAsObjC/empty.swift index 8339117d09ca6..999891c8cafb3 100644 --- a/test/PrintAsObjC/empty.swift +++ b/test/PrintAsObjC/empty.swift @@ -41,6 +41,13 @@ // CHECK-NEXT: #endif // CHECK-NEXT: #endif +// CHECK: #if defined(__cplusplus) +// CHECK-NEXT: extern "C" { +// CHECK-NEXT: #endif + +// CHECK: #if defined(__cplusplus) +// CHECK-NEXT: } // extern "C" +// CHECK-NEXT: #endif // CHECK-NOT: {{[@;{}]}} diff --git a/test/PrintAsObjC/enums.swift b/test/PrintAsObjC/enums.swift index 4faed0f0f9c8d..022d5d46a51a9 100644 --- a/test/PrintAsObjC/enums.swift +++ b/test/PrintAsObjC/enums.swift @@ -2,14 +2,14 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-module -emit-module-doc -o %t %s -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %t/enums.swiftmodule -typecheck -verify -emit-objc-header-path %t/enums.h -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module -// RUN: %FileCheck %s < %t/enums.h +// RUN: %FileCheck %s -input-file %t/enums.h // RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/enums.h // RUN: %check-in-clang %t/enums.h // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.h -include ctypes.h -include CoreFoundation.h // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-source-import -emit-module -o /dev/null -emit-module-doc-path /dev/null -module-name enums %s -emit-objc-header-path %t/enums.WMO.h -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module -// RUN: %FileCheck %s < %t/enums.WMO.h -// RUN: %FileCheck -check-prefix=NEGATIVE %s < %t/enums.WMO.h +// RUN: %FileCheck %s -input-file %t/enums.WMO.h +// RUN: %FileCheck -check-prefix=NEGATIVE %s -input-file %t/enums.WMO.h // RUN: %check-in-clang %t/enums.WMO.h // RUN: %check-in-clang -fno-modules -Qunused-arguments %t/enums.WMO.h -include ctypes.h -include CoreFoundation.h @@ -18,7 +18,7 @@ // RUN: echo "{\"%s\": {\"objc-header\": \"%t/enums-supplemental.h\"}}" > %t-output-file-map.json // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library %s -enable-source-import -typecheck -verify -supplementary-output-file-map %t-output-file-map.json -import-objc-header %S/Inputs/enums.h -disable-objc-attr-requires-foundation-module -// RUN: %FileCheck -check-prefix CHECK-SUPPLEMENTAL %s < %t/enums-supplemental.h +// RUN: %FileCheck -check-prefix CHECK-SUPPLEMENTAL %s -input-file %t/enums-supplemental.h // REQUIRES: objc_interop @@ -26,12 +26,12 @@ import Foundation // NEGATIVE-NOT: NSMalformedEnumMissingTypedef : // NEGATIVE-NOT: enum EnumNamed -// CHECK-LABEL: enum FooComments : NSInteger; -// CHECK-LABEL: enum NegativeValues : int16_t; -// CHECK-LABEL: enum ObjcEnumNamed : NSInteger; +// CHECK-LABEL: typedef SWIFT_ENUM_FWD_DECL(NSInteger, FooComments) +// CHECK-LABEL: typedef SWIFT_ENUM_FWD_DECL(int16_t, NegativeValues) +// CHECK-LABEL: typedef SWIFT_ENUM_FWD_DECL(NSInteger, ObjcEnumNamed) -// CHECK-SUPPLEMENTAL: enum NegativeValues : int16_t; -// CHECK-SUPPLEMENTAL: enum ObjcEnumNamed : NSInteger; +// CHECK-SUPPLEMENTAL: typedef SWIFT_ENUM_FWD_DECL(int16_t, NegativeValues) +// CHECK-SUPPLEMENTAL: typedef SWIFT_ENUM_FWD_DECL(NSInteger, ObjcEnumNamed) // CHECK-LABEL: @interface AnEnumMethod // CHECK-NEXT: - (enum NegativeValues)takeAndReturnEnum:(enum FooComments)foo SWIFT_WARN_UNUSED_RESULT; diff --git a/test/PrintAsObjC/mixed-framework-fwd.swift b/test/PrintAsObjC/mixed-framework-fwd.swift index ca08cf4c8021d..6a56867e115fc 100644 --- a/test/PrintAsObjC/mixed-framework-fwd.swift +++ b/test/PrintAsObjC/mixed-framework-fwd.swift @@ -17,7 +17,8 @@ // REQUIRES: objc_interop -// CHECK-LABEL: #if __has_feature(objc_modules) +// CHECK: #if __has_feature(objc_modules) +// CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning // CHECK-NEXT: #pragma clang diagnostic // CHECK-NEXT: #endif diff --git a/test/PrintAsObjC/mixed-framework.swift b/test/PrintAsObjC/mixed-framework.swift index 0efde6045dded..d7c1257f124b9 100644 --- a/test/PrintAsObjC/mixed-framework.swift +++ b/test/PrintAsObjC/mixed-framework.swift @@ -12,7 +12,8 @@ // CHECK: #pragma clang diagnostic push -// CHECK-LABEL: #if __has_feature(objc_modules) +// CHECK: #if __has_feature(objc_modules) +// CHECK: #if __has_feature(objc_modules) // CHECK-NEXT: #if __has_warning("-Watimport-in-framework-header") // CHECK-NEXT: #pragma clang diagnostic ignored "-Watimport-in-framework-header" // CHECK-NEXT: #endif diff --git a/test/Sema/objc_property_wrappers.swift b/test/Sema/objc_property_wrappers.swift index 480637cccf8ee..2682619b3d80c 100644 --- a/test/Sema/objc_property_wrappers.swift +++ b/test/Sema/objc_property_wrappers.swift @@ -75,7 +75,7 @@ public struct WrapperStruct { class EnumCase { @objc func foo(@WrapperEnum _ ref: Int) throws {} // expected-error {{method cannot be marked '@objc' because the type of the parameter cannot be represented in Objective-C}} - // expected-note@-1 {{non-'@objc' enums cannot be represented in Objective-C}} + // expected-note@-1 {{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} } @propertyWrapper diff --git a/test/attr/attr_cdecl.swift b/test/attr/attr_cdecl.swift index c2d9110a50896..3e627a619ff81 100644 --- a/test/attr/attr_cdecl.swift +++ b/test/attr/attr_cdecl.swift @@ -31,7 +31,7 @@ enum UnderscoreCDeclEnum: CInt { case A, B } func swiftStruct(x: SwiftStruct) {} // expected-error{{cannot be represented}} expected-note{{Swift struct}} @_cdecl("swiftEnum") -func swiftEnum(x: SwiftEnum) {} // expected-error{{cannot be represented}} expected-note{{non-'@objc' enum}} +func swiftEnum(x: SwiftEnum) {} // expected-error{{cannot be represented}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} @_cdecl("cEnum") func cEnum(x: CEnum) {} diff --git a/test/attr/attr_cdecl_official_rejected.swift b/test/attr/attr_cdecl_official_rejected.swift index 07b22a9ae5b12..37f28420d8284 100644 --- a/test/attr/attr_cdecl_official_rejected.swift +++ b/test/attr/attr_cdecl_official_rejected.swift @@ -1,12 +1,9 @@ // RUN: %target-typecheck-verify-swift -// RUN: %target-swift-frontend -typecheck %s \ -// RUN: -enable-experimental-feature CDecl +// RUN: %target-swift-frontend -typecheck %s -// REQUIRES: swift_feature_CDecl - -@c(cdecl_foo) func foo() { } // expected-error {{'@c' requires '-enable-experimental-feature CDecl'}} +@c(cdecl_foo) func foo() { } var computed: Int { - @c(get_computed) get { return 0 } // expected-error {{'@c' requires '-enable-experimental-feature CDecl'}} - @c(set_computed) set { } // expected-error {{'@c' requires '-enable-experimental-feature CDecl'}} + @c(get_computed) get { return 0 } + @c(set_computed) set { } } diff --git a/test/attr/attr_ibaction.swift b/test/attr/attr_ibaction.swift index d6ede373e82ae..d243d41aaa508 100644 --- a/test/attr/attr_ibaction.swift +++ b/test/attr/attr_ibaction.swift @@ -142,7 +142,7 @@ extension String: @retroactive _ObjectiveCBridgeable { // Other bad cases @IBAction func action30(_: S) {} // expected-error{{method cannot be marked '@IBAction' because the type of the parameter cannot be represented in Objective-C}} expected-note{{Swift structs cannot be represented in Objective-C}} - @IBAction func action31(_: E) {} // expected-error{{method cannot be marked '@IBAction' because the type of the parameter cannot be represented in Objective-C}} expected-note{{non-'@objc' enums cannot be represented in Objective-C}} + @IBAction func action31(_: E) {} // expected-error{{method cannot be marked '@IBAction' because the type of the parameter cannot be represented in Objective-C}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} init() { } } diff --git a/test/attr/attr_ibsegueaction.swift b/test/attr/attr_ibsegueaction.swift index 82460e599c4c0..e2d01470e1c2f 100644 --- a/test/attr/attr_ibsegueaction.swift +++ b/test/attr/attr_ibsegueaction.swift @@ -224,10 +224,10 @@ protocol CP2 : class { } @IBSegueAction func action30c(_: AnyObject, _: S, _: AnyObject) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 2 cannot be represented in Objective-C}} expected-note{{Swift structs cannot be represented in Objective-C}} @IBSegueAction func action30d(_: AnyObject, _: AnyObject, _: S) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 3 cannot be represented in Objective-C}} expected-note{{Swift structs cannot be represented in Objective-C}} - @IBSegueAction func action31a(_: AnyObject, _: AnyObject, _: AnyObject) -> E {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because its result type cannot be represented in Objective-C}} expected-note{{non-'@objc' enums cannot be represented in Objective-C}} - @IBSegueAction func action31b(_: E, _: AnyObject, _: AnyObject) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 1 cannot be represented in Objective-C}} expected-note{{non-'@objc' enums cannot be represented in Objective-C}} - @IBSegueAction func action31c(_: AnyObject, _: E, _: AnyObject) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 2 cannot be represented in Objective-C}} expected-note{{non-'@objc' enums cannot be represented in Objective-C}} - @IBSegueAction func action31d(_: AnyObject, _: AnyObject, _: E) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 3 cannot be represented in Objective-C}} expected-note{{non-'@objc' enums cannot be represented in Objective-C}} + @IBSegueAction func action31a(_: AnyObject, _: AnyObject, _: AnyObject) -> E {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because its result type cannot be represented in Objective-C}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} + @IBSegueAction func action31b(_: E, _: AnyObject, _: AnyObject) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 1 cannot be represented in Objective-C}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} + @IBSegueAction func action31c(_: AnyObject, _: E, _: AnyObject) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 2 cannot be represented in Objective-C}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} + @IBSegueAction func action31d(_: AnyObject, _: AnyObject, _: E) -> AnyObject {fatalError()} // expected-error{{method cannot be marked '@IBSegueAction' because the type of the parameter 3 cannot be represented in Objective-C}} expected-note{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} // Supported arities @IBSegueAction func actionWith0() -> X {fatalError()} // expected-error{{@IBSegueAction methods must have 1 to 3 arguments}} diff --git a/test/attr/attr_objc.swift b/test/attr/attr_objc.swift index aeca130f9eb1f..185f045956f16 100644 --- a/test/attr/attr_objc.swift +++ b/test/attr/attr_objc.swift @@ -639,7 +639,7 @@ class subject_subscriptInvalid4 { class subject_subscriptInvalid5 { @objc // bad-access-note-move{{subject_subscriptInvalid5.subscript(_:)}} subscript(a: PlainEnum) -> Int { // access-note-adjust{{@objc}} expected-error {{subscript cannot be marked '@objc' because its type cannot be represented in Objective-C}} - // expected-note@-1{{enums cannot be represented in Objective-C}} + // expected-note@-1{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} get { return 0 } } } @@ -765,7 +765,7 @@ class infer_instanceFunc1 { @objc // bad-access-note-move{{infer_instanceFunc1.func11_(a:)}} func func11_(a: PlainEnum) {} // access-note-adjust{{@objc}} expected-error@-1 {{instance method cannot be marked '@objc' because the type of the parameter cannot be represented in Objective-C}} - // expected-note@-2 {{non-'@objc' enums cannot be represented in Objective-C}} + // expected-note@-2{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} func func12(a: PlainProtocol) {} // CHECK-LABEL: {{^}} func func12(a: any PlainProtocol) { @@ -881,7 +881,7 @@ class infer_instanceFunc1 { // access-note-adjust{{@objc}} expected-error@-1 {{instance method cannot be marked '@objc' because the type of the parameter 1 cannot be represented in Objective-C}} // expected-note@-2 {{Swift structs cannot be represented in Objective-C}} // access-note-adjust{{@objc}} expected-error@-3 {{instance method cannot be marked '@objc' because the type of the parameter 2 cannot be represented in Objective-C}} - // expected-note@-4 {{non-'@objc' enums cannot be represented in Objective-C}} + // expected-note@-4{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} // Produces an extra: expected-note@-5 * {{attribute 'objc' was added by access note for fancy tests}} @objc // access-note-move{{infer_instanceFunc1.func_UnnamedParam1(_:)}} @@ -1101,7 +1101,7 @@ class infer_instanceVar1 { @objc // bad-access-note-move{{infer_instanceVar1.var_PlainEnum_}} var var_PlainEnum_: PlainEnum // access-note-adjust{{@objc}} expected-error@-1 {{property cannot be marked '@objc' because its type cannot be represented in Objective-C}} - // expected-note@-2 {{non-'@objc' enums cannot be represented in Objective-C}} + // expected-note@-2{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} var var_PlainProtocol: PlainProtocol // CHECK-LABEL: {{^}} var var_PlainProtocol: any PlainProtocol @@ -2322,7 +2322,7 @@ class ClassThrows1 { @objc // bad-access-note-move{{ClassThrows1.fooWithErrorEnum1(x:)}} func fooWithErrorEnum1(x: ErrorEnum) {} // access-note-adjust{{@objc}} expected-error@-1{{instance method cannot be marked '@objc' because the type of the parameter cannot be represented in Objective-C}} - // expected-note@-2{{non-'@objc' enums cannot be represented in Objective-C}} + // expected-note@-2{{Swift enums not marked '@c' or '@objc' cannot be represented in Objective-C}} // CHECK: {{^}} func fooWithErrorEnum2(x: ErrorEnum) func fooWithErrorEnum2(x: ErrorEnum) {} From bce585c133f783297e4f7149b8206d44754159a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 24 Oct 2025 11:33:44 -0700 Subject: [PATCH 2/3] SE-495: Make CImplementation an official feature --- include/swift/Basic/Features.def | 4 +-- lib/Sema/TypeCheckDeclObjC.cpp | 5 --- .../ext/cdecl_implementation_features.swift | 14 ++++---- .../objc_implementation_early_adopter.swift | 32 +++++++++---------- 4 files changed, 23 insertions(+), 32 deletions(-) diff --git a/include/swift/Basic/Features.def b/include/swift/Basic/Features.def index fa037d2175ca7..372c6e65998bb 100644 --- a/include/swift/Basic/Features.def +++ b/include/swift/Basic/Features.def @@ -278,6 +278,7 @@ LANGUAGE_FEATURE(InoutLifetimeDependence, 0, "Support @_lifetime(&)") SUPPRESSIBLE_LANGUAGE_FEATURE(NonexhaustiveAttribute, 487, "Nonexhaustive Enums") LANGUAGE_FEATURE(ModuleSelector, 491, "Module selectors (`Module::name` syntax)") LANGUAGE_FEATURE(CDecl, 495, "C compatible functions and enums with @c") +LANGUAGE_FEATURE(CImplementation, 495, "C compatible functions and enums with @c") // Swift 6 UPCOMING_FEATURE(ConciseMagicFile, 274, 6) @@ -470,9 +471,6 @@ EXPERIMENTAL_FEATURE(ClosureIsolation, true) // staging purposes. EXPERIMENTAL_FEATURE(ObjCImplementationWithResilientStorage, true) -// Enable @implementation on @_cdecl functions. -EXPERIMENTAL_FEATURE(CImplementation, true) - // Enable @sensitive attribute. EXPERIMENTAL_FEATURE(Sensitive, true) diff --git a/lib/Sema/TypeCheckDeclObjC.cpp b/lib/Sema/TypeCheckDeclObjC.cpp index 87e543f0d04b9..8cd12c467d05a 100644 --- a/lib/Sema/TypeCheckDeclObjC.cpp +++ b/lib/Sema/TypeCheckDeclObjC.cpp @@ -4197,11 +4197,6 @@ class ObjCImplementationChecker { !decl->getASTContext().LangOpts.hasFeature(Feature::CImplementation)) return; - // Only encourage @_objcImplementation *extension* adopters to adopt - // @implementation; @_objcImplementation @_cdecl hasn't been stabilized yet. - if (!isa(decl)) - return; - auto diag = diagnose(getAttr()->getLocation(), diag::objc_implementation_early_spelling_deprecated); diag.fixItReplace(getAttr()->getRangeWithAt(), "@implementation"); diff --git a/test/decl/ext/cdecl_implementation_features.swift b/test/decl/ext/cdecl_implementation_features.swift index 54ea098acb9c8..13638618e9aa7 100644 --- a/test/decl/ext/cdecl_implementation_features.swift +++ b/test/decl/ext/cdecl_implementation_features.swift @@ -1,15 +1,13 @@ -// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h 2>&1 | %FileCheck --check-prefixes NO,CHECK %s -// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature CImplementation 2>&1 | %FileCheck --check-prefixes YES,C,CHECK %s +// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h > %t 2>&1 +// RUN: %FileCheck --input-file %t --check-prefixes YES,CHECK %s +// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature CImplementation > %t 2>&1 +// RUN: %FileCheck --input-file %t --check-prefixes YES,C,CHECK %s // REQUIRES: swift_feature_CImplementation -// YES-DAG: cdecl_implementation_features.swift:[[@LINE+4]]:{{[0-9]+}}: warning: global function 'CImplFunc1' of type '(Double) -> ()' does not match type '(Int32) -> Void' declared by the header; this will become an error after adopting '@implementation' -// NO-DAG: cdecl_implementation_features.swift:[[@LINE+3]]:{{[0-9]+}}: error: '_objcImplementation' attribute is only valid when experimental feature CImplementation is enabled -// YES-NOT: cdecl_implementation_features.swift:[[@LINE+2]]:{{[0-9]+}}: warning: '@_objcImplementation' is deprecated; use '@implementation' instead -// TODO: When @implementation @_cdecl stabilizes, YES-NOT on the line above will become YES-DAG +// YES-DAG: cdecl_implementation_features.swift:[[@LINE+1]]:{{[0-9]+}}: warning: global function 'CImplFunc1' of type '(Double) -> ()' does not match type '(Int32) -> Void' declared by the header; this will become an error after adopting '@implementation' @_objcImplementation @_cdecl("CImplFunc1") func CImplFunc1(_: Double) {} -// YES-DAG: cdecl_implementation_features.swift:[[@LINE+3]]:{{[0-9]+}}: error: global function 'CImplFunc2' of type '(Double) -> ()' does not match type '(Int32) -> Void' declared by the header{{$}} -// NO-DAG: cdecl_implementation_features.swift:[[@LINE+2]]:{{[0-9]+}}: error: 'implementation' attribute is only valid when experimental feature CImplementation is enabled +// YES-DAG: cdecl_implementation_features.swift:[[@LINE+2]]:{{[0-9]+}}: error: global function 'CImplFunc2' of type '(Double) -> ()' does not match type '(Int32) -> Void' declared by the header{{$}} // YES-NOT: cdecl_implementation_features.swift:[[@LINE+1]]:{{[0-9]+}}: error: 'implementation' attribute is only valid when experimental feature CImplementation is enabled @implementation @_cdecl("CImplFunc2") func CImplFunc2(_: Double) {} diff --git a/test/decl/ext/objc_implementation_early_adopter.swift b/test/decl/ext/objc_implementation_early_adopter.swift index 30adc38254698..9bc67db7d342c 100644 --- a/test/decl/ext/objc_implementation_early_adopter.swift +++ b/test/decl/ext/objc_implementation_early_adopter.swift @@ -537,14 +537,14 @@ protocol EmptySwiftProto {} // @_cdecl for global functions // -@_objcImplementation @_cdecl("CImplFunc1") +@implementation @_cdecl("CImplFunc1") func CImplFunc1(_: Int32) { // OK } -@_objcImplementation(BadCategory) @_cdecl("CImplFunc2") +@implementation(BadCategory) @_cdecl("CImplFunc2") func CImplFunc2(_: Int32) { - // expected-error@-2 {{global function 'CImplFunc2' does not belong to an Objective-C category; remove the category name from this attribute}} {{21-34=}} + // expected-error@-2 {{global function 'CImplFunc2' does not belong to an Objective-C category; remove the category name from this attribute}} {{16-29=}} } @_objcImplementation @_cdecl("CImplFuncMissing") @@ -557,12 +557,12 @@ func CImplFuncMismatch1(_: Float) { // expected-warning@-1 {{global function 'CImplFuncMismatch1' of type '(Float) -> ()' does not match type '(Int32) -> Void' declared by the header}} } -@_objcImplementation @_cdecl("CImplFuncMismatch2") +@implementation @_cdecl("CImplFuncMismatch2") func CImplFuncMismatch2(_: Int32) -> Float { - // expected-warning@-1 {{global function 'CImplFuncMismatch2' of type '(Int32) -> Float' does not match type '(Int32) -> Void' declared by the header}} + // expected-error@-1 {{global function 'CImplFuncMismatch2' of type '(Int32) -> Float' does not match type '(Int32) -> Void' declared by the header}} } -@_objcImplementation @_cdecl("CImplFuncMismatch3") +@implementation @_cdecl("CImplFuncMismatch3") func CImplFuncMismatch3(_: Any?) { // OK } @@ -572,18 +572,18 @@ func CImplFuncMismatch4(_: Any) { // expected-warning@-1 {{global function 'CImplFuncMismatch4' of type '(Any) -> ()' does not match type '(Any?) -> Void' declared by the header}} } -@_objcImplementation @_cdecl("CImplFuncMismatch5") +@implementation @_cdecl("CImplFuncMismatch5") func CImplFuncMismatch5(_: Any) { // OK } -@_objcImplementation @_cdecl("CImplFuncMismatch6") +@implementation @_cdecl("CImplFuncMismatch6") func CImplFuncMismatch6(_: Any!) { // OK, mismatch allowed } -@_objcImplementation @_cdecl("CImplFuncMismatch3a") +@implementation @_cdecl("CImplFuncMismatch3a") func CImplFuncMismatch3a(_: Int32) -> Any? { // OK } @@ -593,23 +593,23 @@ func CImplFuncMismatch4a(_: Int32) -> Any { // expected-warning@-1 {{global function 'CImplFuncMismatch4a' of type '(Int32) -> Any' does not match type '(Int32) -> Any?' declared by the header}} } -@_objcImplementation @_cdecl("CImplFuncMismatch5a") +@implementation @_cdecl("CImplFuncMismatch5a") func CImplFuncMismatch5a(_: Int32) -> Any { // OK } -@_objcImplementation @_cdecl("CImplFuncMismatch6a") +@implementation @_cdecl("CImplFuncMismatch6a") func CImplFuncMismatch6a(_: Int32) -> Any! { // OK, mismatch allowed } -@_objcImplementation @_cdecl("CImplFuncNameMismatch1") +@implementation @_cdecl("CImplFuncNameMismatch1") func mismatchedName1(_: Int32) { // expected-error@-2 {{could not find imported function 'CImplFuncNameMismatch1' matching global function 'mismatchedName1'; make sure you import the module or header that declares it}} // FIXME: Improve diagnostic for a partial match. } -@_objcImplementation @_cdecl("mismatchedName2") +@implementation @_cdecl("mismatchedName2") func CImplFuncNameMismatch2(_: Int32) { // expected-error@-2 {{could not find imported function 'mismatchedName2' matching global function 'CImplFuncNameMismatch2'; make sure you import the module or header that declares it}} // FIXME: Improve diagnostic for a partial match. @@ -619,14 +619,14 @@ func CImplFuncNameMismatch2(_: Int32) { // TODO: @_cdecl for global functions imported as computed vars // var cImplComputedGlobal1: Int32 { - @_objcImplementation @_cdecl("CImplGetComputedGlobal1") + @implementation @_cdecl("CImplGetComputedGlobal1") get { // FIXME: Lookup for vars isn't working yet // expected-error@-3 {{could not find imported function 'CImplGetComputedGlobal1' matching getter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}} return 0 } - @_objcImplementation @_cdecl("CImplSetComputedGlobal1") + @implementation @_cdecl("CImplSetComputedGlobal1") set { // FIXME: Lookup for vars isn't working yet // expected-error@-3 {{could not find imported function 'CImplSetComputedGlobal1' matching setter for var 'cImplComputedGlobal1'; make sure you import the module or header that declares it}} @@ -638,7 +638,7 @@ var cImplComputedGlobal1: Int32 { // TODO: @_cdecl for import-as-member functions // extension CImplStruct { - @_objcImplementation @_cdecl("CImplStructStaticFunc1") + @implementation @_cdecl("CImplStructStaticFunc1") static func staticFunc1(_: Int32) { // FIXME: Add underlying support for this // expected-error@-3 {{@_cdecl can only be applied to global functions}} From 94113f4a830f89294555672ec2a89637d023e6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20Laferri=C3=A8re?= Date: Wed, 29 Oct 2025 11:53:18 -0700 Subject: [PATCH 3/3] SE-496: Remove references to features CDecl and CImplementation --- include/swift/AST/DiagnosticsSema.def | 2 -- include/swift/Basic/Features.def | 2 -- lib/AST/FeatureSet.cpp | 6 ---- lib/PrintAsClang/ModuleContentsWriter.cpp | 14 +++------- lib/PrintAsClang/PrintAsClang.cpp | 28 +++++++++---------- lib/Sema/TypeCheckAttr.cpp | 3 -- lib/Sema/TypeCheckDeclObjC.cpp | 20 ++++--------- test/ASTGen/attrs.swift | 4 --- test/IRGen/cdecl_implementation.swift | 5 ---- test/IRGen/objc_implementation.swift | 3 +- test/Interpreter/cdecl_enum_run.swift | 3 +- .../cdecl_implementation_run.swift | 6 +--- test/Interpreter/cdecl_official_run.swift | 6 ++-- test/Interpreter/objc_implementation.swift | 3 +- .../objc_implementation_objc_client.m | 3 +- .../objc_implementation_resilience.swift | 3 +- ...jc_implementation_resilience_objc_client.m | 3 +- ...plementation_resilience_swift_client.swift | 3 +- .../objc_implementation_swift_client.swift | 3 +- .../cdecl-swiftinterface.swift | 6 +--- test/PrintAsObjC/cdecl-enum-reference.swift | 8 ++---- test/PrintAsObjC/cdecl-enums.swift | 4 +-- .../cdecl-includes-with-objc.swift | 4 +-- test/PrintAsObjC/cdecl-includes.swift | 5 +--- .../cdecl-official-for-objc-clients.swift | 4 +-- .../cdecl-official-visibility.swift | 8 ++---- test/PrintAsObjC/cdecl-official.swift | 5 +--- test/PrintAsObjC/cdecl-with-objc.swift | 4 +-- test/PrintAsObjC/objc_implementation.swift | 5 ++-- test/SILGen/cdecl-official.swift | 5 +--- test/attr/attr_abi.swift | 3 +- test/attr/attr_cdecl_official.swift | 4 +-- test/attr/attr_cdecl_official_async.swift | 4 +-- test/attr/attr_cdecl_official_with_objc.swift | 4 +-- .../ext/cdecl_implementation_features.swift | 4 +-- .../ext/cdecl_official_implementation.swift | 7 +---- test/decl/ext/objc_implementation.swift | 3 +- .../objc_implementation_early_adopter.swift | 3 +- test/embedded/linkage/c.swift | 4 +-- 39 files changed, 56 insertions(+), 158 deletions(-) diff --git a/include/swift/AST/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 9c5587ce0614f..156a90f939398 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -6701,8 +6701,6 @@ NOTE(not_objc_swift_class,none, NOTE(not_objc_swift_struct,none, "Swift structs cannot be represented in %" FOREIGN_LANG_SELECT "0", (ForeignLanguage)) -NOTE(not_objc_swift_enum,none, - "non-'@objc' enums cannot be represented in Objective-C", ()) NOTE(not_cdecl_or_objc_swift_enum,none, "Swift enums not marked '@c'%select{| or '@objc'}0 cannot be " "represented in %" FOREIGN_LANG_SELECT "0", diff --git a/include/swift/Basic/Features.def b/include/swift/Basic/Features.def index 372c6e65998bb..f50db34a20296 100644 --- a/include/swift/Basic/Features.def +++ b/include/swift/Basic/Features.def @@ -277,8 +277,6 @@ LANGUAGE_FEATURE(LifetimeDependenceMutableAccessors, 0, "Support mutable accesso LANGUAGE_FEATURE(InoutLifetimeDependence, 0, "Support @_lifetime(&)") SUPPRESSIBLE_LANGUAGE_FEATURE(NonexhaustiveAttribute, 487, "Nonexhaustive Enums") LANGUAGE_FEATURE(ModuleSelector, 491, "Module selectors (`Module::name` syntax)") -LANGUAGE_FEATURE(CDecl, 495, "C compatible functions and enums with @c") -LANGUAGE_FEATURE(CImplementation, 495, "C compatible functions and enums with @c") // Swift 6 UPCOMING_FEATURE(ConciseMagicFile, 274, 6) diff --git a/lib/AST/FeatureSet.cpp b/lib/AST/FeatureSet.cpp index 2a0e9452d1675..3aa5e46bd2362 100644 --- a/lib/AST/FeatureSet.cpp +++ b/lib/AST/FeatureSet.cpp @@ -277,7 +277,6 @@ UNINTERESTING_FEATURE(IsolatedAny2) UNINTERESTING_FEATURE(GlobalActorIsolatedTypesUsability) UNINTERESTING_FEATURE(ObjCImplementation) UNINTERESTING_FEATURE(ObjCImplementationWithResilientStorage) -UNINTERESTING_FEATURE(CImplementation) UNINTERESTING_FEATURE(Sensitive) UNINTERESTING_FEATURE(DebugDescriptionMacro) UNINTERESTING_FEATURE(ReinitializeConsumeInMultiBlockDefer) @@ -322,11 +321,6 @@ static bool usesFeatureClosureBodyMacro(Decl *decl) { return false; } -static bool usesFeatureCDecl(Decl *decl) { - auto attr = decl->getAttrs().getAttribute(); - return attr && !attr->Underscored; -} - UNINTERESTING_FEATURE(StrictMemorySafety) UNINTERESTING_FEATURE(LibraryEvolution) UNINTERESTING_FEATURE(SafeInteropWrappers) diff --git a/lib/PrintAsClang/ModuleContentsWriter.cpp b/lib/PrintAsClang/ModuleContentsWriter.cpp index 8f62d8f8e33b2..6f16eb0d79974 100644 --- a/lib/PrintAsClang/ModuleContentsWriter.cpp +++ b/lib/PrintAsClang/ModuleContentsWriter.cpp @@ -542,16 +542,10 @@ class ModuleWriter { assert(ED->isCCompatibleEnum() || ED->hasClangNode()); forwardDeclare(ED, [&]{ - if (ED->getASTContext().LangOpts.hasFeature(Feature::CDecl)) { - // Forward declare in a way to be compatible with older C standards. - os << "typedef SWIFT_ENUM_FWD_DECL("; - printer.print(ED->getRawType()); - os << ", " << getNameForObjC(ED) << ")\n"; - } else { - os << "enum " << getNameForObjC(ED) << " : "; - printer.print(ED->getRawType()); - os << ";\n"; - } + // Forward declare in a way to be compatible with older C standards. + os << "typedef SWIFT_ENUM_FWD_DECL("; + printer.print(ED->getRawType()); + os << ", " << getNameForObjC(ED) << ")\n"; }); } diff --git a/lib/PrintAsClang/PrintAsClang.cpp b/lib/PrintAsClang/PrintAsClang.cpp index 981b911fd4064..f741a8ba95043 100644 --- a/lib/PrintAsClang/PrintAsClang.cpp +++ b/lib/PrintAsClang/PrintAsClang.cpp @@ -220,20 +220,18 @@ static void writePrologue(raw_ostream &out, ASTContext &ctx, static_assert(SWIFT_MAX_IMPORTED_SIMD_ELEMENTS == 4, "need to add SIMD typedefs here if max elements is increased"); - if (ctx.LangOpts.hasFeature(Feature::CDecl)) { - // For C compilers which don’t support nullability attributes, ignore them; - // for ones which do, suppress warnings about them being an extension. - out << "#if !__has_feature(nullability)\n" - "# define _Nonnull\n" - "# define _Nullable\n" - "# define _Null_unspecified\n" - "#elif !defined(__OBJC__)\n" - "# pragma clang diagnostic ignored \"-Wnullability-extension\"\n" - "#endif\n" - "#if !__has_feature(nullability_nullable_result)\n" - "# define _Nullable_result _Nullable\n" - "#endif\n"; - } + // For C compilers which don’t support nullability attributes, ignore them; + // for ones which do, suppress warnings about them being an extension. + out << "#if !__has_feature(nullability)\n" + "# define _Nonnull\n" + "# define _Nullable\n" + "# define _Null_unspecified\n" + "#elif !defined(__OBJC__)\n" + "# pragma clang diagnostic ignored \"-Wnullability-extension\"\n" + "#endif\n" + "#if !__has_feature(nullability_nullable_result)\n" + "# define _Nullable_result _Nullable\n" + "#endif\n"; } static int compareImportModulesByName(const ImportModuleTy *left, @@ -618,7 +616,7 @@ bool swift::printAsClangHeader(raw_ostream &os, ModuleDecl *M, // C content (@c) std::string moduleContentsScratch; - if (M->getASTContext().LangOpts.hasFeature(Feature::CDecl)) { + { SmallPtrSet imports; llvm::raw_string_ostream cModuleContents{moduleContentsScratch}; printModuleContentsAsC(cModuleContents, imports, *M, interopContext, diff --git a/lib/Sema/TypeCheckAttr.cpp b/lib/Sema/TypeCheckAttr.cpp index f8352574796aa..a28fbe7e8ed8f 100644 --- a/lib/Sema/TypeCheckAttr.cpp +++ b/lib/Sema/TypeCheckAttr.cpp @@ -1841,9 +1841,6 @@ visitObjCImplementationAttr(ObjCImplementationAttr *attr) { } } else if (auto AFD = dyn_cast(D)) { - if (!hasObjCImplementationFeature(D, attr, Feature::CImplementation)) - return; - if (!attr->CategoryName.empty()) { auto diagnostic = diagnose(attr->getLocation(), diff --git a/lib/Sema/TypeCheckDeclObjC.cpp b/lib/Sema/TypeCheckDeclObjC.cpp index 8cd12c467d05a..9c91cb2bc25fe 100644 --- a/lib/Sema/TypeCheckDeclObjC.cpp +++ b/lib/Sema/TypeCheckDeclObjC.cpp @@ -222,17 +222,11 @@ static void diagnoseTypeNotRepresentableInObjC(const DeclContext *DC, // Special diagnostic for enums. if (T->is()) { - if (DC->getASTContext().LangOpts.hasFeature(Feature::CDecl)) { - // New dialog mentioning @c. - diags.diagnose(TypeRange.Start, diag::not_cdecl_or_objc_swift_enum, - language) - .highlight(TypeRange) - .limitBehavior(behavior); - } else { - diags.diagnose(TypeRange.Start, diag::not_objc_swift_enum) - .highlight(TypeRange) - .limitBehavior(behavior); - } + // New dialog mentioning @c. + diags.diagnose(TypeRange.Start, diag::not_cdecl_or_objc_swift_enum, + language) + .highlight(TypeRange) + .limitBehavior(behavior); return; } @@ -4193,10 +4187,6 @@ class ObjCImplementationChecker { !decl->getASTContext().LangOpts.hasFeature(Feature::ObjCImplementation)) return; - if (isa(decl) && - !decl->getASTContext().LangOpts.hasFeature(Feature::CImplementation)) - return; - auto diag = diagnose(getAttr()->getLocation(), diag::objc_implementation_early_spelling_deprecated); diag.fixItReplace(getAttr()->getRangeWithAt(), "@implementation"); diff --git a/test/ASTGen/attrs.swift b/test/ASTGen/attrs.swift index 7cd37f9b570c3..b266acf6de7cd 100644 --- a/test/ASTGen/attrs.swift +++ b/test/ASTGen/attrs.swift @@ -4,7 +4,6 @@ // RUN: -enable-experimental-feature Extern \ // RUN: -enable-experimental-feature Lifetimes \ // RUN: -enable-experimental-feature RawLayout \ -// RUN: -enable-experimental-feature CDecl \ // RUN: -enable-experimental-concurrency \ // RUN: -enable-experimental-move-only \ // RUN: -enable-experimental-feature ParserASTGen \ @@ -14,7 +13,6 @@ // RUN: -enable-experimental-feature Extern \ // RUN: -enable-experimental-feature Lifetimes \ // RUN: -enable-experimental-feature RawLayout \ -// RUN: -enable-experimental-feature CDecl \ // RUN: -enable-experimental-concurrency \ // RUN: -enable-experimental-move-only \ // RUN: | %sanitize-address > %t/cpp-parser.ast @@ -27,7 +25,6 @@ // RUN: -enable-experimental-feature Extern \ // RUN: -enable-experimental-feature Lifetimes \ // RUN: -enable-experimental-feature RawLayout \ -// RUN: -enable-experimental-feature CDecl \ // RUN: -enable-experimental-concurrency \ // RUN: -enable-experimental-move-only @@ -37,7 +34,6 @@ // REQUIRES: swift_feature_Extern // REQUIRES: swift_feature_Lifetimes // REQUIRES: swift_feature_RawLayout -// REQUIRES: swift_feature_CDecl // rdar://116686158 // UNSUPPORTED: asan diff --git a/test/IRGen/cdecl_implementation.swift b/test/IRGen/cdecl_implementation.swift index bdf6e1c9c50aa..960b123f0cc2a 100644 --- a/test/IRGen/cdecl_implementation.swift +++ b/test/IRGen/cdecl_implementation.swift @@ -1,15 +1,10 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ -// RUN: -enable-experimental-feature CImplementation \ -// RUN: -enable-experimental-feature CDecl \ // RUN: -disable-objc-interop \ // RUN: -F %clang-importer-sdk-path/frameworks %s \ // RUN: -import-objc-header %S/Inputs/objc_implementation.h -emit-ir \ // RUN: -target %target-future-triple > %t.ir // RUN: %FileCheck --input-file %t.ir %s -// REQUIRES: swift_feature_CImplementation -// REQUIRES: swift_feature_CDecl - @implementation @c public func implFunc(_ param: Int32) {} diff --git a/test/IRGen/objc_implementation.swift b/test/IRGen/objc_implementation.swift index 0350787bb679d..3c49f040cb458 100644 --- a/test/IRGen/objc_implementation.swift +++ b/test/IRGen/objc_implementation.swift @@ -1,11 +1,10 @@ // Test doesn't pass on all platforms (rdar://101420862) // REQUIRES: OS=macosx -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -enable-experimental-feature CImplementation -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks %s -import-objc-header %S/Inputs/objc_implementation.h -emit-ir -target %target-future-triple > %t.ir +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %S/Inputs/abi -F %clang-importer-sdk-path/frameworks %s -import-objc-header %S/Inputs/objc_implementation.h -emit-ir -target %target-future-triple > %t.ir // RUN: %FileCheck --input-file %t.ir %s // RUN: %FileCheck --input-file %t.ir --check-prefix NEGATIVE %s // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // CHECK-DAG: @"$sSo36ImplClassWithResilientStoredPropertyC19objc_implementationE9beforeInts5Int32VvpWvd" = hidden global i64 8, align 8 // CHECK-DAG: @"$sSo36ImplClassWithResilientStoredPropertyC19objc_implementationE6mirrors6MirrorVSgvpWvd" = hidden global i64 0, align 8 diff --git a/test/Interpreter/cdecl_enum_run.swift b/test/Interpreter/cdecl_enum_run.swift index 4b1af86b6f3a8..63840810c2a73 100644 --- a/test/Interpreter/cdecl_enum_run.swift +++ b/test/Interpreter/cdecl_enum_run.swift @@ -1,7 +1,6 @@ -// RUN: %target-run-simple-swift(-enable-experimental-feature CDecl) > %t.out +// RUN: %target-run-simple-swift > %t.out // RUN: %FileCheck --input-file %t.out %s -// REQUIRES: swift_feature_CDecl // REQUIRES: executable_test @c diff --git a/test/Interpreter/cdecl_implementation_run.swift b/test/Interpreter/cdecl_implementation_run.swift index bb0e889fbbcaf..0968b2bc11201 100644 --- a/test/Interpreter/cdecl_implementation_run.swift +++ b/test/Interpreter/cdecl_implementation_run.swift @@ -5,9 +5,7 @@ // RUN: %target-build-swift-dylib(%t/%target-library-name(Lib)) %t/Lib.swift \ // RUN: -emit-module-path %t/Lib.swiftmodule \ // RUN: -emit-clang-header-path %t/cdecl.h \ -// RUN: -import-objc-header %t/BridgingHeader.h \ -// RUN: -enable-experimental-feature CDecl \ -// RUN: -enable-experimental-feature CImplementation +// RUN: -import-objc-header %t/BridgingHeader.h // RUN: %target-codesign %t/%target-library-name(Lib) /// Build a C client against cdecl.h. @@ -25,8 +23,6 @@ // RUN: %target-run %t/a.out %t/%target-library-name(Lib) > %t/run.log // RUN: %FileCheck %t/Client.swift --check-prefix=PRINTS --input-file %t/run.log -// REQUIRES: swift_feature_CDecl -// REQUIRES: swift_feature_CImplementation // REQUIRES: executable_test //--- BridgingHeader.h diff --git a/test/Interpreter/cdecl_official_run.swift b/test/Interpreter/cdecl_official_run.swift index 52fbc2262d1c6..1113b850c09e5 100644 --- a/test/Interpreter/cdecl_official_run.swift +++ b/test/Interpreter/cdecl_official_run.swift @@ -6,8 +6,7 @@ // RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \ // RUN: -emit-clang-header-path %t/cdecl.h \ // RUN: -disable-implicit-string-processing-module-import \ -// RUN: -disable-implicit-concurrency-module-import \ -// RUN: -enable-experimental-feature CDecl +// RUN: -disable-implicit-concurrency-module-import /// Build and run a binary from Swift and C code. // RUN: %clang-no-modules -c %t/Client.c -o %t/Client.o -target %target-triple \ @@ -15,12 +14,11 @@ // RUN: %target-build-swift %t/Lib.swift %t/Client.o -O -o %t/a.out \ // RUN: -Xfrontend -disable-implicit-string-processing-module-import \ // RUN: -Xfrontend -disable-implicit-concurrency-module-import \ -// RUN: -enable-experimental-feature CDecl -parse-as-library +// RUN: -parse-as-library // RUN: %target-codesign %t/a.out // RUN: %target-run %t/a.out > %t/run.log // RUN: %FileCheck %s --input-file %t/run.log -// REQUIRES: swift_feature_CDecl // REQUIRES: executable_test //--- Lib.swift diff --git a/test/Interpreter/objc_implementation.swift b/test/Interpreter/objc_implementation.swift index 3323196661004..a59af5ee5dfc5 100644 --- a/test/Interpreter/objc_implementation.swift +++ b/test/Interpreter/objc_implementation.swift @@ -1,7 +1,6 @@ -// RUN: %target-run-simple-swift(-import-objc-header %S/Inputs/objc_implementation.h -D TOP_LEVEL_CODE -swift-version 5 -enable-experimental-feature CImplementation -target %target-stable-abi-triple) %s | %FileCheck %s +// RUN: %target-run-simple-swift(-import-objc-header %S/Inputs/objc_implementation.h -D TOP_LEVEL_CODE -swift-version 5 -target %target-stable-abi-triple) %s | %FileCheck %s // REQUIRES: executable_test // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation import Foundation diff --git a/test/Interpreter/objc_implementation_objc_client.m b/test/Interpreter/objc_implementation_objc_client.m index 13d7ae47877bf..c0afa2433b764 100644 --- a/test/Interpreter/objc_implementation_objc_client.m +++ b/test/Interpreter/objc_implementation_objc_client.m @@ -6,7 +6,7 @@ // RUN: %empty-directory(%t/objc_implementation.framework/Headers) // RUN: cp %S/Inputs/objc_implementation.modulemap %t/objc_implementation.framework/Modules/module.modulemap // RUN: cp %S/Inputs/objc_implementation.h %t/objc_implementation.framework/Headers -// RUN: %target-build-swift-dylib(%t/objc_implementation.framework/objc_implementation) -emit-module-path %t/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t -import-underlying-module -Xlinker -install_name -Xlinker @executable_path/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -enable-experimental-feature CImplementation -target %target-stable-abi-triple +// RUN: %target-build-swift-dylib(%t/objc_implementation.framework/objc_implementation) -emit-module-path %t/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t -import-underlying-module -Xlinker -install_name -Xlinker @executable_path/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -target %target-stable-abi-triple // // Execute this file @@ -22,7 +22,6 @@ // FIXME: This test fails in Swift CI simulators, but I have not been able to // reproduce this locally. // REQUIRES: OS=macosx -// REQUIRES: swift_feature_CImplementation #import #import diff --git a/test/Interpreter/objc_implementation_resilience.swift b/test/Interpreter/objc_implementation_resilience.swift index 0f9854d92d1eb..e169562ac6eb2 100644 --- a/test/Interpreter/objc_implementation_resilience.swift +++ b/test/Interpreter/objc_implementation_resilience.swift @@ -2,10 +2,9 @@ // Will not execute correctly without ObjC runtime support. // REQUIRES: rdar109171643 -// RUN: %target-run-simple-swift(-import-objc-header %S/Inputs/objc_implementation.h -D RESILIENCE -swift-version 5 -enable-experimental-feature CImplementation -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple %S/objc_implementation.swift) | %FileCheck %S/objc_implementation.swift --check-prefixes CHECK,CHECK-RESILIENCE +// RUN: %target-run-simple-swift(-import-objc-header %S/Inputs/objc_implementation.h -D RESILIENCE -swift-version 5 -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple %S/objc_implementation.swift) | %FileCheck %S/objc_implementation.swift --check-prefixes CHECK,CHECK-RESILIENCE // REQUIRES: executable_test // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_ObjCImplementationWithResilientStorage @main struct Main { diff --git a/test/Interpreter/objc_implementation_resilience_objc_client.m b/test/Interpreter/objc_implementation_resilience_objc_client.m index 6f55ba8bc4429..786915d46fd1b 100644 --- a/test/Interpreter/objc_implementation_resilience_objc_client.m +++ b/test/Interpreter/objc_implementation_resilience_objc_client.m @@ -12,7 +12,7 @@ // RUN: %empty-directory(%t-frameworks/objc_implementation.framework/Headers) // RUN: cp %S/Inputs/objc_implementation.modulemap %t-frameworks/objc_implementation.framework/Modules/module.modulemap // RUN: cp %S/Inputs/objc_implementation.h %t-frameworks/objc_implementation.framework/Headers -// RUN: %target-build-swift-dylib(%t-frameworks/objc_implementation.framework/objc_implementation) -emit-module-path %t-frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t-frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t-frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -D RESILIENCE -enable-experimental-feature CImplementation -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple +// RUN: %target-build-swift-dylib(%t-frameworks/objc_implementation.framework/objc_implementation) -emit-module-path %t-frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t-frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t-frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -D RESILIENCE -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple // // Execute this file // @@ -27,5 +27,4 @@ // FIXME: This test fails in Swift CI simulators, but I have not been able to // reproduce this locally. // REQUIRES: OS=macosx -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_ObjCImplementationWithResilientStorage diff --git a/test/Interpreter/objc_implementation_resilience_swift_client.swift b/test/Interpreter/objc_implementation_resilience_swift_client.swift index a22c6b1335082..2e4e5ec0cfb90 100644 --- a/test/Interpreter/objc_implementation_resilience_swift_client.swift +++ b/test/Interpreter/objc_implementation_resilience_swift_client.swift @@ -16,7 +16,7 @@ // RUN: %empty-directory(%t/frameworks/objc_implementation.framework/Headers) // RUN: cp %S/Inputs/objc_implementation.modulemap %t/frameworks/objc_implementation.framework/Modules/module.modulemap // RUN: cp %S/Inputs/objc_implementation.h %t/frameworks/objc_implementation.framework/Headers -// RUN: %target-build-swift-dylib(%t/frameworks/objc_implementation.framework/objc_implementation) -D RESILIENCE -enable-experimental-feature CImplementation -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple -emit-module-path %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t/frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t/frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift +// RUN: %target-build-swift-dylib(%t/frameworks/objc_implementation.framework/objc_implementation) -D RESILIENCE -enable-experimental-feature ObjCImplementationWithResilientStorage -target %target-future-triple -emit-module-path %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t/frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t/frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift // // Execute this file @@ -37,7 +37,6 @@ // REQUIRES: executable_test // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_ObjCImplementationWithResilientStorage @main struct Main { diff --git a/test/Interpreter/objc_implementation_swift_client.swift b/test/Interpreter/objc_implementation_swift_client.swift index 9ac0fcafce565..82de673b9345d 100644 --- a/test/Interpreter/objc_implementation_swift_client.swift +++ b/test/Interpreter/objc_implementation_swift_client.swift @@ -12,7 +12,7 @@ // RUN: %empty-directory(%t/frameworks/objc_implementation.framework/Headers) // RUN: cp %S/Inputs/objc_implementation.modulemap %t/frameworks/objc_implementation.framework/Modules/module.modulemap // RUN: cp %S/Inputs/objc_implementation.h %t/frameworks/objc_implementation.framework/Headers -// RUN: %target-build-swift-dylib(%t/frameworks/objc_implementation.framework/objc_implementation) -enable-experimental-feature CImplementation -emit-module-path %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t/frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t/frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -target %target-stable-abi-triple +// RUN: %target-build-swift-dylib(%t/frameworks/objc_implementation.framework/objc_implementation) -emit-module-path %t/frameworks/objc_implementation.framework/Modules/objc_implementation.swiftmodule/%module-target-triple.swiftmodule -module-name objc_implementation -F %t/frameworks -import-underlying-module -Xlinker -install_name -Xlinker %t/frameworks/objc_implementation.framework/objc_implementation %S/objc_implementation.swift -target %target-stable-abi-triple // // Execute this file @@ -33,7 +33,6 @@ // REQUIRES: executable_test // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation import Foundation import objc_implementation diff --git a/test/ModuleInterface/cdecl-swiftinterface.swift b/test/ModuleInterface/cdecl-swiftinterface.swift index 3e79e92f988f7..72de650c6c24d 100644 --- a/test/ModuleInterface/cdecl-swiftinterface.swift +++ b/test/ModuleInterface/cdecl-swiftinterface.swift @@ -4,9 +4,7 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: -emit-module %t/Lib.swift -o %t -I %t \ // RUN: -swift-version 6 -enable-library-evolution \ -// RUN: -emit-module-interface-path %t/Lib.swiftinterface \ -// RUN: -enable-experimental-feature CDecl \ -// RUN: -enable-experimental-feature CImplementation +// RUN: -emit-module-interface-path %t/Lib.swiftinterface // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -I %t \ // RUN: -typecheck-module-from-interface %t/Lib.swiftinterface @@ -14,8 +12,6 @@ // RUN: %FileCheck %s --input-file %t/Lib.swiftinterface // REQUIRES: objc_interop -// REQUIRES: swift_feature_CDecl -// REQUIRES: swift_feature_CImplementation //--- module.modulemap module Lib { diff --git a/test/PrintAsObjC/cdecl-enum-reference.swift b/test/PrintAsObjC/cdecl-enum-reference.swift index a2edabc00770b..f0e4a5fc54fa8 100644 --- a/test/PrintAsObjC/cdecl-enum-reference.swift +++ b/test/PrintAsObjC/cdecl-enum-reference.swift @@ -4,15 +4,13 @@ /// Build CoreLib defining a @c enum. // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %t/CoreLib.swift -emit-module -verify -o %t \ -// RUN: -emit-clang-header-path %t/CoreLib.h \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/CoreLib.h // RUN: %check-in-clang-c %t/CoreLib.h -I %t /// Build MiddleLib using the @c enum in API. // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %t/MiddleLib.swift -emit-module -verify -o %t -I %t \ -// RUN: -emit-clang-header-path %t/MiddleLib.h \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/MiddleLib.h // RUN: %FileCheck %s --input-file %t/MiddleLib.h // RUN: %check-in-clang-c %t/MiddleLib.h -I %t @@ -22,8 +20,6 @@ // RUN: -I %clang-include-dir -Werror \ // RUN: -isysroot %S/../Inputs/clang-importer-sdk -// REQUIRES: swift_feature_CDecl - //--- CoreLib.swift @c(CEnum) public enum CEnum: CInt { case A, B } diff --git a/test/PrintAsObjC/cdecl-enums.swift b/test/PrintAsObjC/cdecl-enums.swift index fa06c7c2d23c4..4aa6283d0b09b 100644 --- a/test/PrintAsObjC/cdecl-enums.swift +++ b/test/PrintAsObjC/cdecl-enums.swift @@ -6,14 +6,12 @@ // RUN: -emit-module -emit-module-doc -o %t %s \ // RUN: -import-objc-header %S/Inputs/enums.h \ // RUN: -emit-objc-header-path %t/enums.h \ -// RUN: -disable-objc-attr-requires-foundation-module \ -// RUN: -enable-experimental-feature CDecl +// RUN: -disable-objc-attr-requires-foundation-module // RUN: %FileCheck %s --input-file %t/enums.h // RUN: %FileCheck -check-prefix=NEGATIVE %s --input-file %t/enums.h // RUN: %check-in-clang %t/enums.h -// REQUIRES: swift_feature_CDecl // REQUIRES: objc_interop import Foundation diff --git a/test/PrintAsObjC/cdecl-includes-with-objc.swift b/test/PrintAsObjC/cdecl-includes-with-objc.swift index e72589cdd81c7..fcf3cfe573eed 100644 --- a/test/PrintAsObjC/cdecl-includes-with-objc.swift +++ b/test/PrintAsObjC/cdecl-includes-with-objc.swift @@ -6,8 +6,7 @@ /// Generate the compatibility header cdecl.h // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %t/Lib.swift \ // RUN: -emit-module -o %t -verify -F %t \ -// RUN: -emit-clang-header-path %t/cdecl.h \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/cdecl.h /// Check compatibility header directly // RUN: %FileCheck %s --input-file %t/cdecl.h @@ -15,7 +14,6 @@ // RUN: %check-in-clang-c %t/cdecl.h -F %t // RUN: %check-in-clang-cxx %t/cdecl.h -F %t -// REQUIRES: swift_feature_CDecl // REQUIRES: objc_interop //--- CFramework.framework/Modules/module.modulemap diff --git a/test/PrintAsObjC/cdecl-includes.swift b/test/PrintAsObjC/cdecl-includes.swift index 930d252e5029a..cfd429e1af3b5 100644 --- a/test/PrintAsObjC/cdecl-includes.swift +++ b/test/PrintAsObjC/cdecl-includes.swift @@ -9,8 +9,7 @@ // RUN: -emit-module -verify -o %t -I %t \ // RUN: -import-bridging-header %t/BridgingHeader.h \ // RUN: -emit-clang-header-path %t/cdecl.h \ -// RUN: -disable-objc-interop \ -// RUN: -enable-experimental-feature CDecl +// RUN: -disable-objc-interop /// Check compatibility header directly // RUN: %FileCheck %s --input-file %t/cdecl.h @@ -21,8 +20,6 @@ // RUN: %clang-no-modules -c %t/Client.c -I %t -Werror \ // RUN: -isysroot %S/../Inputs/clang-importer-sdk -// REQUIRES: swift_feature_CDecl - //--- module.modulemap module CModule { diff --git a/test/PrintAsObjC/cdecl-official-for-objc-clients.swift b/test/PrintAsObjC/cdecl-official-for-objc-clients.swift index 94be91e72f2c0..9edb239123b3e 100644 --- a/test/PrintAsObjC/cdecl-official-for-objc-clients.swift +++ b/test/PrintAsObjC/cdecl-official-for-objc-clients.swift @@ -6,8 +6,7 @@ /// Generate cdecl.h // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \ -// RUN: -emit-clang-header-path %t/cdecl.h \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/cdecl.h /// Check cdecl.h directly // RUN: %check-in-clang %t/cdecl.h @@ -19,5 +18,4 @@ // RUN: -I %clang-include-dir -Werror \ // RUN: -isysroot %S/../Inputs/clang-importer-sdk -// REQUIRES: swift_feature_CDecl // REQUIRES: objc_interop diff --git a/test/PrintAsObjC/cdecl-official-visibility.swift b/test/PrintAsObjC/cdecl-official-visibility.swift index 2ba59eb722e1a..01c78ba71e5ba 100644 --- a/test/PrintAsObjC/cdecl-official-visibility.swift +++ b/test/PrintAsObjC/cdecl-official-visibility.swift @@ -4,22 +4,18 @@ /// Generate cdecl.h for an app // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \ -// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg // RUN: %FileCheck %s --input-file %t/cdecl.h --check-prefixes PUBLIC-AND-INTERNAL,INTERNAL-ONLY // RUN: %check-in-clang-c %t/cdecl.h /// Generate cdecl.h for a library // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -parse-as-library \ // RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \ -// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/cdecl.h -package-name pkg // RUN: %FileCheck %s --input-file %t/cdecl.h --check-prefixes PUBLIC-AND-INTERNAL // RUN: %FileCheck %s --input-file %t/cdecl.h --implicit-check-not INTERNAL-ONLY // RUN: %check-in-clang-c %t/cdecl.h -// REQUIRES: swift_feature_CDecl - //--- Lib.swift @c private enum PrivateEnum: CInt { case A, B } diff --git a/test/PrintAsObjC/cdecl-official.swift b/test/PrintAsObjC/cdecl-official.swift index 4af4e92281f1b..3536f8e2aeb0c 100644 --- a/test/PrintAsObjC/cdecl-official.swift +++ b/test/PrintAsObjC/cdecl-official.swift @@ -4,8 +4,7 @@ /// Generate cdecl.h // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %t/Lib.swift -emit-module -verify -o %t -emit-module-doc \ -// RUN: -emit-clang-header-path %t/cdecl.h \ -// RUN: -enable-experimental-feature CDecl +// RUN: -emit-clang-header-path %t/cdecl.h /// Check cdecl.h directly // RUN: %FileCheck %s --input-file %t/cdecl.h @@ -17,8 +16,6 @@ // RUN: -I %clang-include-dir -Werror \ // RUN: -isysroot %S/../Inputs/clang-importer-sdk -// REQUIRES: swift_feature_CDecl - //--- Lib.swift // CHECK-NOT: assume_nonnull diff --git a/test/PrintAsObjC/cdecl-with-objc.swift b/test/PrintAsObjC/cdecl-with-objc.swift index 0dfe5f8c85cd7..8486fa88355d0 100644 --- a/test/PrintAsObjC/cdecl-with-objc.swift +++ b/test/PrintAsObjC/cdecl-with-objc.swift @@ -6,8 +6,7 @@ // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) \ // RUN: %s -emit-module -verify -o %t -emit-module-doc \ // RUN: -emit-objc-header-path %t/cdecl.h \ -// RUN: -disable-objc-attr-requires-foundation-module \ -// RUN: -enable-experimental-feature CDecl +// RUN: -disable-objc-attr-requires-foundation-module /// Check cdecl.h directly // RUN: %FileCheck %s --input-file %t/cdecl.h @@ -15,7 +14,6 @@ // RUN: %check-in-clang-c %t/cdecl.h -Wnullable-to-nonnull-conversion // RUN: %check-in-clang-cxx %t/cdecl.h -// REQUIRES: swift_feature_CDecl // REQUIRES: objc_interop @c(cFunc) diff --git a/test/PrintAsObjC/objc_implementation.swift b/test/PrintAsObjC/objc_implementation.swift index 951547f38b455..1026416d75b5b 100644 --- a/test/PrintAsObjC/objc_implementation.swift +++ b/test/PrintAsObjC/objc_implementation.swift @@ -1,7 +1,6 @@ // Please keep this file in alphabetical order! // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // Temporarily disable on arm64e (rdar://127675057) // UNSUPPORTED: CPU=arm64e @@ -15,8 +14,8 @@ // FIXME: END -enable-source-import hackaround -// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -enable-experimental-feature CImplementation -I %S/Inputs/custom-modules -import-underlying-module -o %t %s -disable-objc-attr-requires-foundation-module -target %target-stable-abi-triple -// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/objc_implementation.swiftmodule -typecheck -verify -emit-objc-header-path %t/objc_implementation-Swift.h -enable-experimental-feature CImplementation -I %S/Inputs/custom-modules -import-underlying-module -disable-objc-attr-requires-foundation-module -target %target-stable-abi-triple +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -I %S/Inputs/custom-modules -import-underlying-module -o %t %s -disable-objc-attr-requires-foundation-module -target %target-stable-abi-triple +// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -parse-as-library %t/objc_implementation.swiftmodule -typecheck -verify -emit-objc-header-path %t/objc_implementation-Swift.h -I %S/Inputs/custom-modules -import-underlying-module -disable-objc-attr-requires-foundation-module -target %target-stable-abi-triple // RUN: %FileCheck %s --input-file %t/objc_implementation-Swift.h // RUN: %FileCheck --check-prefix=NEGATIVE %s --input-file %t/objc_implementation-Swift.h // RUN: %check-in-clang -I %S/Inputs/custom-modules/ %t/objc_implementation-Swift.h diff --git a/test/SILGen/cdecl-official.swift b/test/SILGen/cdecl-official.swift index 9fa4477804481..34ec1666aa68d 100644 --- a/test/SILGen/cdecl-official.swift +++ b/test/SILGen/cdecl-official.swift @@ -1,11 +1,8 @@ // RUN: %empty-directory(%t) -// RUN: %target-swift-emit-silgen %s -module-name cdecl \ -// RUN: -enable-experimental-feature CDecl > %t/out.sil +// RUN: %target-swift-emit-silgen %s -module-name cdecl > %t/out.sil // RUN: %FileCheck %s -input-file %t/out.sil -// REQUIRES: swift_feature_CDecl - // CHECK-LABEL: sil hidden [asmname "pear"] [ossa] @$s5cdecl5appleyyS2iXCFTo : $@convention(c) (@convention(c) (Int) -> Int) -> () { @c(pear) func apple(_ f: @convention(c) (Int) -> Int) { } diff --git a/test/attr/attr_abi.swift b/test/attr/attr_abi.swift index df273414fb0e0..cda09f72eb53d 100644 --- a/test/attr/attr_abi.swift +++ b/test/attr/attr_abi.swift @@ -1,7 +1,6 @@ -// RUN: %target-typecheck-verify-swift -enable-experimental-feature Extern -enable-experimental-feature AddressableParameters -enable-experimental-feature NoImplicitCopy -enable-experimental-feature StrictMemorySafety -enable-experimental-feature Lifetimes -enable-experimental-feature CImplementation -import-bridging-header %S/Inputs/attr_abi.h -parse-as-library -debugger-support +// RUN: %target-typecheck-verify-swift -enable-experimental-feature Extern -enable-experimental-feature AddressableParameters -enable-experimental-feature NoImplicitCopy -enable-experimental-feature StrictMemorySafety -enable-experimental-feature Lifetimes -import-bridging-header %S/Inputs/attr_abi.h -parse-as-library -debugger-support // REQUIRES: swift_feature_AddressableParameters -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_Extern // REQUIRES: swift_feature_Lifetimes // REQUIRES: swift_feature_NoImplicitCopy diff --git a/test/attr/attr_cdecl_official.swift b/test/attr/attr_cdecl_official.swift index a167e4f8bc799..86083f616a356 100644 --- a/test/attr/attr_cdecl_official.swift +++ b/test/attr/attr_cdecl_official.swift @@ -2,9 +2,7 @@ /// This test shouldn't require the objc runtime. // RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s \ -// RUN: -enable-experimental-feature CDecl -disable-objc-interop - -// REQUIRES: swift_feature_CDecl +// RUN: -disable-objc-interop @c(cdecl_foo) func foo(x: Int) -> Int { return x } diff --git a/test/attr/attr_cdecl_official_async.swift b/test/attr/attr_cdecl_official_async.swift index efdc05f1b1eb6..c4d5fbfbb13ba 100644 --- a/test/attr/attr_cdecl_official_async.swift +++ b/test/attr/attr_cdecl_official_async.swift @@ -1,9 +1,7 @@ // RUN: %target-typecheck-verify-swift -enable-objc-interop \ -// RUN: -disable-availability-checking \ -// RUN: -enable-experimental-feature CDecl +// RUN: -disable-availability-checking // REQUIRES: concurrency -// REQUIRES: swift_feature_CDecl @_cdecl("async") // expected-error{{@_cdecl global function cannot be asynchronous}} func asynchronous() async { } diff --git a/test/attr/attr_cdecl_official_with_objc.swift b/test/attr/attr_cdecl_official_with_objc.swift index c25f48ecc0a45..3022aab0a7a55 100644 --- a/test/attr/attr_cdecl_official_with_objc.swift +++ b/test/attr/attr_cdecl_official_with_objc.swift @@ -1,7 +1,5 @@ -// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s \ -// RUN: -enable-experimental-feature CDecl +// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify %s -// REQUIRES: swift_feature_CDecl // REQUIRES: objc_interop import Foundation diff --git a/test/decl/ext/cdecl_implementation_features.swift b/test/decl/ext/cdecl_implementation_features.swift index 13638618e9aa7..57dff4d35d01b 100644 --- a/test/decl/ext/cdecl_implementation_features.swift +++ b/test/decl/ext/cdecl_implementation_features.swift @@ -1,10 +1,8 @@ // RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h > %t 2>&1 // RUN: %FileCheck --input-file %t --check-prefixes YES,CHECK %s -// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature CImplementation > %t 2>&1 +// RUN: not %target-swift-frontend(mock-sdk: %clang-importer-sdk-nosource) -typecheck %s -import-objc-header %S/Inputs/objc_implementation.h > %t 2>&1 // RUN: %FileCheck --input-file %t --check-prefixes YES,C,CHECK %s -// REQUIRES: swift_feature_CImplementation - // YES-DAG: cdecl_implementation_features.swift:[[@LINE+1]]:{{[0-9]+}}: warning: global function 'CImplFunc1' of type '(Double) -> ()' does not match type '(Int32) -> Void' declared by the header; this will become an error after adopting '@implementation' @_objcImplementation @_cdecl("CImplFunc1") func CImplFunc1(_: Double) {} diff --git a/test/decl/ext/cdecl_official_implementation.swift b/test/decl/ext/cdecl_official_implementation.swift index 87ddea64ccd72..28bd0bd6ba308 100644 --- a/test/decl/ext/cdecl_official_implementation.swift +++ b/test/decl/ext/cdecl_official_implementation.swift @@ -1,12 +1,7 @@ // RUN: %target-typecheck-verify-swift -target %target-stable-abi-triple \ // RUN: -import-bridging-header %S/Inputs/objc_implementation.h \ // RUN: -I %S/Inputs \ -// RUN: -disable-objc-interop \ -// RUN: -enable-experimental-feature CImplementation \ -// RUN: -enable-experimental-feature CDecl - -// REQUIRES: swift_feature_CImplementation -// REQUIRES: swift_feature_CDecl +// RUN: -disable-objc-interop import ToBeImplemented diff --git a/test/decl/ext/objc_implementation.swift b/test/decl/ext/objc_implementation.swift index e8a825db6e616..82f59cb1b7481 100644 --- a/test/decl/ext/objc_implementation.swift +++ b/test/decl/ext/objc_implementation.swift @@ -1,6 +1,5 @@ -// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature ObjCImplementation -enable-experimental-feature CImplementation -target %target-stable-abi-triple +// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature ObjCImplementation -target %target-stable-abi-triple // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_ObjCImplementation protocol EmptySwiftProto {} diff --git a/test/decl/ext/objc_implementation_early_adopter.swift b/test/decl/ext/objc_implementation_early_adopter.swift index 9bc67db7d342c..c8bd940ad9897 100644 --- a/test/decl/ext/objc_implementation_early_adopter.swift +++ b/test/decl/ext/objc_implementation_early_adopter.swift @@ -1,6 +1,5 @@ -// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature ObjCImplementation -enable-experimental-feature CImplementation -target %target-stable-abi-triple +// RUN: %target-typecheck-verify-swift -verify-ignore-unrelated -import-objc-header %S/Inputs/objc_implementation.h -enable-experimental-feature ObjCImplementation -target %target-stable-abi-triple // REQUIRES: objc_interop -// REQUIRES: swift_feature_CImplementation // REQUIRES: swift_feature_ObjCImplementation protocol EmptySwiftProto {} diff --git a/test/embedded/linkage/c.swift b/test/embedded/linkage/c.swift index f8cec3592f033..4bae5f05fc854 100644 --- a/test/embedded/linkage/c.swift +++ b/test/embedded/linkage/c.swift @@ -4,10 +4,8 @@ // REQUIRES: executable_test // REQUIRES: swift_feature_Embedded // REQUIRES: swift_feature_DeferredCodeGen -// REQUIRES: swift_feature_CDecl -// REQUIRES: swift_feature_CImplementation -// RUN: %target-swift-frontend -emit-ir -o - %s -I %S/Inputs -package-name MyPackage -enable-experimental-feature Embedded -enable-experimental-feature DeferredCodeGen -enable-experimental-feature CDecl -enable-experimental-feature CImplementation -parse-as-library | %FileCheck %s +// RUN: %target-swift-frontend -emit-ir -o - %s -I %S/Inputs -package-name MyPackage -enable-experimental-feature Embedded -enable-experimental-feature DeferredCodeGen -parse-as-library | %FileCheck %s import MyModuleExports