mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[interop][SwiftToCxx] emit Swift's stdlib inside of 'swift' namespace
This commit is contained in:
@@ -163,6 +163,10 @@ swift::cxx_translation::getNameForCxx(const ValueDecl *VD,
|
|||||||
if (customNamesOnly)
|
if (customNamesOnly)
|
||||||
return StringRef();
|
return StringRef();
|
||||||
|
|
||||||
|
if (auto *mod = dyn_cast<ModuleDecl>(VD)) {
|
||||||
|
if (mod->isStdlibModule())
|
||||||
|
return "swift";
|
||||||
|
}
|
||||||
if (VD->getModuleContext()->isStdlibModule()) {
|
if (VD->getModuleContext()->isStdlibModule()) {
|
||||||
// Incorporate argument labels into Stdlib API names.
|
// Incorporate argument labels into Stdlib API names.
|
||||||
// FIXME: This should be done more broadly.
|
// FIXME: This should be done more broadly.
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void ClangSyntaxPrinter::printModuleNamespaceStart(
|
|||||||
const ModuleDecl &moduleContext) const {
|
const ModuleDecl &moduleContext) const {
|
||||||
os << "namespace ";
|
os << "namespace ";
|
||||||
printBaseName(&moduleContext);
|
printBaseName(&moduleContext);
|
||||||
os << " __attribute__((swift_private))";
|
os << " SWIFT_PRIVATE_ATTR";
|
||||||
printSymbolUSRAttribute(&moduleContext);
|
printSymbolUSRAttribute(&moduleContext);
|
||||||
os << " {\n";
|
os << " {\n";
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ void ClangSyntaxPrinter::printNamespace(
|
|||||||
os << "namespace ";
|
os << "namespace ";
|
||||||
namePrinter(os);
|
namePrinter(os);
|
||||||
if (trivia == NamespaceTrivia::AttributeSwiftPrivate)
|
if (trivia == NamespaceTrivia::AttributeSwiftPrivate)
|
||||||
os << " __attribute__((swift_private))";
|
os << " SWIFT_PRIVATE_ATTR";
|
||||||
if (moduleContext)
|
if (moduleContext)
|
||||||
printSymbolUSRAttribute(moduleContext);
|
printSymbolUSRAttribute(moduleContext);
|
||||||
os << " {\n\n";
|
os << " {\n\n";
|
||||||
|
|||||||
@@ -835,8 +835,8 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx(
|
|||||||
os << "#endif\n";
|
os << "#endif\n";
|
||||||
os << "#ifdef __cplusplus\n";
|
os << "#ifdef __cplusplus\n";
|
||||||
os << "namespace ";
|
os << "namespace ";
|
||||||
M.ValueDecl::getName().print(os);
|
ClangSyntaxPrinter(os).printBaseName(&M);
|
||||||
os << " __attribute__((swift_private))";
|
os << " SWIFT_PRIVATE_ATTR";
|
||||||
ClangSyntaxPrinter(os).printSymbolUSRAttribute(&M);
|
ClangSyntaxPrinter(os).printSymbolUSRAttribute(&M);
|
||||||
os << " {\n";
|
os << " {\n";
|
||||||
os << "namespace " << cxx_synthesis::getCxxImplNamespaceName() << " {\n";
|
os << "namespace " << cxx_synthesis::getCxxImplNamespaceName() << " {\n";
|
||||||
@@ -854,7 +854,7 @@ EmittedClangHeaderDependencyInfo swift::printModuleContentsAsCxx(
|
|||||||
|
|
||||||
// Construct a C++ namespace for the module.
|
// Construct a C++ namespace for the module.
|
||||||
ClangSyntaxPrinter(os).printNamespace(
|
ClangSyntaxPrinter(os).printNamespace(
|
||||||
[&](raw_ostream &os) { M.ValueDecl::getName().print(os); },
|
[&](raw_ostream &os) { ClangSyntaxPrinter(os).printBaseName(&M); },
|
||||||
[&](raw_ostream &os) { os << moduleOS.str(); },
|
[&](raw_ostream &os) { os << moduleOS.str(); },
|
||||||
ClangSyntaxPrinter::NamespaceTrivia::AttributeSwiftPrivate, &M);
|
ClangSyntaxPrinter::NamespaceTrivia::AttributeSwiftPrivate, &M);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "PrintClangValueType.h"
|
#include "PrintClangValueType.h"
|
||||||
#include "SwiftToClangInteropContext.h"
|
#include "SwiftToClangInteropContext.h"
|
||||||
#include "swift/ABI/MetadataValues.h"
|
#include "swift/ABI/MetadataValues.h"
|
||||||
|
#include "swift/AST/ASTContext.h"
|
||||||
#include "swift/AST/Decl.h"
|
#include "swift/AST/Decl.h"
|
||||||
#include "swift/AST/GenericParamList.h"
|
#include "swift/AST/GenericParamList.h"
|
||||||
#include "swift/AST/Module.h"
|
#include "swift/AST/Module.h"
|
||||||
@@ -218,7 +219,8 @@ public:
|
|||||||
llvm::function_ref<void()> body) {
|
llvm::function_ref<void()> body) {
|
||||||
if (!optionalKind || optionalKind == OTK_None)
|
if (!optionalKind || optionalKind == OTK_None)
|
||||||
return body();
|
return body();
|
||||||
os << "Swift::Optional<";
|
printBaseName(moduleContext->getASTContext().getStdlibModule());
|
||||||
|
os << "::Optional<";
|
||||||
body();
|
body();
|
||||||
os << '>';
|
os << '>';
|
||||||
}
|
}
|
||||||
@@ -718,7 +720,7 @@ ClangRepresentation DeclAndTypeClangFunctionPrinter::printFunctionSignature(
|
|||||||
|
|
||||||
// Print out the return type.
|
// Print out the return type.
|
||||||
if (FD->hasThrows() && outputLang == OutputLanguageMode::Cxx)
|
if (FD->hasThrows() && outputLang == OutputLanguageMode::Cxx)
|
||||||
os << "Swift::ThrowingResult<";
|
os << "swift::ThrowingResult<";
|
||||||
if (kind == FunctionSignatureKind::CFunctionProto) {
|
if (kind == FunctionSignatureKind::CFunctionProto) {
|
||||||
// First, verify that the C++ return type is representable.
|
// First, verify that the C++ return type is representable.
|
||||||
{
|
{
|
||||||
@@ -1330,17 +1332,17 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody(
|
|||||||
if (hasThrows) {
|
if (hasThrows) {
|
||||||
os << " if (opaqueError != nullptr)\n";
|
os << " if (opaqueError != nullptr)\n";
|
||||||
os << "#ifdef __cpp_exceptions\n";
|
os << "#ifdef __cpp_exceptions\n";
|
||||||
os << " throw (Swift::Error(opaqueError));\n";
|
os << " throw (swift::Error(opaqueError));\n";
|
||||||
os << "#else\n";
|
os << "#else\n";
|
||||||
if (resultTy->isVoid()) {
|
if (resultTy->isVoid()) {
|
||||||
os << " return Swift::Expected<void>(Swift::Error(opaqueError));\n";
|
os << " return swift::Expected<void>(swift::Error(opaqueError));\n";
|
||||||
os << "#endif\n";
|
os << "#endif\n";
|
||||||
} else {
|
} else {
|
||||||
auto directResultType = signature.getDirectResultType();
|
auto directResultType = signature.getDirectResultType();
|
||||||
printDirectReturnOrParamCType(
|
printDirectReturnOrParamCType(
|
||||||
*directResultType, resultTy, moduleContext, os, cPrologueOS,
|
*directResultType, resultTy, moduleContext, os, cPrologueOS,
|
||||||
typeMapping, interopContext, [&]() {
|
typeMapping, interopContext, [&]() {
|
||||||
os << " return Swift::Expected<";
|
os << " return swift::Expected<";
|
||||||
OptionalTypeKind retKind;
|
OptionalTypeKind retKind;
|
||||||
Type objTy;
|
Type objTy;
|
||||||
std::tie(objTy, retKind) =
|
std::tie(objTy, retKind) =
|
||||||
@@ -1348,7 +1350,7 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody(
|
|||||||
|
|
||||||
auto s = printClangFunctionReturnType(objTy, retKind, const_cast<ModuleDecl *>(moduleContext),
|
auto s = printClangFunctionReturnType(objTy, retKind, const_cast<ModuleDecl *>(moduleContext),
|
||||||
OutputLanguageMode::Cxx);
|
OutputLanguageMode::Cxx);
|
||||||
os << ">(Swift::Error(opaqueError));\n";
|
os << ">(swift::Error(opaqueError));\n";
|
||||||
os << "#endif\n";
|
os << "#endif\n";
|
||||||
|
|
||||||
// Return the function result value if it doesn't throw.
|
// Return the function result value if it doesn't throw.
|
||||||
|
|||||||
@@ -200,24 +200,27 @@ void swift::printSwiftToClangCoreScaffold(SwiftToClangInteropContext &ctx,
|
|||||||
PrimitiveTypeMapping &typeMapping,
|
PrimitiveTypeMapping &typeMapping,
|
||||||
raw_ostream &os) {
|
raw_ostream &os) {
|
||||||
ClangSyntaxPrinter printer(os);
|
ClangSyntaxPrinter printer(os);
|
||||||
printer.printNamespace("swift", [&](raw_ostream &) {
|
printer.printNamespace(
|
||||||
printer.printNamespace(
|
cxx_synthesis::getCxxSwiftNamespaceName(),
|
||||||
cxx_synthesis::getCxxImplNamespaceName(), [&](raw_ostream &) {
|
[&](raw_ostream &) {
|
||||||
printer.printExternC([&](raw_ostream &os) {
|
printer.printNamespace(
|
||||||
printTypeMetadataResponseType(ctx, typeMapping, os);
|
cxx_synthesis::getCxxImplNamespaceName(), [&](raw_ostream &) {
|
||||||
os << "\n";
|
printer.printExternC([&](raw_ostream &os) {
|
||||||
printValueWitnessTable(os);
|
printTypeMetadataResponseType(ctx, typeMapping, os);
|
||||||
os << "\n";
|
os << "\n";
|
||||||
printPrimitiveGenericTypeTraits(os, astContext, typeMapping,
|
printValueWitnessTable(os);
|
||||||
/*isCForwardDefinition=*/true);
|
os << "\n";
|
||||||
});
|
printPrimitiveGenericTypeTraits(os, astContext, typeMapping,
|
||||||
os << "\n";
|
/*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::NamespaceTrivia::AttributeSwiftPrivate);
|
||||||
ClangSyntaxPrinter(os).printIgnoredCxx17ExtensionDiagnosticBlock([&]() {
|
|
||||||
printPrimitiveGenericTypeTraits(os, astContext, typeMapping,
|
|
||||||
/*isCForwardDefinition=*/false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,13 @@
|
|||||||
#define SWIFT_SYMBOL_MODULE(moduleValue)
|
#define SWIFT_SYMBOL_MODULE(moduleValue)
|
||||||
#endif
|
#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 {
|
namespace _impl {
|
||||||
|
|
||||||
extern "C" void *_Nonnull swift_retain(void *_Nonnull) noexcept;
|
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
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
} // namespace swift
|
} // namespace swift SWIFT_PRIVATE_ATTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // SWIFT_CXX_INTEROPERABILITY_H
|
#endif // SWIFT_CXX_INTEROPERABILITY_H
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public:
|
|||||||
opaqueValue = other.opaqueValue;
|
opaqueValue = other.opaqueValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> SWIFT_INLINE_THUNK Swift::Optional<T> as() {
|
template <class T> SWIFT_INLINE_THUNK swift::Optional<T> as() {
|
||||||
alignas(alignof(T)) char buffer[sizeof(T)];
|
alignas(alignof(T)) char buffer[sizeof(T)];
|
||||||
const void *em = getErrorMetadata();
|
const void *em = getErrorMetadata();
|
||||||
void *ep = getPointerToOpaquePointer();
|
void *ep = getPointerToOpaquePointer();
|
||||||
@@ -207,10 +207,10 @@ public:
|
|||||||
swift::_impl::implClassFor<T>::type::initializeWithTake(dest,
|
swift::_impl::implClassFor<T>::type::initializeWithTake(dest,
|
||||||
buffer);
|
buffer);
|
||||||
});
|
});
|
||||||
return Swift::Optional<T>::init(result);
|
return swift::Optional<T>::init(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Swift::Optional<T>::none();
|
return swift::Optional<T>::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -236,7 +236,7 @@ public:
|
|||||||
has_val = false;
|
has_val = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Expected(const Swift::Error& error_val) noexcept {
|
constexpr Expected(const swift::Error &error_val) noexcept {
|
||||||
new (&buffer) Error(error_val);
|
new (&buffer) Error(error_val);
|
||||||
has_val = false;
|
has_val = false;
|
||||||
}
|
}
|
||||||
@@ -264,7 +264,7 @@ public:
|
|||||||
if (has_value())
|
if (has_value())
|
||||||
reinterpret_cast<const T *>(buffer)->~T();
|
reinterpret_cast<const T *>(buffer)->~T();
|
||||||
else
|
else
|
||||||
reinterpret_cast<Swift::Error *>(buffer)->~Error();
|
reinterpret_cast<swift::Error *>(buffer)->~Error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// assignment
|
/// assignment
|
||||||
@@ -313,22 +313,23 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get error
|
// Get error
|
||||||
constexpr Swift::Error const& error() const& {
|
constexpr swift::Error const &error() const & {
|
||||||
if (has_value())
|
if (has_value())
|
||||||
abort();
|
abort();
|
||||||
return reinterpret_cast<const Swift::Error&>(buffer);
|
return reinterpret_cast<const swift::Error &>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Swift::Error& error() & {
|
constexpr swift::Error &error() & {
|
||||||
if (has_value())
|
if (has_value())
|
||||||
abort();
|
abort();
|
||||||
return reinterpret_cast<Swift::Error&>(buffer);
|
return reinterpret_cast<swift::Error &>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool has_value() const noexcept { return has_val; }
|
constexpr bool has_value() const noexcept { return has_val; }
|
||||||
|
|
||||||
private:
|
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;
|
bool has_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -341,12 +342,11 @@ public:
|
|||||||
has_val = false;
|
has_val = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected(const Swift::Error& error_val) noexcept {
|
Expected(const swift::Error &error_val) noexcept {
|
||||||
new (&buffer) Error(error_val);
|
new (&buffer) Error(error_val);
|
||||||
has_val = false;
|
has_val = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Copy
|
/// Copy
|
||||||
Expected(Expected const& other) noexcept {
|
Expected(Expected const& other) noexcept {
|
||||||
if (other.has_value())
|
if (other.has_value())
|
||||||
@@ -361,9 +361,7 @@ public:
|
|||||||
// FIXME: Implement move semantics when move swift values is possible
|
// FIXME: Implement move semantics when move swift values is possible
|
||||||
[[noreturn]] Expected(Expected&&) noexcept { abort(); }
|
[[noreturn]] Expected(Expected&&) noexcept { abort(); }
|
||||||
|
|
||||||
~Expected() noexcept {
|
~Expected() noexcept { reinterpret_cast<swift::Error *>(buffer)->~Error(); }
|
||||||
reinterpret_cast<Swift::Error *>(buffer)->~Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// assignment
|
/// assignment
|
||||||
constexpr auto operator=(Expected&& other) noexcept = delete;
|
constexpr auto operator=(Expected&& other) noexcept = delete;
|
||||||
@@ -373,21 +371,21 @@ public:
|
|||||||
constexpr explicit operator bool() const noexcept { return has_value(); }
|
constexpr explicit operator bool() const noexcept { return has_value(); }
|
||||||
|
|
||||||
// Get error
|
// Get error
|
||||||
constexpr Swift::Error const& error() const& {
|
constexpr swift::Error const &error() const & {
|
||||||
if (has_value())
|
if (has_value())
|
||||||
abort();
|
abort();
|
||||||
return reinterpret_cast<const Swift::Error&>(buffer);
|
return reinterpret_cast<const swift::Error &>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Swift::Error& error() & {
|
constexpr swift::Error &error() & {
|
||||||
if (has_value())
|
if (has_value())
|
||||||
abort();
|
abort();
|
||||||
return reinterpret_cast<Swift::Error&>(buffer);
|
return reinterpret_cast<swift::Error &>(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool has_value() const noexcept { return has_val; }
|
constexpr bool has_value() const noexcept { return has_val; }
|
||||||
private:
|
private:
|
||||||
alignas(alignof(Swift::Error)) char buffer[sizeof(Swift::Error)];
|
alignas(alignof(swift::Error)) char buffer[sizeof(swift::Error)];
|
||||||
bool has_val;
|
bool has_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -400,10 +398,9 @@ using ThrowingResult = T;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template<class T>
|
template <class T> using ThrowingResult = swift::Expected<T>;
|
||||||
using ThrowingResult = Swift::Expected<T>;
|
|
||||||
|
|
||||||
#define SWIFT_RETURN_THUNK(T, v) Swift::Expected<T>(v)
|
#define SWIFT_RETURN_THUNK(T, v) swift::Expected<T>(v)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ public func takeTrivialInout(_ x: inout Trivial) {
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// 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<int> retNonTrivial() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK ns::NonTrivialTemplate<int> retNonTrivial() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate<int>)) char storage[sizeof(ns::NonTrivialTemplate<int>)];
|
// CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate<int>)) char storage[sizeof(ns::NonTrivialTemplate<int>)];
|
||||||
@@ -231,7 +231,7 @@ public func takeTrivialInout(_ x: inout Trivial) {
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// 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-EMPTY:
|
||||||
// CHECK-NEXT: SWIFT_INLINE_THUNK ns::NonTrivialTemplate<ns::TrivialinNS> retNonTrivial2() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT {
|
// CHECK-NEXT: SWIFT_INLINE_THUNK ns::NonTrivialTemplate<ns::TrivialinNS> retNonTrivial2() noexcept SWIFT_SYMBOL({{.*}}) SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate<ns::TrivialinNS>)) char storage[sizeof(ns::NonTrivialTemplate<ns::TrivialinNS>)];
|
// CHECK-NEXT: alignas(alignof(ns::NonTrivialTemplate<ns::TrivialinNS>)) char storage[sizeof(ns::NonTrivialTemplate<ns::TrivialinNS>)];
|
||||||
|
|||||||
@@ -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 * _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()
|
// CHECK: SWIFT_EXTERN void $s5Actor0A9WithFieldC6methodyyF(SWIFT_CONTEXT void * _Nonnull _self) SWIFT_NOEXCEPT SWIFT_CALL; // method()
|
||||||
|
|
||||||
|
|||||||
@@ -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: 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 * _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 $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-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: class SWIFT_SYMBOL("s:5Class0A12WithIntFieldC") ClassWithIntField;
|
||||||
// CHECK-NEXT: } // end namespace
|
// CHECK-NEXT: } // end namespace
|
||||||
@@ -43,7 +43,7 @@ public final class ClassWithIntField {
|
|||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
|
|
||||||
// CHECK: namespace
|
// 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: namespace
|
||||||
// CHECK-SAME: _impl {
|
// CHECK-SAME: _impl {
|
||||||
@@ -100,7 +100,7 @@ public final class ClassWithIntField {
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// 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: 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)));
|
// CHECK-NEXT: return _impl::_impl_ClassWithIntField::makeRetained(_impl::$s5Class011passThroughA12WithIntFieldyAA0adeF0CADF(::swift::_impl::_impl_RefCountedClass::getOpaquePointer(x)));
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ public func reprintedInImportedModule() -> Int {
|
|||||||
return 42
|
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 {
|
// CHECK: swift::Int reprintedInImportedModule() noexcept SWIFT_SYMBOL("s:4Core25reprintedInImportedModuleSiyF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// REQUIRES: PTRSIZE=64
|
// REQUIRES: PTRSIZE=64
|
||||||
|
|
||||||
// CHECK: namespace swift {
|
// CHECK: namespace swift SWIFT_PRIVATE_ATTR {
|
||||||
|
|
||||||
// CHECK: namespace _impl {
|
// CHECK: namespace _impl {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
// CHECK: #ifndef SWIFT_PRINTED_CORE
|
// CHECK: #ifndef SWIFT_PRINTED_CORE
|
||||||
// CHECK-NEXT: #define SWIFT_PRINTED_CORE
|
// CHECK-NEXT: #define SWIFT_PRINTED_CORE
|
||||||
// CHECK-NEXT: namespace swift {
|
// CHECK-NEXT: namespace swift SWIFT_PRIVATE_ATTR {
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
// CHECK-NEXT: namespace _impl {
|
// CHECK-NEXT: namespace _impl {
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public struct S {
|
|||||||
// CHECK-NEXT: #endif
|
// CHECK-NEXT: #endif
|
||||||
// CHECK-NEXT: vwTable->initializeWithTake(destStorage, srcStorage, metadata._0);
|
// CHECK-NEXT: vwTable->initializeWithTake(destStorage, srcStorage, metadata._0);
|
||||||
// CHECK-NEXT: }
|
// 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: SWIFT_INLINE_THUNK E E::_impl_x::operator()(double val) const {
|
||||||
// CHECK-NEXT: auto result = E::_make();
|
// CHECK-NEXT: auto result = E::_make();
|
||||||
// CHECK-NEXT: memcpy(result._getOpaquePointer(), &val, sizeof(val));
|
// CHECK-NEXT: memcpy(result._getOpaquePointer(), &val, sizeof(val));
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
public enum EmptyEnum {}
|
public enum EmptyEnum {}
|
||||||
public enum SingleCaseEnum { case first }
|
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: EmptyEnum final {
|
||||||
// CHECK-NOT: SingleCaseEnum final {
|
// CHECK-NOT: SingleCaseEnum final {
|
||||||
// CHECK: } // namespace Enums
|
// CHECK: } // namespace Enums
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
// CHECK: namespace function_with_array
|
// CHECK: namespace function_with_array
|
||||||
// FIXME: we don't actually emit a declaration for this, but for now at least
|
// FIXME: we don't actually emit a declaration for this, but for now at least
|
||||||
// check that we don't crash.
|
// check that we don't crash.
|
||||||
// CHECK: void f(const Swift::Array<swift::Int>&
|
// CHECK: void f(const swift::Array<swift::Int>&
|
||||||
public func f(_: [Int]) { }
|
public func f(_: [Int]) { }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// RUN: %check-interop-cxx-header-in-clang(%t/cdecl.h)
|
// 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: namespace _impl {
|
||||||
// CHECK: SWIFT_EXTERN int cfuncPassTwo(int x, int y) SWIFT_NOEXCEPT;
|
// CHECK: SWIFT_EXTERN int cfuncPassTwo(int x, int y) SWIFT_NOEXCEPT;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h)
|
// 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 {
|
// CHECK-LABEL: namespace _impl {
|
||||||
|
|
||||||
|
|||||||
@@ -22,14 +22,14 @@
|
|||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
// Test Empty Constructor
|
// Test Empty Constructor
|
||||||
auto testIntEmpty = Swift::Expected<int>();
|
auto testIntEmpty = swift::Expected<int>();
|
||||||
|
|
||||||
// Test Error Constructor
|
// Test Error Constructor
|
||||||
Swift::Error e;
|
swift::Error e;
|
||||||
auto testIntError = Swift::Expected<int>(e);
|
auto testIntError = swift::Expected<int>(e);
|
||||||
|
|
||||||
// Test Value Constructor
|
// Test Value Constructor
|
||||||
auto testIntValue = Swift::Expected<int>(42);
|
auto testIntValue = swift::Expected<int>(42);
|
||||||
|
|
||||||
// Test Copy Constructor
|
// Test Copy Constructor
|
||||||
auto testCopy = testIntEmpty;
|
auto testCopy = testIntEmpty;
|
||||||
@@ -37,9 +37,9 @@ int main() {
|
|||||||
// TODO: Test Move Constructor
|
// TODO: Test Move Constructor
|
||||||
|
|
||||||
// Test Destructor
|
// Test Destructor
|
||||||
auto testDestEmpty = Swift::Expected<int>();
|
auto testDestEmpty = swift::Expected<int>();
|
||||||
auto testDestInt = Swift::Expected<int>(42);
|
auto testDestInt = swift::Expected<int>(42);
|
||||||
auto testDestError = Swift::Expected<int>(e);
|
auto testDestError = swift::Expected<int>(e);
|
||||||
testDestEmpty.~Expected();
|
testDestEmpty.~Expected();
|
||||||
testDestInt.~Expected();
|
testDestInt.~Expected();
|
||||||
testDestError.~Expected();
|
testDestError.~Expected();
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ int main() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Functions::emptyThrowFunction();
|
Functions::emptyThrowFunction();
|
||||||
} catch (Swift::Error& e) {
|
} catch (swift::Error& e) {
|
||||||
printf("Exception\n");
|
printf("Exception\n");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Functions::throwFunction();
|
Functions::throwFunction();
|
||||||
} catch (Swift::Error& e) {
|
} catch (swift::Error& e) {
|
||||||
auto errorOpt = e.as<Functions::NaiveErrors>();
|
auto errorOpt = e.as<Functions::NaiveErrors>();
|
||||||
assert(errorOpt.isSome());
|
assert(errorOpt.isSome());
|
||||||
|
|
||||||
@@ -43,12 +43,12 @@ int main() {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Functions::throwFunctionWithReturn();
|
Functions::throwFunctionWithReturn();
|
||||||
} catch (Swift::Error& e) {
|
} catch (swift::Error& e) {
|
||||||
printf("Exception\n");
|
printf("Exception\n");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Functions::testDestroyedError();
|
Functions::testDestroyedError();
|
||||||
} catch(const Swift::Error &e) { }
|
} catch(const swift::Error &e) { }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// for experimental feature GenerateBindingsForThrowingFunctionsInCXX:
|
// for experimental feature GenerateBindingsForThrowingFunctionsInCXX:
|
||||||
// REQUIRES: asserts
|
// 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 {
|
// CHECK-LABEL: namespace _impl {
|
||||||
|
|
||||||
@@ -33,15 +33,15 @@ public enum NaiveErrors : Error {
|
|||||||
@_expose(Cxx)
|
@_expose(Cxx)
|
||||||
public func emptyThrowFunction() throws { print("passEmptyThrowFunction") }
|
public func emptyThrowFunction() throws { print("passEmptyThrowFunction") }
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult<void> emptyThrowFunction() SWIFT_SYMBOL("s:9Functions18emptyThrowFunctionyyKF") {
|
// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult<void> emptyThrowFunction() SWIFT_SYMBOL("s:9Functions18emptyThrowFunctionyyKF") {
|
||||||
// CHECK: void* opaqueError = nullptr;
|
// CHECK: void* opaqueError = nullptr;
|
||||||
// CHECK: void* _ctx = nullptr;
|
// CHECK: void* _ctx = nullptr;
|
||||||
// CHECK: _impl::$s9Functions18emptyThrowFunctionyyKF(_ctx, &opaqueError);
|
// CHECK: _impl::$s9Functions18emptyThrowFunctionyyKF(_ctx, &opaqueError);
|
||||||
// CHECK: if (opaqueError != nullptr)
|
// CHECK: if (opaqueError != nullptr)
|
||||||
// CHECK: #ifdef __cpp_exceptions
|
// CHECK: #ifdef __cpp_exceptions
|
||||||
// CHECK: throw (Swift::Error(opaqueError));
|
// CHECK: throw (swift::Error(opaqueError));
|
||||||
// CHECK: #else
|
// CHECK: #else
|
||||||
// CHECK: return Swift::Expected<void>(Swift::Error(opaqueError));
|
// CHECK: return swift::Expected<void>(swift::Error(opaqueError));
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
// CHECK: }
|
// CHECK: }
|
||||||
|
|
||||||
@@ -59,15 +59,15 @@ public struct DestroyedError : Error {
|
|||||||
@_expose(Cxx)
|
@_expose(Cxx)
|
||||||
public func testDestroyedError() throws { throw DestroyedError() }
|
public func testDestroyedError() throws { throw DestroyedError() }
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult<void> testDestroyedError() SWIFT_SYMBOL("s:9Functions18testDestroyedErroryyKF") {
|
// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult<void> testDestroyedError() SWIFT_SYMBOL("s:9Functions18testDestroyedErroryyKF") {
|
||||||
// CHECK: void* opaqueError = nullptr;
|
// CHECK: void* opaqueError = nullptr;
|
||||||
// CHECK: void* _ctx = nullptr;
|
// CHECK: void* _ctx = nullptr;
|
||||||
// CHECK: _impl::$s9Functions18testDestroyedErroryyKF(_ctx, &opaqueError);
|
// CHECK: _impl::$s9Functions18testDestroyedErroryyKF(_ctx, &opaqueError);
|
||||||
// CHECK: if (opaqueError != nullptr)
|
// CHECK: if (opaqueError != nullptr)
|
||||||
// CHECK: #ifdef __cpp_exceptions
|
// CHECK: #ifdef __cpp_exceptions
|
||||||
// CHECK: throw (Swift::Error(opaqueError));
|
// CHECK: throw (swift::Error(opaqueError));
|
||||||
// CHECK: #else
|
// CHECK: #else
|
||||||
// CHECK: return Swift::Expected<void>(Swift::Error(opaqueError));
|
// CHECK: return swift::Expected<void>(swift::Error(opaqueError));
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
// CHECK: }
|
// CHECK: }
|
||||||
|
|
||||||
@@ -77,15 +77,15 @@ public func throwFunction() throws {
|
|||||||
throw NaiveErrors.throwError
|
throw NaiveErrors.throwError
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult<void> throwFunction() SWIFT_SYMBOL("s:9Functions13throwFunctionyyKF") {
|
// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult<void> throwFunction() SWIFT_SYMBOL("s:9Functions13throwFunctionyyKF") {
|
||||||
// CHECK: void* opaqueError = nullptr;
|
// CHECK: void* opaqueError = nullptr;
|
||||||
// CHECK: void* _ctx = nullptr;
|
// CHECK: void* _ctx = nullptr;
|
||||||
// CHECK: _impl::$s9Functions13throwFunctionyyKF(_ctx, &opaqueError);
|
// CHECK: _impl::$s9Functions13throwFunctionyyKF(_ctx, &opaqueError);
|
||||||
// CHECK: if (opaqueError != nullptr)
|
// CHECK: if (opaqueError != nullptr)
|
||||||
// CHECK: #ifdef __cpp_exceptions
|
// CHECK: #ifdef __cpp_exceptions
|
||||||
// CHECK: throw (Swift::Error(opaqueError));
|
// CHECK: throw (swift::Error(opaqueError));
|
||||||
// CHECK: #else
|
// CHECK: #else
|
||||||
// CHECK: return Swift::Expected<void>(Swift::Error(opaqueError));
|
// CHECK: return swift::Expected<void>(swift::Error(opaqueError));
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
// CHECK: }
|
// CHECK: }
|
||||||
|
|
||||||
@@ -98,15 +98,15 @@ public func throwFunctionWithPossibleReturn(_ a: Int) throws -> Int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult<swift::Int> throwFunctionWithPossibleReturn(swift::Int a) SWIFT_SYMBOL("s:9Functions31throwFunctionWithPossibleReturnyS2iKF") SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult<swift::Int> throwFunctionWithPossibleReturn(swift::Int a) SWIFT_SYMBOL("s:9Functions31throwFunctionWithPossibleReturnyS2iKF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK: void* opaqueError = nullptr;
|
// CHECK: void* opaqueError = nullptr;
|
||||||
// CHECK: void* _ctx = nullptr;
|
// CHECK: void* _ctx = nullptr;
|
||||||
// CHECK: auto returnValue = _impl::$s9Functions31throwFunctionWithPossibleReturnyS2iKF(a, _ctx, &opaqueError);
|
// CHECK: auto returnValue = _impl::$s9Functions31throwFunctionWithPossibleReturnyS2iKF(a, _ctx, &opaqueError);
|
||||||
// CHECK: if (opaqueError != nullptr)
|
// CHECK: if (opaqueError != nullptr)
|
||||||
// CHECK: #ifdef __cpp_exceptions
|
// CHECK: #ifdef __cpp_exceptions
|
||||||
// CHECK: throw (Swift::Error(opaqueError));
|
// CHECK: throw (swift::Error(opaqueError));
|
||||||
// CHECK: #else
|
// CHECK: #else
|
||||||
// CHECK: return Swift::Expected<swift::Int>(Swift::Error(opaqueError));
|
// CHECK: return swift::Expected<swift::Int>(swift::Error(opaqueError));
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
// CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue);
|
// CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue);
|
||||||
// CHECK: }
|
// CHECK: }
|
||||||
@@ -118,14 +118,14 @@ public func throwFunctionWithReturn() throws -> Int {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::ThrowingResult<swift::Int> throwFunctionWithReturn() SWIFT_SYMBOL("s:9Functions23throwFunctionWithReturnSiyKF") SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK swift::ThrowingResult<swift::Int> throwFunctionWithReturn() SWIFT_SYMBOL("s:9Functions23throwFunctionWithReturnSiyKF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK: void* opaqueError = nullptr;
|
// CHECK: void* opaqueError = nullptr;
|
||||||
// CHECK: void* _ctx = nullptr;
|
// CHECK: void* _ctx = nullptr;
|
||||||
// CHECK: auto returnValue = _impl::$s9Functions23throwFunctionWithReturnSiyKF(_ctx, &opaqueError);
|
// CHECK: auto returnValue = _impl::$s9Functions23throwFunctionWithReturnSiyKF(_ctx, &opaqueError);
|
||||||
// CHECK: #ifdef __cpp_exceptions
|
// CHECK: #ifdef __cpp_exceptions
|
||||||
// CHECK: throw (Swift::Error(opaqueError));
|
// CHECK: throw (swift::Error(opaqueError));
|
||||||
// CHECK: #else
|
// CHECK: #else
|
||||||
// CHECK: return Swift::Expected<swift::Int>(Swift::Error(opaqueError));
|
// CHECK: return swift::Expected<swift::Int>(swift::Error(opaqueError));
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
// CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue);
|
// CHECK: return SWIFT_RETURN_THUNK(swift::Int, returnValue);
|
||||||
// CHECK: }
|
// CHECK: }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// RUN: %check-interop-cxx-header-in-clang(%t/functions.h)
|
// 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 {
|
// CHECK-LABEL: namespace _impl {
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// CHECK-NOT: SWIFT_EXTERN bool $s9Functions24alwaysEmitIntoClientFuncyS2bF(bool x) SWIFT_NOEXCEPT SWIFT_CALL; // alwaysEmitIntoClientFunc(_:)
|
// 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-EMPTY:
|
// CHECK-EMPTY:
|
||||||
// CHECK-NEXT: } // namespace Functions
|
// CHECK-NEXT: } // namespace Functions
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
// CHECK-NOT: SWIFT_EXTERN double $s9Functions9asyncFuncyS2dYaF(double x) SWIFT_NOEXCEPT SWIFT_CALL; // asyncFunc(_:)
|
// 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-EMPTY:
|
// CHECK-EMPTY:
|
||||||
// CHECK-NEXT: } // namespace Functions
|
// CHECK-NEXT: } // namespace Functions
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public struct LaterGeneric<T> {
|
|||||||
// CHECK: class SWIFT_SYMBOL("s:8Generics14ComesFirstEnumO") ComesFirstEnum final {
|
// CHECK: class SWIFT_SYMBOL("s:8Generics14ComesFirstEnumO") ComesFirstEnum final {
|
||||||
// CHECK: LaterGeneric<ComesFirstEnum> returnsLaterOpt() const SWIFT_SYMBOL("s:8Generics14ComesFirstEnumO15returnsLaterOptAA0F7GenericVyACGyF");
|
// CHECK: LaterGeneric<ComesFirstEnum> 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-EMPTY:
|
||||||
// CHECK-NEXT: namespace _impl {
|
// CHECK-NEXT: namespace _impl {
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// CHECK-NEXT: #endif
|
// CHECK-NEXT: #endif
|
||||||
// CHECK-NEXT: #define SWIFT_SYMBOL(usrValue) SWIFT_SYMBOL_MODULE_USR("Test", usrValue)
|
// 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: } // namespace Test
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
// CHECK-NEXT: #undef SWIFT_SYMBOL
|
// CHECK-NEXT: #undef SWIFT_SYMBOL
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public func printArray(_ val: Array<CInt>) {
|
|||||||
#include "UseArray.h"
|
#include "UseArray.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
|
|
||||||
{
|
{
|
||||||
Array<int> val = UseArray::createArray(2);
|
Array<int> val = UseArray::createArray(2);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public func resetOpt<T>(_ val: inout Optional<T>) {
|
|||||||
#include "UseOptional.h"
|
#include "UseOptional.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
using namespace UseOptional;
|
using namespace UseOptional;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,21 +54,21 @@ public func resetOpt<T>(_ val: inout Optional<T>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::Optional<int> createCIntOpt(int val) noexcept SWIFT_SYMBOL("s:11UseOptional13createCIntOptys5Int32VSgADF") SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK swift::Optional<int> createCIntOpt(int val) noexcept SWIFT_SYMBOL("s:11UseOptional13createCIntOptys5Int32VSgADF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK-NEXT: return Swift::_impl::_impl_Optional<int>::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES {
|
// CHECK-NEXT: return swift::_impl::_impl_Optional<int>::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: _impl::swift_interop_returnDirect_UseOptional_[[CINTENC:[a-z0-9_]+]](result, _impl::$s11UseOptional13createCIntOptys5Int32VSgADF(val));
|
||||||
// CHECK-NEXT: });
|
// CHECK-NEXT: });
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::Optional<Klass> createKlassOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional14createKlassOptyAA0D0CSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK swift::Optional<Klass> createKlassOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional14createKlassOptyAA0D0CSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK-NEXT: return Swift::_impl::_impl_Optional<Klass>::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES {
|
// CHECK-NEXT: return swift::_impl::_impl_Optional<Klass>::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: _impl::swift_interop_returnDirect_UseOptional_[[CLASSENC:[a-z0-9_]+]](result, _impl::$s11UseOptional14createKlassOptyAA0D0CSgs5Int16VF(val));
|
||||||
// CHECK-NEXT: });
|
// CHECK-NEXT: });
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::Optional<SmallStruct> createSmallStructOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT {
|
// CHECK: SWIFT_INLINE_THUNK swift::Optional<SmallStruct> createSmallStructOpt(int16_t val) noexcept SWIFT_SYMBOL("s:11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF") SWIFT_WARN_UNUSED_RESULT {
|
||||||
// CHECK-NEXT: return Swift::_impl::_impl_Optional<SmallStruct>::returnNewValue([&](char * _Nonnull result) SWIFT_INLINE_THUNK_ATTRIBUTES {
|
// CHECK-NEXT: return swift::_impl::_impl_Optional<SmallStruct>::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: _impl::swift_interop_returnDirect_UseOptional_uint32_t_0_4(result, _impl::$s11UseOptional20createSmallStructOptyAA0dE0VSgs5Int16VF(val));
|
||||||
// CHECK-NEXT: });
|
// CHECK-NEXT: });
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
@@ -78,24 +78,24 @@ public func resetOpt<T>(_ val: inout Optional<T>) {
|
|||||||
// CHECK-NEXT: #ifdef __cpp_concepts
|
// CHECK-NEXT: #ifdef __cpp_concepts
|
||||||
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
|
// CHECK-NEXT: requires swift::isUsableInGenericContext<T_0_0>
|
||||||
// CHECK-NEXT: #endif
|
// CHECK-NEXT: #endif
|
||||||
// CHECK-NEXT: SWIFT_INLINE_THUNK void resetOpt(Swift::Optional<T_0_0>& val) noexcept SWIFT_SYMBOL("s:11UseOptional8resetOptyyxSgzlF") {
|
// CHECK-NEXT: SWIFT_INLINE_THUNK void resetOpt(swift::Optional<T_0_0>& val) noexcept SWIFT_SYMBOL("s:11UseOptional8resetOptyyxSgzlF") {
|
||||||
// CHECK-NEXT: #ifndef __cpp_concepts
|
// CHECK-NEXT: #ifndef __cpp_concepts
|
||||||
// CHECK-NEXT: static_assert(swift::isUsableInGenericContext<T_0_0>, "type cannot be used in a Swift generic context");
|
// CHECK-NEXT: static_assert(swift::isUsableInGenericContext<T_0_0>, "type cannot be used in a Swift generic context");
|
||||||
// CHECK-NEXT: #endif
|
// CHECK-NEXT: #endif
|
||||||
// CHECK-NEXT: return _impl::$s11UseOptional8resetOptyyxSgzlF(Swift::_impl::_impl_Optional<T_0_0>::getOpaquePointer(val), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
|
// CHECK-NEXT: return _impl::$s11UseOptional8resetOptyyxSgzlF(swift::_impl::_impl_Optional<T_0_0>::getOpaquePointer(val), swift::TypeMetadataTrait<T_0_0>::getTypeMetadata());
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK void takeCIntOpt(const Swift::Optional<int>& val) noexcept SWIFT_SYMBOL("s:11UseOptional11takeCIntOptyys5Int32VSgF") {
|
// CHECK: SWIFT_INLINE_THUNK void takeCIntOpt(const swift::Optional<int>& val) noexcept SWIFT_SYMBOL("s:11UseOptional11takeCIntOptyys5Int32VSgF") {
|
||||||
// CHECK-NEXT: return _impl::$s11UseOptional11takeCIntOptyys5Int32VSgF(_impl::swift_interop_passDirect_UseOptional_[[CINTENC]](Swift::_impl::_impl_Optional<int>::getOpaquePointer(val)));
|
// CHECK-NEXT: return _impl::$s11UseOptional11takeCIntOptyys5Int32VSgF(_impl::swift_interop_passDirect_UseOptional_[[CINTENC]](swift::_impl::_impl_Optional<int>::getOpaquePointer(val)));
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK void takeKlassOpt(const Swift::Optional<Klass>& val) noexcept SWIFT_SYMBOL("s:11UseOptional12takeKlassOptyyAA0D0CSgF") {
|
// CHECK: SWIFT_INLINE_THUNK void takeKlassOpt(const swift::Optional<Klass>& val) noexcept SWIFT_SYMBOL("s:11UseOptional12takeKlassOptyyAA0D0CSgF") {
|
||||||
// CHECK-NEXT: return _impl::$s11UseOptional12takeKlassOptyyAA0D0CSgF(_impl::swift_interop_passDirect_UseOptional_[[CLASSENC]](Swift::_impl::_impl_Optional<Klass>::getOpaquePointer(val)));
|
// CHECK-NEXT: return _impl::$s11UseOptional12takeKlassOptyyAA0D0CSgF(_impl::swift_interop_passDirect_UseOptional_[[CLASSENC]](swift::_impl::_impl_Optional<Klass>::getOpaquePointer(val)));
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|
||||||
|
|
||||||
// CHECK: SWIFT_INLINE_THUNK void takeSmallStructOpt(const Swift::Optional<SmallStruct>& val) noexcept SWIFT_SYMBOL("s:11UseOptional18takeSmallStructOptyyAA0dE0VSgF") {
|
// CHECK: SWIFT_INLINE_THUNK void takeSmallStructOpt(const swift::Optional<SmallStruct>& val) noexcept SWIFT_SYMBOL("s:11UseOptional18takeSmallStructOptyyAA0dE0VSgF") {
|
||||||
// CHECK-NEXT: return _impl::$s11UseOptional18takeSmallStructOptyyAA0dE0VSgF(_impl::swift_interop_passDirect_UseOptional_uint32_t_0_4(Swift::_impl::_impl_Optional<SmallStruct>::getOpaquePointer(val)));
|
// CHECK-NEXT: return _impl::$s11UseOptional18takeSmallStructOptyyAA0dE0VSgF(_impl::swift_interop_passDirect_UseOptional_uint32_t_0_4(swift::_impl::_impl_Optional<SmallStruct>::getOpaquePointer(val)));
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ public func test() -> String {
|
|||||||
return ""
|
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 {
|
// CHECK: class SWIFT_SYMBOL("{{.*}}") String final {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public func makeString(_ s: String, _ y: String) -> String {
|
|||||||
#include "Stringer.h"
|
#include "Stringer.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
using namespace Stringer;
|
using namespace Stringer;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public func printString(_ s: String) {
|
|||||||
#include "Stringer.h"
|
#include "Stringer.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
using namespace Stringer;
|
using namespace Stringer;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public func createString(_ ptr: UnsafePointer<CChar>) -> String {
|
|||||||
#include "StringCreator.h"
|
#include "StringCreator.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
auto emptyString = String::init();
|
auto emptyString = String::init();
|
||||||
NSString *nsStr = emptyString;
|
NSString *nsStr = emptyString;
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ int main() {
|
|||||||
#include "StringCreator.h"
|
#include "StringCreator.h"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
using namespace Swift;
|
using namespace swift;
|
||||||
|
|
||||||
auto emptyString = String::init();
|
auto emptyString = String::init();
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
// 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<class T_0_0>
|
// CHECK: template<class T_0_0>
|
||||||
// CHECK-NEXT: #ifdef __cpp_concepts
|
// CHECK-NEXT: #ifdef __cpp_concepts
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
// CHECK: SWIFT_INLINE_THUNK UTF8View(UTF8View &&) { abort(); }
|
// 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 getStartIndex() const SWIFT_SYMBOL({{.*}});
|
||||||
// CHECK-NEXT: SWIFT_INLINE_THUNK String_Index getEndIndex() const SWIFT_SYMBOL({{.*}});
|
// CHECK-NEXT: SWIFT_INLINE_THUNK String_Index getEndIndex() const SWIFT_SYMBOL({{.*}});
|
||||||
// CHECK: SWIFT_INLINE_THUNK Swift::Optional<String_Index> indexOffsetByLimitedBy(const String_Index& i, swift::Int n, const String_Index& limit) const SWIFT_SYMBOL({{.*}});
|
// CHECK: SWIFT_INLINE_THUNK swift::Optional<String_Index> 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 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 uint8_t operator [](const String_Index& i) const SWIFT_SYMBOL({{.*}});
|
||||||
// CHECK: SWIFT_INLINE_THUNK String getDescription() const SWIFT_SYMBOL({{.*}});
|
// CHECK: SWIFT_INLINE_THUNK String getDescription() const SWIFT_SYMBOL({{.*}});
|
||||||
@@ -124,4 +124,4 @@
|
|||||||
// CHECK-NEXT: #include <swiftToCxx/_SwiftStdlibCxxOverlay.h>
|
// CHECK-NEXT: #include <swiftToCxx/_SwiftStdlibCxxOverlay.h>
|
||||||
// CHECK-NEXT: #endif
|
// CHECK-NEXT: #endif
|
||||||
|
|
||||||
// CHECK: } // namespace Swift
|
// CHECK: } // namespace swift
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public struct FirstSmallStruct {
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// 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 {
|
@frozen public struct FrozenStruct {
|
||||||
private let storedInt: Int32
|
private let storedInt: Int32
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
// RUN: %check-interop-cxx-header-in-clang(%t/structs.h -Wno-unused-private-field -Wno-unused-function)
|
// 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 _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: class SWIFT_SYMBOL("s:7Structs18StructWithIntFieldV") StructWithIntField;
|
||||||
// CHECK-NEXT: } // end namespace
|
// CHECK-NEXT: } // end namespace
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// 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: namespace _impl {
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
// CHECK-NEXT: #pragma clang diagnostic pop
|
// CHECK-NEXT: #pragma clang diagnostic pop
|
||||||
// CHECK-NEXT: } // namespace swift
|
// CHECK-NEXT: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// 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 {
|
public struct StructWithIntField {
|
||||||
let field: Int64
|
let field: Int64
|
||||||
|
|||||||
@@ -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: %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
|
// 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 {
|
// CHECK-NOT: class SWIFT_SYMBOL({{.*}}) ZeroSizedStruct final {
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ public func testFunction() -> String {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: namespace Swift __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("Swift") {
|
// CHECK: namespace swift SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("swift") {
|
||||||
// CHECK: namespace SwiftMod __attribute__((swift_private)) SWIFT_SYMBOL_MODULE("SwiftMod") {
|
// CHECK: namespace SwiftMod SWIFT_PRIVATE_ATTR SWIFT_SYMBOL_MODULE("SwiftMod") {
|
||||||
// CHECK-NOT: namespace Swift {
|
// CHECK-NOT: namespace swift {
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
// CHECK: } // namespace swift
|
// CHECK: } // namespace swift
|
||||||
// CHECK-EMPTY:
|
// CHECK-EMPTY:
|
||||||
// CHECK-NEXT: #endif
|
// 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: } // namespace empty
|
||||||
// CHECK: #endif
|
// CHECK: #endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user