diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d802bbe9aa55..1a4d87027cb5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -760,10 +760,6 @@ option(SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP "Enable experimental C++ interop modules" TRUE) -option(SWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER - "Install the C++ interoperability header alongside compiler" - TRUE) - option(SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED "Enable experimental distributed actors and functions" FALSE) diff --git a/lib/ClangImporter/CMakeLists.txt b/lib/ClangImporter/CMakeLists.txt index 2eb5b1fa13116..36be1b409a126 100644 --- a/lib/ClangImporter/CMakeLists.txt +++ b/lib/ClangImporter/CMakeLists.txt @@ -49,7 +49,3 @@ add_dependencies(swiftClangImporter ${CLANG_TABLEGEN_TARGETS}) set_swift_llvm_is_available(swiftClangImporter) - -if(SWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER) - add_subdirectory(SwiftBridging) -endif() diff --git a/lib/ClangImporter/SwiftBridging/CMakeLists.txt b/lib/ClangImporter/SwiftBridging/CMakeLists.txt deleted file mode 100644 index d9e23774715aa..0000000000000 --- a/lib/ClangImporter/SwiftBridging/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -# Mark - copy "bridging" (support header) into the local include directory and -# install it into the compiler toolchain. - -add_custom_command( - OUTPUT "${SWIFT_INCLUDE_DIR}/swift/bridging" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/swift/bridging" - COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}/swift/bridging" "${SWIFT_INCLUDE_DIR}/swift") - -add_custom_target("copy_cxxInterop_support_header" - DEPENDS "${SWIFT_INCLUDE_DIR}/swift/bridging" - COMMENT "Copying C++ interop support header to ${SWIFT_INCLUDE_DIR}/swift") - -swift_install_in_component(FILES - "${CMAKE_CURRENT_SOURCE_DIR}/swift/bridging" - "${CMAKE_CURRENT_SOURCE_DIR}/swift/bridging.modulemap" - DESTINATION "include/swift" - COMPONENT compiler) -swift_install_in_component(FILES - "${CMAKE_CURRENT_SOURCE_DIR}/module.modulemap" - DESTINATION "include" - COMPONENT compiler) - -add_dependencies(swiftClangImporter - "copy_cxxInterop_support_header") \ No newline at end of file diff --git a/lib/ClangImporter/SwiftBridging/module.modulemap b/lib/ClangImporter/SwiftBridging/module.modulemap deleted file mode 100644 index 18bcfdcb160b1..0000000000000 --- a/lib/ClangImporter/SwiftBridging/module.modulemap +++ /dev/null @@ -1,13 +0,0 @@ -//===------------------ module.modulemap - C++ and Swift module -*- C++ -*-===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -extern module SwiftBridging "swift/bridging.modulemap" diff --git a/lib/ClangImporter/SwiftBridging/swift/bridging b/lib/ClangImporter/SwiftBridging/swift/bridging deleted file mode 100644 index b890b8060bf39..0000000000000 --- a/lib/ClangImporter/SwiftBridging/swift/bridging +++ /dev/null @@ -1,399 +0,0 @@ -// -*- C -*- -//===------------------ bridging - C and Swift Interop ----------*- C++ -*-===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// -// -// This file provides common utilities and annotations that are useful for C++ -// codebases that interoperate with Swift. -// -//===----------------------------------------------------------------------===// -#ifndef SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H -#define SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H - -#ifdef __has_attribute -#define _CXX_INTEROP_HAS_ATTRIBUTE(x) __has_attribute(x) -#else -#define _CXX_INTEROP_HAS_ATTRIBUTE(x) 0 -#endif - -#if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) - -/// Specifies that a C++ `class` or `struct` owns and controls the lifetime of all -/// of the objects it references. Such type should not reference any objects whose -/// lifetime is controlled externally. This annotation allows Swift to import methods -/// that return a `class` or `struct` type that is annotated with this macro. -#define SWIFT_SELF_CONTAINED __attribute__((swift_attr("import_owned"))) - -/// Specifies that a method returns a value that is presumed to contain -/// objects whose lifetime is not dependent on `this` or other parameters passed -/// to the method. -#define SWIFT_RETURNS_INDEPENDENT_VALUE __attribute__((swift_attr("import_unsafe"))) - -#define _CXX_INTEROP_STRINGIFY(_x) #_x - -#define _CXX_INTEROP_CONCAT_(a,b,c,d,e,f,g,i,j,k,l,m,n,o,p,...) \ - #a "," #b "," #c "," #d "," #e "," #f "," #g "," #i "," #j "," #k "," \ - #l "," #m "," #n "," #o "," #p -#define _CXX_INTEROP_CONCAT(...) \ - _CXX_INTEROP_CONCAT_(__VA_ARGS__,,,,,,,,,,,,,,,,,) - -/// Specifies that a `class` or `struct` is reference-counted using -/// the given `retain` and `release` functions. This annotation lets Swift import -/// such a type as reference counted type in Swift, taking advantage of Swift's -/// automatic reference counting. -/// -/// This example shows how to use this macro to let Swift know that -/// a reference counted C++ class can be imported as a reference counted type in Swift: -/// ```c++ -/// class SWIFT_SHARED_REFERENCE(retainSharedObject, releaseSharedObject) -/// SharedObject : IntrusiveReferenceCounted { -/// public: -/// static SharedObject* create(); -/// void doSomething(); -/// }; -/// -/// void retainSharedObject(SharedObject *); -/// void releaseSharedObject(SharedObject *); -/// ``` -/// -/// Then, the Swift programmer would be able to use it in the following manner: -/// -/// ```swift -/// let object = SharedObject.create() -/// object.doSomething() -/// // The Swift compiler will release object here. -/// ``` -#define SWIFT_SHARED_REFERENCE(_retain, _release) \ - __attribute__((swift_attr("import_reference"))) \ - __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(retain:_retain)))) \ - __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(release:_release)))) - -/// Specifies that a `class` or `struct` is a reference type whose lifetime -/// is presumed to be immortal, i.e. the reference to such object is presumed to -/// always be valid. This annotation lets Swift import such a type as a reference -/// type in Swift. -/// -/// This example shows how to use this macro to let Swift know that -/// a singleton C++ class can be imported as a reference type in Swift: -/// ```c++ -/// class SWIFT_IMMORTAL_REFERENCE LoggerSingleton { -/// public: -/// static LoggerSingleton &getInstance(); -/// void log(int x); -/// }; -/// ``` -/// -/// Then, the Swift programmer would be able to use it in the following manner: -/// -/// ```swift -/// let logger = LoggerSingleton.getInstance() -/// logger.log(123) -/// ``` -#define SWIFT_IMMORTAL_REFERENCE \ - __attribute__((swift_attr("import_reference"))) \ - __attribute__((swift_attr("retain:immortal"))) \ - __attribute__((swift_attr("release:immortal"))) - -/// Specifies that a `class` or `struct` is a reference type whose lifetime -/// is not managed automatically. The programmer must validate that any reference -/// to such object is valid themselves. This annotation lets Swift import such a type as a reference type in Swift. -#define SWIFT_UNSAFE_REFERENCE \ - __attribute__((swift_attr("import_reference"))) \ - __attribute__((swift_attr("retain:immortal"))) \ - __attribute__((swift_attr("release:immortal"))) \ - __attribute__((swift_attr("unsafe"))) - -/// This annotation makes smart pointers to intrusively reference counted -/// objects more ergonomic to use in Swift by: -/// -/// * introducing explicit conversions between the smart pointer type and -/// the underlying reference type and -/// * importing C++ APIs that return the smart pointer type or take it as a -/// parameter as returning or taking the underlying reference type. -/// -/// Place this annotation on a smart pointer class or struct. The argument -/// to the annotation names an accessor function, which can be a file-scope -/// function or (if prefixed by .) a member function of the smart pointer -/// class. The return type of the accessor function determines the underlying -/// reference type of the smart pointer; it must be a pointer to a class or -/// struct with the SWIFT_SHARED_REFERENCE annotation. Note that -/// SWIFT_SHARED_REFERENCE requires the underlying reference type -/// to provide independent retain and release operations; Swift does not -/// currently support this ergonomic import of smart pointers to objects -/// that can only be managed through a smart pointer class. -/// -/// The Swift importer will diagnose a class with this annotation as an -/// error if it cannot determine an underlying reference type. If the class -/// is templated, this applies to instantiations of the template, not to the -/// template pattern. (That is, it is okay to have a templated smart pointer -/// type as long as the concrete instantiations used in your C++ interface -/// all have determinable underlying reference types.) -/// -/// The smart pointer type is required to have a constructor that takes a raw -/// pointer. This constructor is expected to perform a retain of the object. -/// (In the +0 / +1 language of Objective-C reference counting, it would be -/// said to take the object at +0: it does not take responsibility for a retain -/// performed by its caller.) Generally, this kind of constructor matches with -/// object models where the object constructor initializes the reference -/// count to 0. -/// -/// The argument of this annotation is required to be the name of an -/// "accessor" method that returns a raw-pointer to the object. This method -/// is required to return a raw pointer to the object without changing the -/// reference count. -/// -/// Swift will define conversion operations using these functions to -/// convert between the raw pointer and the smart pointer representations. -/// -/// By default, smart pointer types are assumed to have a valid null state. -/// Passing a null pointer to the raw-pointer constructor will create a smart -/// pointer in the null state, and calling the raw-pointer accessor method -/// on a smart pointer in the null state will return a null pointer. In case the -/// constructor and the raw-pointer accessor are annotated with _Nonnull, we -/// assume the smart pointer does not have a null state. -/// -/// ```c++ -/// template -/// struct SWIFT_REFCOUNTED_PTR(.getPtr) Ptr { -/// Ptr(T* ptr); -/// T *_Nullable getPtr() const { return ptr; } -/// }; -/// -/// using PtrOfSharedRef = Ptr; -/// ``` -/// -/// In Swift, we can convert the smart pointer type to the corresponding native -/// Swift reference: -/// ```swift -/// func f(_ x: PtrOfSharedRef) { -/// let y = x.asReference -/// } -/// ``` -/// -/// Moreover, this annotation introduces implicit bridging for functions taking -/// or returning smart pointers by value: -/// ```c++ -/// PtrOfSharedRef foo(PtrOfSharedRef param); -/// ``` -/// Imported with the signature `func foo(_ param: SharedRef) -> SharedRef` -#define SWIFT_REFCOUNTED_PTR(_toRawPointer) \ - __attribute__((swift_attr( \ - "@_refCountedPtr(ToRawPointer: \"" _CXX_INTEROP_STRINGIFY(_toRawPointer) "\")"))) - -/// Specifies a name that will be used in Swift for this declaration instead of its original name. -#define SWIFT_NAME(_name) __attribute__((swift_name(#_name))) - -/// Specifies that a specific `class` or `struct` conforms to a -/// a specific Swift protocol. -/// -/// This example shows how to use this macro to conform a class template to a Swift protocol: -/// ``` -/// template -/// class SWIFT_CONFORMS_TO_PROTOCOL(SwiftModule.ProtocolName) -/// CustomClass {}; -/// ``` -#define SWIFT_CONFORMS_TO_PROTOCOL(_moduleName_protocolName) \ - __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(conforms_to:_moduleName_protocolName)))) - -/// Specifies that a specific C++ method should be imported as a computed -/// property. If this macro is specified on a getter, a getter will be -/// synthesized. If this macro is specified on a setter, both a getter and -/// setter will be synthesized. -/// -/// For example: -/// ``` -/// int getX() SWIFT_COMPUTED_PROPERTY; -/// ``` -/// Will be imported as `var x: CInt {...}`. -#define SWIFT_COMPUTED_PROPERTY \ - __attribute__((swift_attr("import_computed_property"))) - -/// Specifies that a specific **constant** C++ member function should be imported as -/// `mutating` Swift method. This annotation should be added to constant C++ member functions -/// that mutate `mutable` fields in a C++ object, to let Swift know that this function is still mutating -/// and thus that it should become a `mutating` method in Swift. -#define SWIFT_MUTATING \ - __attribute__((swift_attr("mutating"))) - -/// Specifies that a specific class or struct should be imported as type marked -/// as `@unchecked Sendable` type in swift. If this annotation is used, the type is therefore allowed to -/// use safely across async contexts. -/// -/// For example -/// ``` -/// class SWIFT_UNCHECKED_SENDABLE CustomUserType -/// { ... } -/// ``` -/// Will be imported as `struct CustomUserType: @unchecked Sendable` -#define SWIFT_UNCHECKED_SENDABLE \ - __attribute__((swift_attr("@Sendable"))) - -/// Specifies that a `class` or `struct` should be imported as a non-copyable -/// Swift value type. -#define SWIFT_NONCOPYABLE \ - __attribute__((swift_attr("~Copyable"))) - -/// Specifies that a `class` or `struct` should be imported as a non-copyable -/// Swift value type that calls the given `_destroy` function when a value is no -/// longer used. -/// -/// This example shows how to use this macro to let Swift know that -/// a given C struct should have its members freed when it goes out of scope: -/// ```c -/// typedef struct SWIFT_NONCOPYABLE_WITH_DESTROY(mytypeFreeMembers) MyType { -/// void *storage -/// } MyType; -/// -/// void mytypeFreeMembers(MyType toBeDestroyed); -/// MyType mytypeCreate(void); -/// ``` -/// -/// Usage in Swift: -/// ```swift -/// let mt = mytypeCreate() -/// let mt2 = mt // consumes mt -/// // once mt2 is unused, Swift will call mytypeFreeMembers(mt2) -/// ``` -#define SWIFT_NONCOPYABLE_WITH_DESTROY(_destroy) \ - __attribute__((swift_attr("~Copyable"))) \ - __attribute__((swift_attr(_CXX_INTEROP_STRINGIFY(destroy:_destroy)))) - -/// Specifies that a C++ `class` or `struct` should be imported as a copyable -/// Swift value if all of the specified template arguments are copyable. -#define SWIFT_COPYABLE_IF(...) \ - __attribute__((swift_attr("copyable_if:" _CXX_INTEROP_CONCAT(__VA_ARGS__)))) - -/// Specifies that a specific class or struct should be imported -/// as a non-escapable Swift value type. -#define SWIFT_NONESCAPABLE \ - __attribute__((swift_attr("~Escapable"))) - -/// Specifies that a specific class or struct should be imported -/// as an escapable Swift value. While this matches the default behavior, -/// in safe mode interop mode it ensures that the type is not marked as -/// unsafe. -#define SWIFT_ESCAPABLE \ - __attribute__((swift_attr("Escapable"))) - -/// Specifies that a C++ `class` or `struct` should be imported as a escapable -/// Swift value if all of the specified template arguments are escapable. -#define SWIFT_ESCAPABLE_IF(...) \ - __attribute__((swift_attr("escapable_if:" _CXX_INTEROP_CONCAT(__VA_ARGS__)))) - -/// Specifies that the return value is passed as owned for functions and -/// methods returning types annotated as `SWIFT_SHARED_REFERENCE` -#define SWIFT_RETURNS_RETAINED __attribute__((swift_attr("returns_retained"))) -/// Specifies that the return value is passed as unowned for functions and -/// methods returning types annotated as `SWIFT_SHARED_REFERENCE` -#define SWIFT_RETURNS_UNRETAINED \ - __attribute__((swift_attr("returns_unretained"))) - -/// Applied to a foreign reference type annotated with -/// SWIFT_SHARED_REFERENCE. Indicates that APIs returning this type are -/// assumed to return an unowned (+0) value by default, unless explicitly annotated -/// with SWIFT_RETURNS_RETAINED. -/// -/// For example: -/// ```c++ -/// struct SWIFT_SHARED_REFERENCE(retainBar, releaseBar) -/// SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT -/// Bar { ... }; -/// ``` -/// -/// In Swift, APIs returning `Bar*` will be assumed to return an unowned -/// value. -#define SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT \ - __attribute__((swift_attr("returned_as_unretained_by_default"))) - -/// Specifies that the non-public members of a C++ class, struct, or union can -/// be accessed from extensions of that type, in the given file ID. -/// -/// In other words, Swift's access controls will behave as if the non-public -/// members of the annotated C++ class were privated declared in the specified -/// Swift source file, rather than in a C++ header file/Clang module. -/// -/// For example, we can annotate a C++ class definition like this: -/// -/// ```c++ -/// class SWIFT_PRIVATE_FILEID("MySwiftModule/MySwiftFile.swift") -/// MyCxxClass { -/// private: -/// void privateMethod(); -/// int privateStorage; -/// }; -/// ``` -/// -/// Then, Swift extensions of `MyCxxClass` in `MySwiftModule/MySwiftFile.swift` -/// are allowed to access `privateMethod()` and `privateStorage`: -/// -/// ```swift -/// //-- MySwiftModule/SwiftFile.swift -/// extension MyCxxClass { -/// func ext() { -/// privateMethod() -/// print("\(privateStorage)") -/// } -/// } -/// ``` -/// -/// Non-public access is still forbidden outside of extensions and outside of -/// the designated file ID. -#define SWIFT_PRIVATE_FILEID(_fileID) \ - __attribute__((swift_attr("private_fileid:" _fileID))) - -/// A type or function annotated with SWIFT_UNSAFE will be imported as an unsafe -/// declaration into Swift. Using these declarations will trigger a warning in -/// strictly memory safe Swift. The 'unsafe' keyword can be used to suppress -/// these warnings. -#define SWIFT_UNSAFE __attribute__((swift_attr("unsafe"))) - -/// A type or function annotated with SWIFT_SAFE safely encapsulates some -/// unsafe behavior. Such declarations will be considered safe even if they have -/// unsafe constituents. -#define SWIFT_SAFE __attribute__((swift_attr("safe"))) - -/// Do not generate a safe wrapper overload function even if this function -/// contains annotations that would trigger it otherwise. -#define SWIFT_NO_SAFE_WRAPPER __attribute__((swift_attr("no_safe_wrapper"))) - -#else // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) - -// Empty defines for compilers that don't support `attribute(swift_attr)`. -#define SWIFT_SELF_CONTAINED -#define SWIFT_RETURNS_INDEPENDENT_VALUE -#define SWIFT_SHARED_REFERENCE(_retain, _release) -#define SWIFT_IMMORTAL_REFERENCE -#define SWIFT_UNSAFE_REFERENCE -#define SWIFT_REFCOUNTED_PTR(_toRawPointer) -#define SWIFT_NAME(_name) -#define SWIFT_CONFORMS_TO_PROTOCOL(_moduleName_protocolName) -#define SWIFT_COMPUTED_PROPERTY -#define SWIFT_MUTATING -#define SWIFT_UNCHECKED_SENDABLE -#define SWIFT_NONCOPYABLE -#define SWIFT_NONCOPYABLE_WITH_DESTROY(_destroy) -#define SWIFT_COPYABLE_IF(...) -#define SWIFT_NONESCAPABLE -#define SWIFT_ESCAPABLE -#define SWIFT_ESCAPABLE_IF(...) -#define SWIFT_RETURNS_RETAINED -#define SWIFT_RETURNS_UNRETAINED -#define SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT -#define SWIFT_PRIVATE_FILEID(_fileID) -#define SWIFT_UNSAFE -#define SWIFT_SAFE -#define SWIFT_NO_SAFE_WRAPPER - -#endif // #if _CXX_INTEROP_HAS_ATTRIBUTE(swift_attr) - -#undef _CXX_INTEROP_HAS_ATTRIBUTE - -#endif // SWIFT_CLANGIMPORTER_SWIFT_INTEROP_SUPPORT_H diff --git a/lib/ClangImporter/SwiftBridging/swift/bridging.modulemap b/lib/ClangImporter/SwiftBridging/swift/bridging.modulemap deleted file mode 100644 index 6bc6dcc26e609..0000000000000 --- a/lib/ClangImporter/SwiftBridging/swift/bridging.modulemap +++ /dev/null @@ -1,17 +0,0 @@ -//===------------------ module.modulemap - C++ and Swift module -*- C++ -*-===// -// -// This source file is part of the Swift.org open source project -// -// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors -// Licensed under Apache License v2.0 with Runtime Library Exception -// -// See https://swift.org/LICENSE.txt for license information -// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors -// -//===----------------------------------------------------------------------===// - -module SwiftBridging { - header "bridging" - - export * -} diff --git a/test/Interop/C/struct/noncopyable_structs.swift b/test/Interop/C/struct/noncopyable_structs.swift index e20c2e04c1184..1fc93d0af9799 100644 --- a/test/Interop/C/struct/noncopyable_structs.swift +++ b/test/Interop/C/struct/noncopyable_structs.swift @@ -1,17 +1,17 @@ // Check that we get the expected errors for incorrect uses of noncopyable // imported types with both C and C++ interoperability. -// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -verify -DERRORS -verify-additional-prefix conly- -// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -verify -DERRORS -DCPLUSPLUS -verify-additional-prefix cplusplus- -cxx-interoperability-mode=default +// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ %s -verify -DERRORS -verify-additional-prefix conly- +// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ %s -verify -DERRORS -DCPLUSPLUS -verify-additional-prefix cplusplus- -cxx-interoperability-mode=default // Check that we get the expected SIL -// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -o - | %FileCheck -check-prefix CHECK-SIL %s -// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -o - -cxx-interoperability-mode=default| %FileCheck -check-prefix CHECK-SIL %s +// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ %s -o - | %FileCheck -check-prefix CHECK-SIL %s +// RUN: %target-swift-frontend -emit-sil -I %S/Inputs/ %s -o - -cxx-interoperability-mode=default| %FileCheck -check-prefix CHECK-SIL %s // Check that we get the expected IR -// RUN: %target-swift-frontend -emit-ir -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -o - | %FileCheck -check-prefix CHECK-IR %s -// RUN: %target-swift-frontend -emit-ir -I %S/Inputs/ -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -o - -cxx-interoperability-mode=default | %FileCheck -check-prefix CHECK-IR %s +// RUN: %target-swift-frontend -emit-ir -I %S/Inputs/ %s -o - | %FileCheck -check-prefix CHECK-IR %s +// RUN: %target-swift-frontend -emit-ir -I %S/Inputs/ %s -o - -cxx-interoperability-mode=default | %FileCheck -check-prefix CHECK-IR %s import NoncopyableStructs diff --git a/test/Interop/C/swiftify-import/import-as-instance-method.swift b/test/Interop/C/swiftify-import/import-as-instance-method.swift index b0d773bf894b1..0beaf74d3c64e 100644 --- a/test/Interop/C/swiftify-import/import-as-instance-method.swift +++ b/test/Interop/C/swiftify-import/import-as-instance-method.swift @@ -4,10 +4,10 @@ // RUN: split-file %s %t // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/Test.swiftmodule -I %t%{fs-sep}Inputs -enable-experimental-feature SafeInteropWrappers -strict-memory-safety \ -// RUN: -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}instance.h %t/test.swift -I %bridging-path -DVERIFY +// RUN: -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}instance.h %t/test.swift -DVERIFY // RUN: %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/Test.swiftmodule -I %t%{fs-sep}Inputs -strict-memory-safety \ -// RUN: -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}instance.h %t/test.swift -I %bridging-path -DVERIFY -verify-additional-prefix nolifetimebound- -// RUN: env SWIFT_BACKTRACE="" %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/Test.swiftmodule -I %t/Inputs -enable-experimental-feature SafeInteropWrappers -strict-memory-safety -warnings-as-errors -Xcc -Werror %t/test.swift -dump-macro-expansions -I %bridging-path 2> %t/out.txt +// RUN: -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}instance.h %t/test.swift -DVERIFY -verify-additional-prefix nolifetimebound- +// RUN: env SWIFT_BACKTRACE="" %target-swift-frontend -emit-module -plugin-path %swift-plugin-dir -o %t/Test.swiftmodule -I %t/Inputs -enable-experimental-feature SafeInteropWrappers -strict-memory-safety -warnings-as-errors -Xcc -Werror %t/test.swift -dump-macro-expansions 2> %t/out.txt // RUN: diff --strip-trailing-cr %t/out.txt %t/out.expected //--- test.swift diff --git a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift index a17dc893b0bf6..307a75018d56b 100644 --- a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift +++ b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %target-swift-frontend -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -verify +// RUN: %target-swift-frontend -emit-ir -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -verify // REQUIRES: std_span diff --git a/test/Interop/Cxx/class/mutable-members-with-mutating-annotation-module-interface.swift b/test/Interop/Cxx/class/mutable-members-with-mutating-annotation-module-interface.swift index f3beb1c43710a..b5889d0be5668 100644 --- a/test/Interop/Cxx/class/mutable-members-with-mutating-annotation-module-interface.swift +++ b/test/Interop/Cxx/class/mutable-members-with-mutating-annotation-module-interface.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-ide-test -print-module -module-to-print=MutableMembers -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -Xcc -DUSE_MUTATING -I %swift_src_root/lib/ClangImporter/SwiftBridging | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=MutableMembers -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop -Xcc -DUSE_MUTATING | %FileCheck %s // CHECK: struct HasPublicMutableMember { // CHECK: var a: Int32 diff --git a/test/Interop/Cxx/class/noncopyable-irgen.swift b/test/Interop/Cxx/class/noncopyable-irgen.swift index d3538c4d32efa..4a99cafe00953 100644 --- a/test/Interop/Cxx/class/noncopyable-irgen.swift +++ b/test/Interop/Cxx/class/noncopyable-irgen.swift @@ -1,10 +1,10 @@ // RUN: %empty-directory(%t) // RUN: split-file %s %t -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST1- -D TEST1 -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST2- -D TEST2 -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST3- -D TEST3 -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST4- -D TEST4 -Xcc -DTEST4 -Xcc -std=c++20 -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST5- -D TEST5 +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST1- -D TEST1 +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST2- -D TEST2 +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST3- -D TEST3 +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST4- -D TEST4 -Xcc -DTEST4 -Xcc -std=c++20 +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -emit-ir -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -Xcc -fignore-exceptions -verify -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-additional-prefix TEST5- -D TEST5 //--- Inputs/module.modulemap module Test { diff --git a/test/Interop/Cxx/class/noncopyable-typechecker.swift b/test/Interop/Cxx/class/noncopyable-typechecker.swift index 4c487115babc1..382d016274add 100644 --- a/test/Interop/Cxx/class/noncopyable-typechecker.swift +++ b/test/Interop/Cxx/class/noncopyable-typechecker.swift @@ -1,7 +1,7 @@ // RUN: %empty-directory(%t) // RUN: split-file %s %t -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -typecheck -verify -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-ignore-unrelated -// RUN: %target-swift-frontend -cxx-interoperability-mode=default -Xcc -std=c++20 -verify-additional-prefix cpp20- -D CPP20 -typecheck -verify -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-ignore-unrelated +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -typecheck -verify -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-ignore-unrelated +// RUN: %target-swift-frontend -cxx-interoperability-mode=default -Xcc -std=c++20 -verify-additional-prefix cpp20- -D CPP20 -typecheck -verify -I %t%{fs-sep}Inputs %t%{fs-sep}test.swift -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}noncopyable.h -verify-ignore-unrelated //--- Inputs/module.modulemap module Test { diff --git a/test/Interop/Cxx/class/nonescapable-errors.swift b/test/Interop/Cxx/class/nonescapable-errors.swift index 45986f1503146..13919538cd1b1 100644 --- a/test/Interop/Cxx/class/nonescapable-errors.swift +++ b/test/Interop/Cxx/class/nonescapable-errors.swift @@ -2,7 +2,7 @@ // RUN: split-file %s %t // RUN: %target-swift-frontend -typecheck -verify %t%{fs-sep}test.swift \ -// RUN: -I %swift_src_root%{fs-sep}lib%{fs-sep}ClangImporter%{fs-sep}SwiftBridging -I %t%{fs-sep}Inputs \ +// RUN: -I %t%{fs-sep}Inputs \ // RUN: -cxx-interoperability-mode=default \ // RUN: -verify-ignore-unrelated \ // RUN: -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}nonescapable.h \ @@ -10,7 +10,7 @@ // RUN: -enable-experimental-feature LifetimeDependence // RUN: %target-swift-frontend -typecheck -verify %t%{fs-sep}test.swift \ -// RUN: -I %swift_src_root%{fs-sep}lib%{fs-sep}ClangImporter%{fs-sep}SwiftBridging -I %t%{fs-sep}Inputs \ +// RUN: -I %t%{fs-sep}Inputs \ // RUN: -cxx-interoperability-mode=default \ // RUN: -verify-ignore-unrelated \ // RUN: -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}nonescapable.h \ diff --git a/test/Interop/Cxx/class/nonescapable-lifetimebound.swift b/test/Interop/Cxx/class/nonescapable-lifetimebound.swift index 31101075cedf8..e8573221ce3bf 100644 --- a/test/Interop/Cxx/class/nonescapable-lifetimebound.swift +++ b/test/Interop/Cxx/class/nonescapable-lifetimebound.swift @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %target-swift-frontend -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t/Inputs -emit-sil %t/test.swift -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s -// RUN: %target-swift-frontend -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %t/Inputs -emit-sil %t/test.swift -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s +// RUN: %target-swift-frontend -I %t/Inputs -emit-sil %t/test.swift -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s +// RUN: %target-swift-frontend -I %t/Inputs -emit-sil %t/test.swift -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 | %FileCheck %s // REQUIRES: swift_feature_LifetimeDependence diff --git a/test/Interop/Cxx/class/nonescapable-smartptr-errors.swift b/test/Interop/Cxx/class/nonescapable-smartptr-errors.swift index 2682cf3fc133b..b7bb86396a7a8 100644 --- a/test/Interop/Cxx/class/nonescapable-smartptr-errors.swift +++ b/test/Interop/Cxx/class/nonescapable-smartptr-errors.swift @@ -2,7 +2,7 @@ // RUN: split-file %s %t // RUN: %target-swift-frontend -typecheck -verify %t%{fs-sep}test.swift \ -// RUN: -I %swift_src_root%{fs-sep}lib%{fs-sep}ClangImporter%{fs-sep}SwiftBridging -I %t%{fs-sep}Inputs \ +// RUN: -I %t%{fs-sep}Inputs \ // RUN: -cxx-interoperability-mode=default \ // RUN: -verify-ignore-unrelated \ // RUN: -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}nonescapable.h \ @@ -10,7 +10,7 @@ // RUN: -enable-experimental-feature LifetimeDependence // RUN: %target-swift-frontend -typecheck -verify %t%{fs-sep}test.swift \ -// RUN: -I %swift_src_root%{fs-sep}lib%{fs-sep}ClangImporter%{fs-sep}SwiftBridging -I %t%{fs-sep}Inputs \ +// RUN: -I %t%{fs-sep}Inputs \ // RUN: -cxx-interoperability-mode=default \ // RUN: -verify-ignore-unrelated \ // RUN: -verify-additional-file %t%{fs-sep}Inputs%{fs-sep}nonescapable.h \ diff --git a/test/Interop/Cxx/class/safe-interop-mode-darwin.swift b/test/Interop/Cxx/class/safe-interop-mode-darwin.swift index 6f7de581e863c..25be0520cb757 100644 --- a/test/Interop/Cxx/class/safe-interop-mode-darwin.swift +++ b/test/Interop/Cxx/class/safe-interop-mode-darwin.swift @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %target-swift-frontend -typecheck -verify -I %swift_src_root/lib/ClangImporter/SwiftBridging -Xcc -std=c++20 -I %t/Inputs %t/test.swift -strict-memory-safety -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 +// RUN: %target-swift-frontend -typecheck -verify -Xcc -std=c++20 -I %t/Inputs %t/test.swift -strict-memory-safety -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm 2>&1 // REQUIRES: objc_interop // REQUIRES: swift_feature_LifetimeDependence diff --git a/test/Interop/Cxx/class/safe-interop-mode.swift b/test/Interop/Cxx/class/safe-interop-mode.swift index 3f3ee647047ce..38614ce4fea3c 100644 --- a/test/Interop/Cxx/class/safe-interop-mode.swift +++ b/test/Interop/Cxx/class/safe-interop-mode.swift @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: split-file %s %t -// RUN: %target-swift-frontend -typecheck -verify -I %swift_src_root/lib/ClangImporter/SwiftBridging -Xcc -iapinotes-modules -Xcc %swift_src_root/stdlib/public/Cxx/std -Xcc -std=c++20 -I %t/Inputs %t/test.swift -strict-memory-safety -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm -plugin-path %swift-plugin-dir 2>&1 +// RUN: %target-swift-frontend -typecheck -verify -Xcc -iapinotes-modules -Xcc %swift_src_root/stdlib/public/Cxx/std -Xcc -std=c++20 -I %t/Inputs %t/test.swift -strict-memory-safety -enable-experimental-feature LifetimeDependence -cxx-interoperability-mode=default -diagnostic-style llvm -plugin-path %swift-plugin-dir 2>&1 // REQUIRES: objc_interop // REQUIRES: swift_feature_LifetimeDependence diff --git a/test/Interop/Cxx/class/suppressible-module-interface.swift b/test/Interop/Cxx/class/suppressible-module-interface.swift index 59feb28093202..921e1b7f382c7 100644 --- a/test/Interop/Cxx/class/suppressible-module-interface.swift +++ b/test/Interop/Cxx/class/suppressible-module-interface.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-ide-test -print-module -module-to-print=SuppressibleProtocols -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=SuppressibleProtocols -I %S/Inputs -source-filename=x -cxx-interoperability-mode=default | %FileCheck %s // CHECK: struct View : ~Escapable { // CHECK: struct Noncopyable : ~Copyable { diff --git a/test/Interop/Cxx/ergonomics/swift-bridging-annotations.swift b/test/Interop/Cxx/ergonomics/swift-bridging-annotations.swift index 76336400ec295..013555d95e3fd 100644 --- a/test/Interop/Cxx/ergonomics/swift-bridging-annotations.swift +++ b/test/Interop/Cxx/ergonomics/swift-bridging-annotations.swift @@ -4,19 +4,19 @@ // RUN: %target-swift-frontend %t/SwiftMod.swift -module-name SwiftMod -emit-module -o %t/SwiftMod.swiftmodule -I %t -enable-experimental-cxx-interop -Xcc -DFIRSTPASS -// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s -// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -source-filename=x -enable-experimental-cxx-interop -Xcc -DINCMOD | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -source-filename=x -enable-experimental-cxx-interop -Xcc -DINCMOD | %FileCheck %s -// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -source-filename=x -cxx-interoperability-mode=swift-6 -Xcc -DINCMOD | %FileCheck --check-prefixes=CHECK,CHECKLATEST %s -// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -source-filename=x -cxx-interoperability-mode=upcoming-swift -Xcc -DINCMOD | %FileCheck --check-prefixes=CHECK,CHECKLATEST %s +// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -source-filename=x -cxx-interoperability-mode=swift-6 -Xcc -DINCMOD | %FileCheck --check-prefixes=CHECK,CHECKLATEST %s +// RUN: %target-swift-ide-test -print-module -module-to-print=SwiftMod -module-to-print=CxxModule -I %t -I %t/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift -Xcc -DINCMOD | %FileCheck --check-prefixes=CHECK,CHECKLATEST %s // Test through the use of the bridging header -// RUN: %target-swift-frontend -emit-ir -I %t -import-objc-header %t/Inputs/header.h -I %swift_src_root/lib/ClangImporter/SwiftBridging -enable-experimental-cxx-interop -DBRIDGING_HEADER_TEST -disable-availability-checking %t/SwiftMod.swift +// RUN: %target-swift-frontend -emit-ir -I %t -import-objc-header %t/Inputs/header.h -enable-experimental-cxx-interop -DBRIDGING_HEADER_TEST -disable-availability-checking %t/SwiftMod.swift // Precompile the bridging header and test the use of that. -// RUN: %target-swift-frontend -emit-pch -I %t -pch-output-dir %t/pch %t/Inputs/header.h -I %swift_src_root/lib/ClangImporter/SwiftBridging -enable-experimental-cxx-interop -// RUN: %target-swift-frontend -emit-ir -I %t -pch-output-dir %t/pch -import-objc-header %t/Inputs/header.h -I %swift_src_root/lib/ClangImporter/SwiftBridging -enable-experimental-cxx-interop -DBRIDGING_HEADER_TEST -disable-availability-checking %t/SwiftMod.swift +// RUN: %target-swift-frontend -emit-pch -I %t -pch-output-dir %t/pch %t/Inputs/header.h -enable-experimental-cxx-interop +// RUN: %target-swift-frontend -emit-ir -I %t -pch-output-dir %t/pch -import-objc-header %t/Inputs/header.h -enable-experimental-cxx-interop -DBRIDGING_HEADER_TEST -disable-availability-checking %t/SwiftMod.swift //--- SwiftMod.swift diff --git a/test/Interop/Cxx/foreign-reference/array-of-classes.swift b/test/Interop/Cxx/foreign-reference/array-of-classes.swift index ad8341d8ebfc0..69a4753af5c27 100644 --- a/test/Interop/Cxx/foreign-reference/array-of-classes.swift +++ b/test/Interop/Cxx/foreign-reference/array-of-classes.swift @@ -1,6 +1,6 @@ // RUN: %empty-directory(%t) // RUN: split-file %s %t -// RUN: %swiftc_driver -O -I %t/Inputs %t/test.swift -cxx-interoperability-mode=default -I %swift_src_root/lib/ClangImporter/SwiftBridging -o %t/a.out +// RUN: %swiftc_driver -O -I %t/Inputs %t/test.swift -cxx-interoperability-mode=default -o %t/a.out // RUN: %target-codesign %t/a.out // RUN: %target-run %t/a.out | %FileCheck %s diff --git a/test/Interop/Cxx/foreign-reference/frt-non-primary-base.swift b/test/Interop/Cxx/foreign-reference/frt-non-primary-base.swift index 47d614b19a7e2..8fa6b5a61ef13 100644 --- a/test/Interop/Cxx/foreign-reference/frt-non-primary-base.swift +++ b/test/Interop/Cxx/foreign-reference/frt-non-primary-base.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s +// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s // REQUIRES: executable_test diff --git a/test/Interop/Cxx/foreign-reference/frts-as-fields.swift b/test/Interop/Cxx/foreign-reference/frts-as-fields.swift index b25fcbc2840aa..1c0a2fe87d7ed 100644 --- a/test/Interop/Cxx/foreign-reference/frts-as-fields.swift +++ b/test/Interop/Cxx/foreign-reference/frts-as-fields.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s +// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s // REQUIRES: executable_test diff --git a/test/Interop/Cxx/foreign-reference/get-frt-from-smart-ptr.swift b/test/Interop/Cxx/foreign-reference/get-frt-from-smart-ptr.swift index 3020e8fd55d91..e61087cf90b10 100644 --- a/test/Interop/Cxx/foreign-reference/get-frt-from-smart-ptr.swift +++ b/test/Interop/Cxx/foreign-reference/get-frt-from-smart-ptr.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -O) | %FileCheck %s +// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -O) | %FileCheck %s // REQUIRES: executable_test diff --git a/test/Interop/Cxx/foreign-reference/move-only-in-virtual-methods.swift b/test/Interop/Cxx/foreign-reference/move-only-in-virtual-methods.swift index 7c9068792ebc4..f1ee3ef56773e 100644 --- a/test/Interop/Cxx/foreign-reference/move-only-in-virtual-methods.swift +++ b/test/Interop/Cxx/foreign-reference/move-only-in-virtual-methods.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -cxx-interoperability-mode=default -disable-availability-checking +// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs %s -cxx-interoperability-mode=default -disable-availability-checking import VirtMethodWitMoveOnly diff --git a/test/Interop/Cxx/foreign-reference/refcounted-smartpointer-errors.swift b/test/Interop/Cxx/foreign-reference/refcounted-smartpointer-errors.swift index a159c9051cdbb..947392ee54550 100644 --- a/test/Interop/Cxx/foreign-reference/refcounted-smartpointer-errors.swift +++ b/test/Interop/Cxx/foreign-reference/refcounted-smartpointer-errors.swift @@ -1,4 +1,4 @@ -// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default -disable-availability-checking -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S%{fs-sep}Inputs -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounted-smartptrs.h +// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default -disable-availability-checking -I %S%{fs-sep}Inputs -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounted-smartptrs.h import RefCountedSmartPtrs func triggerWarnings(_ a: errors.MissingToRawPtr, // @expected-error {{'MissingToRawPtr' is not a member type of enum '__ObjC.errors'}} diff --git a/test/Interop/Cxx/foreign-reference/refcounted-smartpointers-interface.swift b/test/Interop/Cxx/foreign-reference/refcounted-smartpointers-interface.swift index 9ee8d2d727ab5..6edbfa8645e45 100644 --- a/test/Interop/Cxx/foreign-reference/refcounted-smartpointers-interface.swift +++ b/test/Interop/Cxx/foreign-reference/refcounted-smartpointers-interface.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-ide-test -print-module -module-to-print=RefCountedSmartPtrs -I %S/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=RefCountedSmartPtrs -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s // CHECK: func bridgedFunction(_ ptr: RefCountedBase) // CHECK: func bridgedFunction2(_ ptr: RefCountedBase?) diff --git a/test/Interop/Cxx/foreign-reference/refcounted-smartpointers.swift b/test/Interop/Cxx/foreign-reference/refcounted-smartpointers.swift index 4ffd759eb47a4..dc551d2d0d355 100644 --- a/test/Interop/Cxx/foreign-reference/refcounted-smartpointers.swift +++ b/test/Interop/Cxx/foreign-reference/refcounted-smartpointers.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s +// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -Onone) | %FileCheck %s // REQUIRES: executable_test diff --git a/test/Interop/Cxx/foreign-reference/refcounting-methods-executable.swift b/test/Interop/Cxx/foreign-reference/refcounting-methods-executable.swift index 28beff90eb591..41554f9fc8944 100644 --- a/test/Interop/Cxx/foreign-reference/refcounting-methods-executable.swift +++ b/test/Interop/Cxx/foreign-reference/refcounting-methods-executable.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -I %swift_src_root/lib/ClangImporter/SwiftBridging -Xfrontend -disable-availability-checking) +// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=upcoming-swift -Xfrontend -disable-availability-checking) // REQUIRES: executable_test diff --git a/test/Interop/Cxx/foreign-reference/refcounting-methods-module-interface.swift b/test/Interop/Cxx/foreign-reference/refcounting-methods-module-interface.swift index dc08aad6e99cd..70cca2008ae4f 100644 --- a/test/Interop/Cxx/foreign-reference/refcounting-methods-module-interface.swift +++ b/test/Interop/Cxx/foreign-reference/refcounting-methods-module-interface.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-ide-test -print-module -cxx-interoperability-mode=upcoming-swift -I %swift_src_root/lib/ClangImporter/SwiftBridging -module-to-print=RefCountingMethods -I %S/Inputs -source-filename=x | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -cxx-interoperability-mode=upcoming-swift -module-to-print=RefCountingMethods -I %S/Inputs -source-filename=x | %FileCheck %s // CHECK: class RefCountedBox { // CHECK: func doRetain() diff --git a/test/Interop/Cxx/foreign-reference/refcounting-methods-typechecker.swift b/test/Interop/Cxx/foreign-reference/refcounting-methods-typechecker.swift index dfff04f9409fe..26e29a1ce49bc 100644 --- a/test/Interop/Cxx/foreign-reference/refcounting-methods-typechecker.swift +++ b/test/Interop/Cxx/foreign-reference/refcounting-methods-typechecker.swift @@ -1,4 +1,4 @@ -// RUN: %target-typecheck-verify-swift -Xcc -DINCORRECT -I %S%{fs-sep}Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounting-methods.h -cxx-interoperability-mode=upcoming-swift -disable-availability-checking +// RUN: %target-typecheck-verify-swift -Xcc -DINCORRECT -I %S%{fs-sep}Inputs -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounting-methods.h -cxx-interoperability-mode=upcoming-swift -disable-availability-checking import RefCountingMethods diff --git a/test/Interop/Cxx/foreign-reference/reference-in-virtual-methods.swift b/test/Interop/Cxx/foreign-reference/reference-in-virtual-methods.swift index 18fcd3bc13d02..2bda1d184bff9 100644 --- a/test/Interop/Cxx/foreign-reference/reference-in-virtual-methods.swift +++ b/test/Interop/Cxx/foreign-reference/reference-in-virtual-methods.swift @@ -1,4 +1,4 @@ -// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs -I %swift_src_root/lib/ClangImporter/SwiftBridging %s -cxx-interoperability-mode=default -disable-availability-checking +// RUN: %target-swift-frontend -typecheck -verify -I %S/Inputs %s -cxx-interoperability-mode=default -disable-availability-checking import VirtMethodWithRvalRef diff --git a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-module-interface.swift b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-module-interface.swift index 3b2403db827d1..adf93c824e5dd 100644 --- a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-module-interface.swift +++ b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-module-interface.swift @@ -1,6 +1,6 @@ -// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -enable-experimental-cxx-interop -module-cache-path %t -I %swift_src_root/lib/ClangImporter/SwiftBridging | %FileCheck %s -// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -cxx-interoperability-mode=swift-6 -module-cache-path %t -I %swift_src_root/lib/ClangImporter/SwiftBridging | %FileCheck %s -// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -cxx-interoperability-mode=upcoming-swift -module-cache-path %t -I %swift_src_root/lib/ClangImporter/SwiftBridging | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -enable-experimental-cxx-interop -module-cache-path %t | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -cxx-interoperability-mode=swift-6 -module-cache-path %t | %FileCheck %s +// RUN: %target-swift-ide-test -print-module -module-to-print=CustomBorrowingSequence -source-filename=x -I %S/Inputs -cxx-interoperability-mode=upcoming-swift -module-cache-path %t | %FileCheck %s // CHECK: struct SimpleNonCopyableSequence : ~Copyable, CxxBorrowingSequence { // CHECK: typealias Element = ConstIterator.Pointee diff --git a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-typechecker.swift b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-typechecker.swift index 159e4e2c1a6d9..ed5261deb2001 100644 --- a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-typechecker.swift +++ b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence-typechecker.swift @@ -1,4 +1,4 @@ -// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -enable-experimental-cxx-interop -I %swift_src_root/lib/ClangImporter/SwiftBridging -disable-availability-checking +// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -enable-experimental-cxx-interop -disable-availability-checking import CustomBorrowingSequence diff --git a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence.swift b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence.swift index 253cb8009151e..2d1cfd9e3be51 100644 --- a/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence.swift +++ b/test/Interop/Cxx/stdlib/overlay/custom-borrowing-sequence.swift @@ -1,4 +1,4 @@ -// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=default -I %swift_src_root/lib/ClangImporter/SwiftBridging -Xcc -std=c++20) +// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=default -Xcc -std=c++20) // // REQUIRES: executable_test // Ubuntu 20.04 ships with an old version of libstdc++, which does not provide diff --git a/test/Interop/lit.local.cfg b/test/Interop/lit.local.cfg index 448a58d4fc3b8..733b4de7f5400 100644 --- a/test/Interop/lit.local.cfg +++ b/test/Interop/lit.local.cfg @@ -101,5 +101,3 @@ config.substitutions.insert(0, ( r'%check-c-header-in-clang -std=c11 -Wno-padded -Wno-c++-keyword -Wno-unknown-warning-option -Wno-pre-c11-compat \1' ) )) - -config.substitutions.insert(0, ('%bridging-path', '%swift_src_root%{fs-sep}lib%{fs-sep}ClangImporter%{fs-sep}SwiftBridging')) diff --git a/utils/build_swift/build_swift/driver_arguments.py b/utils/build_swift/build_swift/driver_arguments.py index 51d1d6ad5603b..13f48e3429de3 100644 --- a/utils/build_swift/build_swift/driver_arguments.py +++ b/utils/build_swift/build_swift/driver_arguments.py @@ -1559,10 +1559,6 @@ def create_argument_parser(): default=True, help='Enable experimental C++ interop.') - option('--enable-cxx-interop-swift-bridging-header', toggle_true, - default=True, - help='Ship the header for C++ interop') - option('--enable-experimental-distributed', toggle_true, default=True, help='Enable experimental Swift distributed actors.') diff --git a/utils/build_swift/tests/expected_options.py b/utils/build_swift/tests/expected_options.py index e811119543f51..898b71a1851cd 100644 --- a/utils/build_swift/tests/expected_options.py +++ b/utils/build_swift/tests/expected_options.py @@ -191,7 +191,6 @@ 'enable_experimental_differentiable_programming': True, 'enable_experimental_concurrency': True, 'enable_experimental_cxx_interop': True, - 'enable_cxx_interop_swift_bridging_header': True, 'enable_experimental_distributed': True, 'enable_experimental_string_processing': True, 'enable_experimental_observation': True, @@ -653,7 +652,6 @@ class BuildScriptImplOption(_BaseOption): EnableOption('--enable-experimental-differentiable-programming'), EnableOption('--enable-experimental-concurrency'), EnableOption('--enable-experimental-cxx-interop'), - EnableOption('--enable-cxx-interop-swift-bridging-header'), EnableOption('--enable-experimental-distributed'), EnableOption('--enable-experimental-string-processing'), EnableOption('--enable-experimental-observation'), diff --git a/utils/swift_build_support/swift_build_support/products/swift.py b/utils/swift_build_support/swift_build_support/products/swift.py index 80fb099da8b29..206aaffa2ab88 100644 --- a/utils/swift_build_support/swift_build_support/products/swift.py +++ b/utils/swift_build_support/swift_build_support/products/swift.py @@ -59,7 +59,6 @@ def __init__(self, args, toolchain, source_dir, build_dir): # Add experimental cxx interop flags. self.cmake_options.extend(self._enable_experimental_cxx_interop) - self.cmake_options.extend(self._enable_cxx_interop_swift_bridging_header) # Add experimental distributed flag. self.cmake_options.extend(self._enable_experimental_distributed) @@ -225,11 +224,6 @@ def _enable_experimental_cxx_interop(self): return [('SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL', self.args.enable_experimental_cxx_interop)] - @property - def _enable_cxx_interop_swift_bridging_header(self): - return [('SWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL', - self.args.enable_cxx_interop_swift_bridging_header)] - @property def _enable_experimental_distributed(self): return [('SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL', diff --git a/utils/swift_build_support/tests/products/test_swift.py b/utils/swift_build_support/tests/products/test_swift.py index 5d4c9def75895..25bd3501ff844 100644 --- a/utils/swift_build_support/tests/products/test_swift.py +++ b/utils/swift_build_support/tests/products/test_swift.py @@ -57,7 +57,6 @@ def setUp(self): enable_experimental_differentiable_programming=False, enable_experimental_concurrency=False, enable_experimental_cxx_interop=False, - enable_cxx_interop_swift_bridging_header=False, enable_experimental_distributed=False, enable_experimental_observation=False, enable_experimental_parser_validation=False, @@ -113,7 +112,6 @@ def test_by_default_no_cmake_options(self): '-DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL=FALSE', - '-DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE', @@ -155,7 +153,6 @@ def test_swift_runtime_tsan(self): '-DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL=FALSE', - '-DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL=FALSE', '-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE', @@ -417,18 +414,6 @@ def test_experimental_cxx_interop_flags(self): [option for option in swift.cmake_options if 'DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP' in option]) - def test_experimental_cxx_interop_bridging_header_flags(self): - self.args.enable_cxx_interop_swift_bridging_header = True - swift = Swift( - args=self.args, - toolchain=self.toolchain, - source_dir='/path/to/src', - build_dir='/path/to/build') - self.assertEqual( - ['-DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER:BOOL=TRUE'], - [option for option in swift.cmake_options - if 'DSWIFT_ENABLE_CXX_INTEROP_SWIFT_BRIDGING_HEADER' in option]) - def test_experimental_distributed_flags(self): self.args.enable_experimental_distributed = True swift = Swift(