diff --git a/lib/AST/SwiftNameTranslation.cpp b/lib/AST/SwiftNameTranslation.cpp index ce5e512e035..0e0653dd059 100644 --- a/lib/AST/SwiftNameTranslation.cpp +++ b/lib/AST/SwiftNameTranslation.cpp @@ -163,6 +163,10 @@ swift::cxx_translation::getNameForCxx(const ValueDecl *VD, if (customNamesOnly) return StringRef(); + if (auto *mod = dyn_cast(VD)) { + if (mod->isStdlibModule()) + return "swift"; + } if (VD->getModuleContext()->isStdlibModule()) { // Incorporate argument labels into Stdlib API names. // FIXME: This should be done more broadly. diff --git a/lib/PrintAsClang/ClangSyntaxPrinter.cpp b/lib/PrintAsClang/ClangSyntaxPrinter.cpp index da532c802e4..b610e15d170 100644 --- a/lib/PrintAsClang/ClangSyntaxPrinter.cpp +++ b/lib/PrintAsClang/ClangSyntaxPrinter.cpp @@ -142,7 +142,7 @@ void ClangSyntaxPrinter::printModuleNamespaceStart( const ModuleDecl &moduleContext) const { os << "namespace "; printBaseName(&moduleContext); - os << " __attribute__((swift_private))"; + os << " SWIFT_PRIVATE_ATTR"; printSymbolUSRAttribute(&moduleContext); os << " {\n"; } @@ -155,7 +155,7 @@ void ClangSyntaxPrinter::printNamespace( os << "namespace "; namePrinter(os); if (trivia == NamespaceTrivia::AttributeSwiftPrivate) - os << " __attribute__((swift_private))"; + os << " SWIFT_PRIVATE_ATTR"; if (moduleContext) printSymbolUSRAttribute(moduleContext); os << " {\n\n"; diff --git a/lib/PrintAsClang/ModuleContentsWriter.cpp b/lib/PrintAsClang/ModuleContentsWriter.cpp index 61ddc91e065..062d05b767d 100644 --- a/lib/PrintAsClang/ModuleContentsWriter.cpp +++ b/lib/PrintAsClang/ModuleContentsWriter.cpp @@ -835,8 +835,8 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx( os << "#endif\n"; os << "#ifdef __cplusplus\n"; os << "namespace "; - M.ValueDecl::getName().print(os); - os << " __attribute__((swift_private))"; + ClangSyntaxPrinter(os).printBaseName(&M); + os << " SWIFT_PRIVATE_ATTR"; ClangSyntaxPrinter(os).printSymbolUSRAttribute(&M); os << " {\n"; os << "namespace " << cxx_synthesis::getCxxImplNamespaceName() << " {\n"; @@ -854,7 +854,7 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx( // Construct a C++ namespace for the module. ClangSyntaxPrinter(os).printNamespace( - [&](raw_ostream &os) { M.ValueDecl::getName().print(os); }, + [&](raw_ostream &os) { ClangSyntaxPrinter(os).printBaseName(&M); }, [&](raw_ostream &os) { os << moduleOS.str(); }, ClangSyntaxPrinter::NamespaceTrivia::AttributeSwiftPrivate, &M); diff --git a/lib/PrintAsClang/PrintClangFunction.cpp b/lib/PrintAsClang/PrintClangFunction.cpp index 8884d70cfc4..d43acffbd9c 100644 --- a/lib/PrintAsClang/PrintClangFunction.cpp +++ b/lib/PrintAsClang/PrintClangFunction.cpp @@ -19,6 +19,7 @@ #include "PrintClangValueType.h" #include "SwiftToClangInteropContext.h" #include "swift/ABI/MetadataValues.h" +#include "swift/AST/ASTContext.h" #include "swift/AST/Decl.h" #include "swift/AST/GenericParamList.h" #include "swift/AST/Module.h" @@ -218,7 +219,8 @@ public: llvm::function_ref body) { if (!optionalKind || optionalKind == OTK_None) return body(); - os << "Swift::Optional<"; + printBaseName(moduleContext->getASTContext().getStdlibModule()); + os << "::Optional<"; body(); os << '>'; } @@ -718,7 +720,7 @@ ClangRepresentation DeclAndTypeClangFunctionPrinter::printFunctionSignature( // Print out the return type. if (FD->hasThrows() && outputLang == OutputLanguageMode::Cxx) - os << "Swift::ThrowingResult<"; + os << "swift::ThrowingResult<"; if (kind == FunctionSignatureKind::CFunctionProto) { // First, verify that the C++ return type is representable. { @@ -1330,17 +1332,17 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody( if (hasThrows) { os << " if (opaqueError != nullptr)\n"; os << "#ifdef __cpp_exceptions\n"; - os << " throw (Swift::Error(opaqueError));\n"; + os << " throw (swift::Error(opaqueError));\n"; os << "#else\n"; if (resultTy->isVoid()) { - os << " return Swift::Expected(Swift::Error(opaqueError));\n"; + os << " return swift::Expected(swift::Error(opaqueError));\n"; os << "#endif\n"; } else { auto directResultType = signature.getDirectResultType(); printDirectReturnOrParamCType( *directResultType, resultTy, moduleContext, os, cPrologueOS, typeMapping, interopContext, [&]() { - os << " return Swift::Expected<"; + os << " return swift::Expected<"; OptionalTypeKind retKind; Type objTy; std::tie(objTy, retKind) = @@ -1348,7 +1350,7 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody( auto s = printClangFunctionReturnType(objTy, retKind, const_cast(moduleContext), OutputLanguageMode::Cxx); - os << ">(Swift::Error(opaqueError));\n"; + os << ">(swift::Error(opaqueError));\n"; os << "#endif\n"; // Return the function result value if it doesn't throw. diff --git a/lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp b/lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp index 2dc3d29690d..098d3697498 100644 --- a/lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp +++ b/lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp @@ -200,24 +200,27 @@ void swift::printSwiftToClangCoreScaffold(SwiftToClangInteropContext &ctx, PrimitiveTypeMapping &typeMapping, raw_ostream &os) { ClangSyntaxPrinter printer(os); - printer.printNamespace("swift", [&](raw_ostream &) { - printer.printNamespace( - cxx_synthesis::getCxxImplNamespaceName(), [&](raw_ostream &) { - printer.printExternC([&](raw_ostream &os) { - printTypeMetadataResponseType(ctx, typeMapping, os); - os << "\n"; - printValueWitnessTable(os); - os << "\n"; - printPrimitiveGenericTypeTraits(os, astContext, typeMapping, - /*isCForwardDefinition=*/true); - }); - os << "\n"; + printer.printNamespace( + cxx_synthesis::getCxxSwiftNamespaceName(), + [&](raw_ostream &) { + printer.printNamespace( + cxx_synthesis::getCxxImplNamespaceName(), [&](raw_ostream &) { + printer.printExternC([&](raw_ostream &os) { + printTypeMetadataResponseType(ctx, typeMapping, os); + os << "\n"; + printValueWitnessTable(os); + os << "\n"; + printPrimitiveGenericTypeTraits(os, astContext, typeMapping, + /*isCForwardDefinition=*/true); + }); + os << "\n"; + }); + os << "\n"; + // C++ only supports inline variables from C++17. + ClangSyntaxPrinter(os).printIgnoredCxx17ExtensionDiagnosticBlock([&]() { + printPrimitiveGenericTypeTraits(os, astContext, typeMapping, + /*isCForwardDefinition=*/false); }); - os << "\n"; - // C++ only supports inline variables from C++17. - ClangSyntaxPrinter(os).printIgnoredCxx17ExtensionDiagnosticBlock([&]() { - printPrimitiveGenericTypeTraits(os, astContext, typeMapping, - /*isCForwardDefinition=*/false); - }); - }); + }, + ClangSyntaxPrinter::NamespaceTrivia::AttributeSwiftPrivate); } diff --git a/lib/PrintAsClang/_SwiftCxxInteroperability.h b/lib/PrintAsClang/_SwiftCxxInteroperability.h index 4b255bfc7d3..3a8efced961 100644 --- a/lib/PrintAsClang/_SwiftCxxInteroperability.h +++ b/lib/PrintAsClang/_SwiftCxxInteroperability.h @@ -71,7 +71,13 @@ #define SWIFT_SYMBOL_MODULE(moduleValue) #endif -namespace swift { +#if __has_attribute(swift_private) +#define SWIFT_PRIVATE_ATTR __attribute__((swift_private)) +#else +#define SWIFT_PRIVATE_ATTR +#endif + +namespace swift SWIFT_PRIVATE_ATTR { namespace _impl { extern "C" void *_Nonnull swift_retain(void *_Nonnull) noexcept; @@ -243,7 +249,7 @@ SWIFT_INLINE_THUNK void *_Nonnull getOpaquePointer(T &value) { #pragma clang diagnostic pop -} // namespace swift +} // namespace swift SWIFT_PRIVATE_ATTR #endif #endif // SWIFT_CXX_INTEROPERABILITY_H diff --git a/lib/PrintAsClang/_SwiftStdlibCxxOverlay.h b/lib/PrintAsClang/_SwiftStdlibCxxOverlay.h index 13a654ddb2c..c49fe896665 100644 --- a/lib/PrintAsClang/_SwiftStdlibCxxOverlay.h +++ b/lib/PrintAsClang/_SwiftStdlibCxxOverlay.h @@ -189,7 +189,7 @@ public: opaqueValue = other.opaqueValue; } - template SWIFT_INLINE_THUNK Swift::Optional as() { + template SWIFT_INLINE_THUNK swift::Optional as() { alignas(alignof(T)) char buffer[sizeof(T)]; const void *em = getErrorMetadata(); void *ep = getPointerToOpaquePointer(); @@ -207,10 +207,10 @@ public: swift::_impl::implClassFor::type::initializeWithTake(dest, buffer); }); - return Swift::Optional::init(result); + return swift::Optional::init(result); } - return Swift::Optional::none(); + return swift::Optional::none(); } private: @@ -236,7 +236,7 @@ public: has_val = false; } - constexpr Expected(const Swift::Error& error_val) noexcept { + constexpr Expected(const swift::Error &error_val) noexcept { new (&buffer) Error(error_val); has_val = false; } @@ -264,7 +264,7 @@ public: if (has_value()) reinterpret_cast(buffer)->~T(); else - reinterpret_cast(buffer)->~Error(); + reinterpret_cast(buffer)->~Error(); } /// assignment @@ -313,22 +313,23 @@ public: } // Get error - constexpr Swift::Error const& error() const& { + constexpr swift::Error const &error() const & { if (has_value()) abort(); - return reinterpret_cast(buffer); + return reinterpret_cast(buffer); } - constexpr Swift::Error& error() & { + constexpr swift::Error &error() & { if (has_value()) abort(); - return reinterpret_cast(buffer); + return reinterpret_cast(buffer); } constexpr bool has_value() const noexcept { return has_val; } private: - alignas(_impl::max(alignof(T), alignof(Swift::Error))) char buffer[_impl::max(sizeof(T), sizeof(Swift::Error))]; + alignas(_impl::max(alignof(T), alignof(swift::Error))) char buffer[_impl::max( + sizeof(T), sizeof(swift::Error))]; bool has_val; }; @@ -341,12 +342,11 @@ public: has_val = false; } - Expected(const Swift::Error& error_val) noexcept { + Expected(const swift::Error &error_val) noexcept { new (&buffer) Error(error_val); has_val = false; } - /// Copy Expected(Expected const& other) noexcept { if (other.has_value()) @@ -361,9 +361,7 @@ public: // FIXME: Implement move semantics when move swift values is possible [[noreturn]] Expected(Expected&&) noexcept { abort(); } - ~Expected() noexcept { - reinterpret_cast(buffer)->~Error(); - } + ~Expected() noexcept { reinterpret_cast(buffer)->~Error(); } /// assignment constexpr auto operator=(Expected&& other) noexcept = delete; @@ -373,21 +371,21 @@ public: constexpr explicit operator bool() const noexcept { return has_value(); } // Get error - constexpr Swift::Error const& error() const& { + constexpr swift::Error const &error() const & { if (has_value()) abort(); - return reinterpret_cast(buffer); + return reinterpret_cast(buffer); } - constexpr Swift::Error& error() & { + constexpr swift::Error &error() & { if (has_value()) abort(); - return reinterpret_cast(buffer); + return reinterpret_cast(buffer); } constexpr bool has_value() const noexcept { return has_val; } private: - alignas(alignof(Swift::Error)) char buffer[sizeof(Swift::Error)]; + alignas(alignof(swift::Error)) char buffer[sizeof(swift::Error)]; bool has_val; }; @@ -400,10 +398,9 @@ using ThrowingResult = T; #else -template -using ThrowingResult = Swift::Expected; +template using ThrowingResult = swift::Expected; -#define SWIFT_RETURN_THUNK(T, v) Swift::Expected(v) +#define SWIFT_RETURN_THUNK(T, v) swift::Expected(v) #endif 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 a7b98b0e5dc..1d8e0112391 100644 --- a/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift +++ b/test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift @@ -192,7 +192,7 @@ public func takeTrivialInout(_ x: inout Trivial) { // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift // CHECK-EMPTY: -// CHECK-NEXT: namespace UseCxxTy __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("UseCxxTy") { +// CHECK-NEXT: namespace UseCxxTy SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("UseCxxTy") { // CHECK: SWIFT_INLINE_THUNK ns::NonTrivialTemplate retNonTrivial() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT { // CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate)) char storage[sizeof(ns::NonTrivialTemplate)]; @@ -231,7 +231,7 @@ public func takeTrivialInout(_ x: inout Trivial) { // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift // CHECK-EMPTY: -// CHECK-NEXT: namespace UseCxxTy __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("UseCxxTy") { +// CHECK-NEXT: namespace UseCxxTy SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("UseCxxTy") { // CHECK-EMPTY: // CHECK-NEXT: SWIFT_INLINE_THUNK ns::NonTrivialTemplate retNonTrivial2() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT { // CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate)) char storage[sizeof(ns::NonTrivialTemplate)]; diff --git a/test/Interop/SwiftToCxx/class/swift-actor-in-cxx.swift b/test/Interop/SwiftToCxx/class/swift-actor-in-cxx.swift index e3f04d847f8..d002764373c 100644 --- a/test/Interop/SwiftToCxx/class/swift-actor-in-cxx.swift +++ b/test/Interop/SwiftToCxx/class/swift-actor-in-cxx.swift @@ -30,7 +30,7 @@ public final actor ActorWithField { } } -// CHECK: namespace Actor __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Actor") { +// CHECK: namespace Actor SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Actor") { // CHECK: SWIFT_EXTERN void * _Nonnull $s5Actor0A9WithFieldCACycfC(SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // init() // CHECK: SWIFT_EXTERN void $s5Actor0A9WithFieldC6methodyyF(SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // method() diff --git a/test/Interop/SwiftToCxx/class/swift-class-in-cxx.swift b/test/Interop/SwiftToCxx/class/swift-class-in-cxx.swift index 2b369100e8b..587cf241fe5 100644 --- a/test/Interop/SwiftToCxx/class/swift-class-in-cxx.swift +++ b/test/Interop/SwiftToCxx/class/swift-class-in-cxx.swift @@ -21,14 +21,14 @@ public final class ClassWithIntField { } } -// CHECK: namespace Class __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Class") { +// CHECK: namespace Class SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Class") { // CHECK: SWIFT_EXTERN void * _Nonnull $s5Class011passThroughA12WithIntFieldyAA0adeF0CADF(void * _Nonnull x) SWIFT_NOEXCEPT SWIFT_CALL; // passThroughClassWithIntField(_:) // CHECK-NEXT: SWIFT_EXTERN void * _Nonnull $s5Class06returnA12WithIntFieldAA0acdE0CyF(void) SWIFT_NOEXCEPT SWIFT_CALL; // returnClassWithIntField() // CHECK-NEXT: SWIFT_EXTERN void $s5Class04takeA12WithIntFieldyyAA0acdE0CF(void * _Nonnull x) SWIFT_NOEXCEPT SWIFT_CALL; // takeClassWithIntField(_:) // CHECK-NEXT: SWIFT_EXTERN void $s5Class04takeA17WithIntFieldInoutyyAA0acdE0CzF(void * _Nonnull * _Nonnull x) SWIFT_NOEXCEPT SWIFT_CALL; // takeClassWithIntFieldInout(_:) -// CHECK: namespace Class __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Class") { +// CHECK: namespace Class SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Class") { // CHECK: class SWIFT_SYMBOL("s:5Class0A12WithIntFieldC") ClassWithIntField; // CHECK-NEXT: } // end namespace @@ -43,7 +43,7 @@ public final class ClassWithIntField { // CHECK-NEXT: } // namespace swift // CHECK: namespace -// CHECK-SAME: Class __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Class") { +// CHECK-SAME: Class SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Class") { // CHECK: namespace // CHECK-SAME: _impl { @@ -100,7 +100,7 @@ public final class ClassWithIntField { // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift // CHECK-EMPTY: -// CHECK-NEXT: namespace Class __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Class") { +// CHECK-NEXT: namespace Class SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Class") { // CHECK: SWIFT_INLINE_THUNK ClassWithIntField passThroughClassWithIntField(const ClassWithIntField& x) noexcept SWIFT_SYMBOL("s:5Class011passThroughA12WithIntFieldyAA0adeF0CADF") SWIFT_WARN_UNUSED_RESULT { // CHECK-NEXT: return _impl::_impl_ClassWithIntField::makeRetained(_impl::$s5Class011passThroughA12WithIntFieldyAA0adeF0CADF(::swift::_impl::_impl_RefCountedClass::getOpaquePointer(x))); diff --git a/test/Interop/SwiftToCxx/core/gen-header-for-module.swift b/test/Interop/SwiftToCxx/core/gen-header-for-module.swift index 24e4c1ff20b..fe17c0f52be 100644 --- a/test/Interop/SwiftToCxx/core/gen-header-for-module.swift +++ b/test/Interop/SwiftToCxx/core/gen-header-for-module.swift @@ -22,5 +22,5 @@ public func reprintedInImportedModule() -> Int { return 42 } -// CHECK: namespace Core __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Core") { +// CHECK: namespace Core SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Core") { // CHECK: swift::Int reprintedInImportedModule() noexcept SWIFT_SYMBOL("s:4Core25reprintedInImportedModuleSiyF") SWIFT_WARN_UNUSED_RESULT { diff --git a/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx-64-bit.swift b/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx-64-bit.swift index 39d47ee040d..2f4ba8fb73b 100644 --- a/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx-64-bit.swift +++ b/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx-64-bit.swift @@ -6,7 +6,7 @@ // REQUIRES: PTRSIZE=64 -// CHECK: namespace swift { +// CHECK: namespace swift SWIFT_PRIVATE_ATTR { // CHECK: namespace _impl { diff --git a/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx.swift b/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx.swift index aec1bbef04e..d4e6c963754 100644 --- a/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx.swift +++ b/test/Interop/SwiftToCxx/core/swift-impl-defs-in-cxx.swift @@ -7,7 +7,7 @@ // CHECK: #ifndef SWIFT_PRINTED_CORE // CHECK-NEXT: #define SWIFT_PRINTED_CORE -// CHECK-NEXT: namespace swift { +// CHECK-NEXT: namespace swift SWIFT_PRIVATE_ATTR { // CHECK-EMPTY: // CHECK-NEXT: namespace _impl { // CHECK-EMPTY: diff --git a/test/Interop/SwiftToCxx/enums/swift-enum-implementation.swift b/test/Interop/SwiftToCxx/enums/swift-enum-implementation.swift index 2654995033a..fef353a7c7d 100644 --- a/test/Interop/SwiftToCxx/enums/swift-enum-implementation.swift +++ b/test/Interop/SwiftToCxx/enums/swift-enum-implementation.swift @@ -166,7 +166,7 @@ public struct S { // CHECK-NEXT: #endif // CHECK-NEXT: vwTable->initializeWithTake(destStorage, srcStorage, metadata._0); // CHECK-NEXT: } -// CHECK: namespace Enums __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Enums") { +// CHECK: namespace Enums SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Enums") { // CHECK: SWIFT_INLINE_THUNK E E::_impl_x::operator()(double val) const { // CHECK-NEXT: auto result = E::_make(); // CHECK-NEXT: memcpy(result._getOpaquePointer(), &val, sizeof(val)); diff --git a/test/Interop/SwiftToCxx/enums/zero-sized-enum-in-cxx.swift b/test/Interop/SwiftToCxx/enums/zero-sized-enum-in-cxx.swift index a296082e0f0..b657234b8fb 100644 --- a/test/Interop/SwiftToCxx/enums/zero-sized-enum-in-cxx.swift +++ b/test/Interop/SwiftToCxx/enums/zero-sized-enum-in-cxx.swift @@ -5,7 +5,7 @@ public enum EmptyEnum {} public enum SingleCaseEnum { case first } -// CHECK: namespace Enums __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Enums") { +// CHECK: namespace Enums SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Enums") { // CHECK-NOT: EmptyEnum final { // CHECK-NOT: SingleCaseEnum final { // CHECK: } // namespace Enums diff --git a/test/Interop/SwiftToCxx/functions/PrintAsCxx/function_with_array.swift b/test/Interop/SwiftToCxx/functions/PrintAsCxx/function_with_array.swift index 3a891e411e7..41454fffad6 100644 --- a/test/Interop/SwiftToCxx/functions/PrintAsCxx/function_with_array.swift +++ b/test/Interop/SwiftToCxx/functions/PrintAsCxx/function_with_array.swift @@ -5,5 +5,5 @@ // CHECK: namespace function_with_array // FIXME: we don't actually emit a declaration for this, but for now at least // check that we don't crash. -// CHECK: void f(const Swift::Array& +// CHECK: void f(const swift::Array& public func f(_: [Int]) { } diff --git a/test/Interop/SwiftToCxx/functions/cdecl.swift b/test/Interop/SwiftToCxx/functions/cdecl.swift index 71f41cd3cdd..87739ffbe7d 100644 --- a/test/Interop/SwiftToCxx/functions/cdecl.swift +++ b/test/Interop/SwiftToCxx/functions/cdecl.swift @@ -4,7 +4,7 @@ // RUN: %check-interop-cxx-header-in-clang(%t/cdecl.h) -// CHECK-LABEL: namespace CdeclFunctions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("CdeclFunctions") { +// CHECK-LABEL: namespace CdeclFunctions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("CdeclFunctions") { // CHECK: namespace _impl { // CHECK: SWIFT_EXTERN int cfuncPassTwo(int x, int y) SWIFT_NOEXCEPT; diff --git a/test/Interop/SwiftToCxx/functions/function-availability.swift b/test/Interop/SwiftToCxx/functions/function-availability.swift index 5477757a32c..5527c2aca6e 100644 --- a/test/Interop/SwiftToCxx/functions/function-availability.swift +++ b/test/Interop/SwiftToCxx/functions/function-availability.swift @@ -4,7 +4,7 @@ // RUN: %check-interop-cxx-header-in-clang(%t/functions.h) -// CHECK-LABEL: namespace Functions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Functions") { +// CHECK-LABEL: namespace Functions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Functions") { // CHECK-LABEL: namespace _impl { diff --git a/test/Interop/SwiftToCxx/functions/swift-expected-execution.cpp b/test/Interop/SwiftToCxx/functions/swift-expected-execution.cpp index c8c65d91212..b301c277fd0 100644 --- a/test/Interop/SwiftToCxx/functions/swift-expected-execution.cpp +++ b/test/Interop/SwiftToCxx/functions/swift-expected-execution.cpp @@ -22,14 +22,14 @@ int main() { // Test Empty Constructor - auto testIntEmpty = Swift::Expected(); + auto testIntEmpty = swift::Expected(); // Test Error Constructor - Swift::Error e; - auto testIntError = Swift::Expected(e); + swift::Error e; + auto testIntError = swift::Expected(e); // Test Value Constructor - auto testIntValue = Swift::Expected(42); + auto testIntValue = swift::Expected(42); // Test Copy Constructor auto testCopy = testIntEmpty; @@ -37,9 +37,9 @@ int main() { // TODO: Test Move Constructor // Test Destructor - auto testDestEmpty = Swift::Expected(); - auto testDestInt = Swift::Expected(42); - auto testDestError = Swift::Expected(e); + auto testDestEmpty = swift::Expected(); + auto testDestInt = swift::Expected(42); + auto testDestError = swift::Expected(e); testDestEmpty.~Expected(); testDestInt.~Expected(); testDestError.~Expected(); diff --git a/test/Interop/SwiftToCxx/functions/swift-functions-errors-execution.cpp b/test/Interop/SwiftToCxx/functions/swift-functions-errors-execution.cpp index 8a9a4483653..24d233db148 100644 --- a/test/Interop/SwiftToCxx/functions/swift-functions-errors-execution.cpp +++ b/test/Interop/SwiftToCxx/functions/swift-functions-errors-execution.cpp @@ -28,12 +28,12 @@ int main() { try { Functions::emptyThrowFunction(); - } catch (Swift::Error& e) { + } catch (swift::Error& e) { printf("Exception\n"); } try { Functions::throwFunction(); - } catch (Swift::Error& e) { + } catch (swift::Error& e) { auto errorOpt = e.as(); assert(errorOpt.isSome()); @@ -43,12 +43,12 @@ int main() { } try { Functions::throwFunctionWithReturn(); - } catch (Swift::Error& e) { + } catch (swift::Error& e) { printf("Exception\n"); } try { Functions::testDestroyedError(); - } catch(const Swift::Error &e) { } + } catch(const swift::Error &e) { } return 0; } diff --git a/test/Interop/SwiftToCxx/functions/swift-functions-errors.swift b/test/Interop/SwiftToCxx/functions/swift-functions-errors.swift index b2fcba488df..903ba15ef7e 100644 --- a/test/Interop/SwiftToCxx/functions/swift-functions-errors.swift +++ b/test/Interop/SwiftToCxx/functions/swift-functions-errors.swift @@ -7,7 +7,7 @@ // for experimental feature GenerateBindingsForThrowingFunctionsInCXX: // REQUIRES: asserts -// CHECK-LABEL: namespace Functions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Functions") { +// CHECK-LABEL: namespace Functions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Functions") { // CHECK-LABEL: namespace _impl { @@ -33,15 +33,15 @@ public enum NaiveErrors : Error { @_expose(Cxx) public func emptyThrowFunction() throws { print("passEmptyThrowFunction") } -// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult emptyThrowFunction() SWIFT_SYMBOL("s:9Functions18emptyThrowFunctionyyKF") { +// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult emptyThrowFunction() SWIFT_SYMBOL("s:9Functions18emptyThrowFunctionyyKF") { // CHECK: void* opaqueError = nullptr; // CHECK: void* _ctx = nullptr; // CHECK: _impl::$s9Functions18emptyThrowFunctionyyKF(_ctx, &opaqueError); // CHECK: if (opaqueError != nullptr) // CHECK: #ifdef __cpp_exceptions -// CHECK: throw (Swift::Error(opaqueError)); +// CHECK: throw (swift::Error(opaqueError)); // CHECK: #else -// CHECK: return Swift::Expected(Swift::Error(opaqueError)); +// CHECK: return swift::Expected(swift::Error(opaqueError)); // CHECK: #endif // CHECK: } @@ -59,15 +59,15 @@ public struct DestroyedError : Error { @_expose(Cxx) public func testDestroyedError() throws { throw DestroyedError() } -// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult testDestroyedError() SWIFT_SYMBOL("s:9Functions18testDestroyedErroryyKF") { +// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult testDestroyedError() SWIFT_SYMBOL("s:9Functions18testDestroyedErroryyKF") { // CHECK: void* opaqueError = nullptr; // CHECK: void* _ctx = nullptr; // CHECK: _impl::$s9Functions18testDestroyedErroryyKF(_ctx, &opaqueError); // CHECK: if (opaqueError != nullptr) // CHECK: #ifdef __cpp_exceptions -// CHECK: throw (Swift::Error(opaqueError)); +// CHECK: throw (swift::Error(opaqueError)); // CHECK: #else -// CHECK: return Swift::Expected(Swift::Error(opaqueError)); +// CHECK: return swift::Expected(swift::Error(opaqueError)); // CHECK: #endif // CHECK: } @@ -77,15 +77,15 @@ public func throwFunction() throws { throw NaiveErrors.throwError } -// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult throwFunction() SWIFT_SYMBOL("s:9Functions13throwFunctionyyKF") { +// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult throwFunction() SWIFT_SYMBOL("s:9Functions13throwFunctionyyKF") { // CHECK: void* opaqueError = nullptr; // CHECK: void* _ctx = nullptr; // CHECK: _impl::$s9Functions13throwFunctionyyKF(_ctx, &opaqueError); // CHECK: if (opaqueError != nullptr) // CHECK: #ifdef __cpp_exceptions -// CHECK: throw (Swift::Error(opaqueError)); +// CHECK: throw (swift::Error(opaqueError)); // CHECK: #else -// CHECK: return Swift::Expected(Swift::Error(opaqueError)); +// CHECK: return swift::Expected(swift::Error(opaqueError)); // CHECK: #endif // CHECK: } @@ -98,15 +98,15 @@ public func throwFunctionWithPossibleReturn(_ a: Int) throws -> Int { return 0 } -// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult throwFunctionWithPossibleReturn(swift::Int a) SWIFT_SYMBOL("s:9Functions31throwFunctionWithPossibleReturnyS2iKF") SWIFT_WARN_UNUSED_RESULT { +// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult throwFunctionWithPossibleReturn(swift::Int a) SWIFT_SYMBOL("s:9Functions31throwFunctionWithPossibleReturnyS2iKF") SWIFT_WARN_UNUSED_RESULT { // CHECK: void* opaqueError = nullptr; // CHECK: void* _ctx = nullptr; // CHECK: auto returnValue = _impl::$s9Functions31throwFunctionWithPossibleReturnyS2iKF(a, _ctx, &opaqueError); // CHECK: if (opaqueError != nullptr) // CHECK: #ifdef __cpp_exceptions -// CHECK: throw (Swift::Error(opaqueError)); +// CHECK: throw (swift::Error(opaqueError)); // CHECK: #else -// CHECK: return Swift::Expected(Swift::Error(opaqueError)); +// CHECK: return swift::Expected(swift::Error(opaqueError)); // CHECK: #endif // CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue); // CHECK: } @@ -118,14 +118,14 @@ public func throwFunctionWithReturn() throws -> Int { return 0 } -// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult throwFunctionWithReturn() SWIFT_SYMBOL("s:9Functions23throwFunctionWithReturnSiyKF") SWIFT_WARN_UNUSED_RESULT { +// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult throwFunctionWithReturn() SWIFT_SYMBOL("s:9Functions23throwFunctionWithReturnSiyKF") SWIFT_WARN_UNUSED_RESULT { // CHECK: void* opaqueError = nullptr; // CHECK: void* _ctx = nullptr; // CHECK: auto returnValue = _impl::$s9Functions23throwFunctionWithReturnSiyKF(_ctx, &opaqueError); // CHECK: #ifdef __cpp_exceptions -// CHECK: throw (Swift::Error(opaqueError)); +// CHECK: throw (swift::Error(opaqueError)); // CHECK: #else -// CHECK: return Swift::Expected(Swift::Error(opaqueError)); +// CHECK: return swift::Expected(swift::Error(opaqueError)); // CHECK: #endif // CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue); // CHECK: } diff --git a/test/Interop/SwiftToCxx/functions/swift-functions.swift b/test/Interop/SwiftToCxx/functions/swift-functions.swift index fadccdf25e3..ee35dd57a2c 100644 --- a/test/Interop/SwiftToCxx/functions/swift-functions.swift +++ b/test/Interop/SwiftToCxx/functions/swift-functions.swift @@ -4,7 +4,7 @@ // RUN: %check-interop-cxx-header-in-clang(%t/functions.h) -// CHECK-LABEL: namespace Functions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Functions") { +// CHECK-LABEL: namespace Functions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Functions") { // CHECK-LABEL: namespace _impl { diff --git a/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-alwaysEmitInClient-func.swift b/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-alwaysEmitInClient-func.swift index a999b4a715d..8764091f5c7 100644 --- a/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-alwaysEmitInClient-func.swift +++ b/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-alwaysEmitInClient-func.swift @@ -6,7 +6,7 @@ // CHECK-NOT: SWIFT_EXTERN bool $s9Functions24alwaysEmitIntoClientFuncyS2bF(bool x) SWIFT_NOEXCEPT SWIFT_CALL; // alwaysEmitIntoClientFunc(_:) -// CHECK: namespace Functions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Functions") { +// CHECK: namespace Functions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Functions") { // CHECK-EMPTY: // CHECK-EMPTY: // CHECK-NEXT: } // namespace Functions diff --git a/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-async-func.swift b/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-async-func.swift index 43edacf9c5a..3125d8c2be5 100644 --- a/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-async-func.swift +++ b/test/Interop/SwiftToCxx/functions/swift-no-expose-unsupported-async-func.swift @@ -6,7 +6,7 @@ // CHECK-NOT: SWIFT_EXTERN double $s9Functions9asyncFuncyS2dYaF(double x) SWIFT_NOEXCEPT SWIFT_CALL; // asyncFunc(_:) -// CHECK: namespace Functions __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Functions") { +// CHECK: namespace Functions SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Functions") { // CHECK-EMPTY: // CHECK-EMPTY: // CHECK-NEXT: } // namespace Functions diff --git a/test/Interop/SwiftToCxx/generics/generic-type-traits-fwd.swift b/test/Interop/SwiftToCxx/generics/generic-type-traits-fwd.swift index 6a44e573130..664d9f9cbc5 100644 --- a/test/Interop/SwiftToCxx/generics/generic-type-traits-fwd.swift +++ b/test/Interop/SwiftToCxx/generics/generic-type-traits-fwd.swift @@ -39,7 +39,7 @@ public struct LaterGeneric { // CHECK: class SWIFT_SYMBOL("s:8Generics14ComesFirstEnumO") ComesFirstEnum final { // CHECK: LaterGeneric returnsLaterOpt() const SWIFT_SYMBOL("s:8Generics14ComesFirstEnumO15returnsLaterOptAA0F7GenericVyACGyF"); -// CHECK: namespace Generics __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Generics") { +// CHECK: namespace Generics SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Generics") { // CHECK-EMPTY: // CHECK-NEXT: namespace _impl { // CHECK-EMPTY: diff --git a/test/Interop/SwiftToCxx/module/module-to-namespace.swift b/test/Interop/SwiftToCxx/module/module-to-namespace.swift index b910d62b709..3b6a97a1bc4 100644 --- a/test/Interop/SwiftToCxx/module/module-to-namespace.swift +++ b/test/Interop/SwiftToCxx/module/module-to-namespace.swift @@ -9,7 +9,7 @@ // CHECK-NEXT: #endif // CHECK-NEXT: #define SWIFT_SYMBOL(usrValue) SWIFT_SYMBOL_MODULE_USR("Test", usrValue) -// CHECK-LABEL: namespace Test __attribute__((swift_private)) SWIFT_SYMBOL_MODULE({{.*}}) { +// CHECK-LABEL: namespace Test SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE({{.*}}) { // CHECK: } // namespace Test // CHECK-EMPTY: // CHECK-NEXT: #undef SWIFT_SYMBOL diff --git a/test/Interop/SwiftToCxx/stdlib/array/array-execution.cpp b/test/Interop/SwiftToCxx/stdlib/array/array-execution.cpp index 795c8a3f523..67ed7e35d96 100644 --- a/test/Interop/SwiftToCxx/stdlib/array/array-execution.cpp +++ b/test/Interop/SwiftToCxx/stdlib/array/array-execution.cpp @@ -32,7 +32,7 @@ public func printArray(_ val: Array) { #include "UseArray.h" int main() { - using namespace Swift; + using namespace swift; { Array val = UseArray::createArray(2); diff --git a/test/Interop/SwiftToCxx/stdlib/optional/optional-execution.cpp b/test/Interop/SwiftToCxx/stdlib/optional/optional-execution.cpp index ba11203f004..4ad21ef8113 100644 --- a/test/Interop/SwiftToCxx/stdlib/optional/optional-execution.cpp +++ b/test/Interop/SwiftToCxx/stdlib/optional/optional-execution.cpp @@ -78,7 +78,7 @@ public func resetOpt(_ val: inout Optional) { #include "UseOptional.h" int main() { - using namespace Swift; + using namespace swift; using namespace UseOptional; { diff --git a/test/Interop/SwiftToCxx/stdlib/optional/optional-in-cxx.swift b/test/Interop/SwiftToCxx/stdlib/optional/optional-in-cxx.swift index 296801266f3..0b6c32f8450 100644 --- a/test/Interop/SwiftToCxx/stdlib/optional/optional-in-cxx.swift +++ b/test/Interop/SwiftToCxx/stdlib/optional/optional-in-cxx.swift @@ -54,21 +54,21 @@ public func resetOpt(_ val: inout Optional) { } -// CHECK: SWIFT_INLINE_THUNK Swift::Optional createCIntOpt(int val) noexcept SWIFT_SYMBOL("s:11UseOptional13createCIntOptys5Int32VSgADF") SWIFT_WARN_UNUSED_RESULT { - // CHECK-NEXT: return Swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { +// CHECK: SWIFT_INLINE_THUNK swift::Optional createCIntOpt(int val) noexcept SWIFT_SYMBOL("s:11UseOptional13createCIntOptys5Int32VSgADF") SWIFT_WARN_UNUSED_RESULT { + // CHECK-NEXT: return swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { // CHECK-NEXT: _impl::swift_interop_returnDirect_UseOptional_[[CINTENC:[a-z0-9_]+]](result, _impl::$s11UseOptional13createCIntOptys5Int32VSgADF(val)); // CHECK-NEXT: }); // CHECK-NEXT: } -// CHECK: SWIFT_INLINE_THUNK Swift::Optional createKlassOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional14createKlassOptyAA0D0CSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT { -// CHECK-NEXT: return Swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { +// CHECK: SWIFT_INLINE_THUNK swift::Optional createKlassOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional14createKlassOptyAA0D0CSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT { +// CHECK-NEXT: return swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { // CHECK-NEXT: _impl::swift_interop_returnDirect_UseOptional_[[CLASSENC:[a-z0-9_]+]](result, _impl::$s11UseOptional14createKlassOptyAA0D0CSgs5Int16VF(val)); // CHECK-NEXT: }); // CHECK-NEXT: } -// CHECK: SWIFT_INLINE_THUNK Swift::Optional createSmallStructOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT { -// CHECK-NEXT: return Swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { +// CHECK: SWIFT_INLINE_THUNK swift::Optional createSmallStructOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT { +// CHECK-NEXT: return swift::_impl::_impl_Optional::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES { // CHECK-NEXT: _impl::swift_interop_returnDirect_UseOptional_uint32_t_0_4(result, _impl::$s11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF(val)); // CHECK-NEXT: }); // CHECK-NEXT: } @@ -78,24 +78,24 @@ public func resetOpt(_ val: inout Optional) { // CHECK-NEXT: #ifdef __cpp_concepts // CHECK-NEXT: requires swift::isUsableInGenericContext // CHECK-NEXT: #endif -// CHECK-NEXT: SWIFT_INLINE_THUNK void resetOpt(Swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional8resetOptyyxSgzlF") { +// CHECK-NEXT: SWIFT_INLINE_THUNK void resetOpt(swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional8resetOptyyxSgzlF") { // CHECK-NEXT: #ifndef __cpp_concepts // CHECK-NEXT: static_assert(swift::isUsableInGenericContext, "type cannot be used in a Swift generic context"); // CHECK-NEXT: #endif -// CHECK-NEXT: return _impl::$s11UseOptional8resetOptyyxSgzlF(Swift::_impl::_impl_Optional::getOpaquePointer(val), swift::TypeMetadataTrait::getTypeMetadata()); +// CHECK-NEXT: return _impl::$s11UseOptional8resetOptyyxSgzlF(swift::_impl::_impl_Optional::getOpaquePointer(val), swift::TypeMetadataTrait::getTypeMetadata()); // CHECK-NEXT: } -// CHECK: SWIFT_INLINE_THUNK void takeCIntOpt(const Swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional11takeCIntOptyys5Int32VSgF") { -// CHECK-NEXT: return _impl::$s11UseOptional11takeCIntOptyys5Int32VSgF(_impl::swift_interop_passDirect_UseOptional_[[CINTENC]](Swift::_impl::_impl_Optional::getOpaquePointer(val))); +// CHECK: SWIFT_INLINE_THUNK void takeCIntOpt(const swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional11takeCIntOptyys5Int32VSgF") { +// CHECK-NEXT: return _impl::$s11UseOptional11takeCIntOptyys5Int32VSgF(_impl::swift_interop_passDirect_UseOptional_[[CINTENC]](swift::_impl::_impl_Optional::getOpaquePointer(val))); // CHECK-NEXT: } -// CHECK: SWIFT_INLINE_THUNK void takeKlassOpt(const Swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional12takeKlassOptyyAA0D0CSgF") { -// CHECK-NEXT: return _impl::$s11UseOptional12takeKlassOptyyAA0D0CSgF(_impl::swift_interop_passDirect_UseOptional_[[CLASSENC]](Swift::_impl::_impl_Optional::getOpaquePointer(val))); +// CHECK: SWIFT_INLINE_THUNK void takeKlassOpt(const swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional12takeKlassOptyyAA0D0CSgF") { +// CHECK-NEXT: return _impl::$s11UseOptional12takeKlassOptyyAA0D0CSgF(_impl::swift_interop_passDirect_UseOptional_[[CLASSENC]](swift::_impl::_impl_Optional::getOpaquePointer(val))); // CHECK-NEXT: } -// CHECK: SWIFT_INLINE_THUNK void takeSmallStructOpt(const Swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional18takeSmallStructOptyyAA0dE0VSgF") { -// CHECK-NEXT: return _impl::$s11UseOptional18takeSmallStructOptyyAA0dE0VSgF(_impl::swift_interop_passDirect_UseOptional_uint32_t_0_4(Swift::_impl::_impl_Optional::getOpaquePointer(val))); +// CHECK: SWIFT_INLINE_THUNK void takeSmallStructOpt(const swift::Optional& val) noexcept SWIFT_SYMBOL("s:11UseOptional18takeSmallStructOptyyAA0dE0VSgF") { +// CHECK-NEXT: return _impl::$s11UseOptional18takeSmallStructOptyyAA0dE0VSgF(_impl::swift_interop_passDirect_UseOptional_uint32_t_0_4(swift::_impl::_impl_Optional::getOpaquePointer(val))); // CHECK-NEXT: } diff --git a/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift b/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift index bb0a90a2f97..78c99508106 100644 --- a/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift +++ b/test/Interop/SwiftToCxx/stdlib/stdlib-dep-inline-in-cxx.swift @@ -17,5 +17,5 @@ public func test() -> String { return "" } -// CHECK: namespace Swift __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Swift") { +// CHECK: namespace swift SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("swift") { // CHECK: class SWIFT_SYMBOL("{{.*}}") String final { diff --git a/test/Interop/SwiftToCxx/stdlib/string/string-conversions.cpp b/test/Interop/SwiftToCxx/stdlib/string/string-conversions.cpp index 6378144ac11..ca455aca557 100644 --- a/test/Interop/SwiftToCxx/stdlib/string/string-conversions.cpp +++ b/test/Interop/SwiftToCxx/stdlib/string/string-conversions.cpp @@ -28,7 +28,7 @@ public func makeString(_ s: String, _ y: String) -> String { #include "Stringer.h" int main() { - using namespace Swift; + using namespace swift; using namespace Stringer; { diff --git a/test/Interop/SwiftToCxx/stdlib/string/string-in-cxx-execution.cpp b/test/Interop/SwiftToCxx/stdlib/string/string-in-cxx-execution.cpp index c0bde3300a8..8064c4d8cae 100644 --- a/test/Interop/SwiftToCxx/stdlib/string/string-in-cxx-execution.cpp +++ b/test/Interop/SwiftToCxx/stdlib/string/string-in-cxx-execution.cpp @@ -23,7 +23,7 @@ public func printString(_ s: String) { #include "Stringer.h" int main() { - using namespace Swift; + using namespace swift; using namespace Stringer; { diff --git a/test/Interop/SwiftToCxx/stdlib/string/string-to-nsstring.mm b/test/Interop/SwiftToCxx/stdlib/string/string-to-nsstring.mm index ef03e8d534e..d947a970c6e 100644 --- a/test/Interop/SwiftToCxx/stdlib/string/string-to-nsstring.mm +++ b/test/Interop/SwiftToCxx/stdlib/string/string-to-nsstring.mm @@ -27,7 +27,7 @@ public func createString(_ ptr: UnsafePointer) -> String { #include "StringCreator.h" int main() { - using namespace Swift; + using namespace swift; auto emptyString = String::init(); NSString *nsStr = emptyString; } @@ -45,7 +45,7 @@ int main() { #include "StringCreator.h" int main() { - using namespace Swift; + using namespace swift; auto emptyString = String::init(); diff --git a/test/Interop/SwiftToCxx/stdlib/swift-stdlib-in-cxx.swift b/test/Interop/SwiftToCxx/stdlib/swift-stdlib-in-cxx.swift index fd6429ec7e4..1038d50cb8e 100644 --- a/test/Interop/SwiftToCxx/stdlib/swift-stdlib-in-cxx.swift +++ b/test/Interop/SwiftToCxx/stdlib/swift-stdlib-in-cxx.swift @@ -4,7 +4,7 @@ // RUN: %check-interop-cxx-header-in-clang(%t/Swift.h -DSWIFT_CXX_INTEROP_HIDE_STL_OVERLAY -Wno-unused-private-field -Wno-unused-function -Wc++98-compat-extra-semi) -// CHECK: namespace Swift __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Swift") { +// CHECK: namespace swift SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("swift") { // CHECK: template // CHECK-NEXT: #ifdef __cpp_concepts @@ -107,7 +107,7 @@ // CHECK: SWIFT_INLINE_THUNK UTF8View(UTF8View &&) { abort(); } // CHECK-NEXT: SWIFT_INLINE_THUNK String_Index getStartIndex() const SWIFT_SYMBOL({{.*}}); // CHECK-NEXT: SWIFT_INLINE_THUNK String_Index getEndIndex() const SWIFT_SYMBOL({{.*}}); -// CHECK: SWIFT_INLINE_THUNK Swift::Optional indexOffsetByLimitedBy(const String_Index& i, swift::Int n, const String_Index& limit) const SWIFT_SYMBOL({{.*}}); +// CHECK: SWIFT_INLINE_THUNK swift::Optional indexOffsetByLimitedBy(const String_Index& i, swift::Int n, const String_Index& limit) const SWIFT_SYMBOL({{.*}}); // CHECK: SWIFT_INLINE_THUNK swift::Int distanceFromTo(const String_Index& i, const String_Index& j) const SWIFT_SYMBOL({{.*}}); // CHECK: SWIFT_INLINE_THUNK uint8_t operator [](const String_Index& i) const SWIFT_SYMBOL({{.*}}); // CHECK: SWIFT_INLINE_THUNK String getDescription() const SWIFT_SYMBOL({{.*}}); @@ -124,4 +124,4 @@ // CHECK-NEXT: #include // CHECK-NEXT: #endif -// CHECK: } // namespace Swift +// CHECK: } // namespace swift diff --git a/test/Interop/SwiftToCxx/structs/resilient-struct-in-cxx.swift b/test/Interop/SwiftToCxx/structs/resilient-struct-in-cxx.swift index 801fb4dcbd4..bafdeac7813 100644 --- a/test/Interop/SwiftToCxx/structs/resilient-struct-in-cxx.swift +++ b/test/Interop/SwiftToCxx/structs/resilient-struct-in-cxx.swift @@ -100,7 +100,7 @@ public struct FirstSmallStruct { // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift // CHECK-EMPTY: -// CHECK-NEXT: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK-NEXT: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { @frozen public struct FrozenStruct { private let storedInt: Int32 diff --git a/test/Interop/SwiftToCxx/structs/swift-struct-in-cxx.swift b/test/Interop/SwiftToCxx/structs/swift-struct-in-cxx.swift index 4bdbbe5625f..beb631a42e3 100644 --- a/test/Interop/SwiftToCxx/structs/swift-struct-in-cxx.swift +++ b/test/Interop/SwiftToCxx/structs/swift-struct-in-cxx.swift @@ -4,10 +4,10 @@ // RUN: %check-interop-cxx-header-in-clang(%t/structs.h -Wno-unused-private-field -Wno-unused-function) -// CHECK: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { // CHECK: namespace _impl { -// CHECK: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { // CHECK: class SWIFT_SYMBOL("s:7Structs18StructWithIntFieldV") StructWithIntField; // CHECK-NEXT: } // end namespace @@ -20,7 +20,7 @@ // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift -// CHECK: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { // CHECK: namespace _impl { // CHECK-EMPTY: @@ -103,7 +103,7 @@ // CHECK-NEXT: #pragma clang diagnostic pop // CHECK-NEXT: } // namespace swift // CHECK-EMPTY: -// CHECK-NEXT: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK-NEXT: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { public struct StructWithIntField { let field: Int64 diff --git a/test/Interop/SwiftToCxx/structs/zero-sized-struct-in-cxx.swift b/test/Interop/SwiftToCxx/structs/zero-sized-struct-in-cxx.swift index 6b47d5bdf28..a49f84f5fca 100644 --- a/test/Interop/SwiftToCxx/structs/zero-sized-struct-in-cxx.swift +++ b/test/Interop/SwiftToCxx/structs/zero-sized-struct-in-cxx.swift @@ -2,7 +2,7 @@ // RUN: %target-swift-frontend %s -typecheck -module-name Structs -clang-header-expose-decls=all-public -emit-clang-header-path %t/structs.h // RUN: %FileCheck %s < %t/structs.h -// CHECK: namespace Structs __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Structs") { +// CHECK: namespace Structs SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("Structs") { // CHECK-NOT: class SWIFT_SYMBOL({{.*}}) ZeroSizedStruct final { diff --git a/test/Interop/SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift b/test/Interop/SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift index 713d439cb25..10df82ea847 100644 --- a/test/Interop/SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift +++ b/test/Interop/SwiftToCxxToSwift/hide-swift-module-namespace-in-swift.swift @@ -32,6 +32,6 @@ public func testFunction() -> String { return "" } -// CHECK: namespace Swift __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Swift") { -// CHECK: namespace SwiftMod __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("SwiftMod") { -// CHECK-NOT: namespace Swift { +// CHECK: namespace swift SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("swift") { +// CHECK: namespace SwiftMod SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("SwiftMod") { +// CHECK-NOT: namespace swift { diff --git a/test/PrintAsCxx/empty.swift b/test/PrintAsCxx/empty.swift index 2b765bceaac..32281bbf65b 100644 --- a/test/PrintAsCxx/empty.swift +++ b/test/PrintAsCxx/empty.swift @@ -103,7 +103,7 @@ // CHECK: } // namespace swift // CHECK-EMPTY: // CHECK-NEXT: #endif -// CHECK: namespace empty __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("empty") { +// CHECK: namespace empty SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("empty") { // CHECK: } // namespace empty // CHECK: #endif