Commit Graph

92 Commits

Author SHA1 Message Date
Alex Lorenz
3a9b6dce9d [interop][SwiftToCxx] add support for emitting Swift stdlib dependency in one header file
This is the default behavior. You can disable this by specifying the -clang-header-expose-decls= flag explicitly when generating the header
2022-09-28 08:08:48 -07:00
Alex Lorenz
f4de75ae2c [interop][SwiftToCxx] 'self' param should be handled by type param visitor 2022-09-07 12:45:38 -07:00
Alex Lorenz
1696f94223 [interop][SwiftToCxx] reimplement function lowering to correctly distinguish between direct/indirect return values and parameters 2022-09-07 11:43:38 -07:00
Alex Lorenz
e98d908ff5 Merge pull request #60858 from Robertorosmaninho/cxx-interop/SwiftToCxxErrorHandling
[SwiftToCxx] Including Cxx representation of Swift's Error
2022-09-07 08:55:27 -07:00
Roberto Rosmaninho
68bfbddf14 [SwiftToCxx] Creating new test case and fixing namespace 2022-09-05 10:38:28 -03:00
Alex Lorenz
983588851e [interop][SwiftToCxx] fix function_with_array.swift test 2022-08-31 15:31:04 -07:00
Roberto Rosmaninho
9ebc0bd26e [SwiftToCxx] Trowing Swift::Error instead of NaiveException 2022-08-30 16:25:17 -03:00
Doug Gregor
aa05d4a2c9 Move new test where it belongs 2022-08-30 11:09:41 -07:00
Roberto Rosmaninho
ec10c5f5e6 [SwiftToCxx] Adding _Nullable to avoid warnings 2022-08-30 14:15:45 -03:00
Alex Lorenz
d4a7f86e3d [interop][SwiftToCxx] do not emit unsupported function signatures yet 2022-08-16 14:39:22 -07:00
Tongjie Wang
19c7d79540 Add missing pointer nullability annotation for inout function 2022-07-29 02:29:15 -07:00
Alex Lorenz
0edddde7ae [interop][SwiftToCxx] Add inout support for UnsafePointer/UnsafeMutablePointer param types 2022-07-26 15:39:29 +01:00
Alex Lorenz
9a80d78263 [interop][SwiftToCxx] pass and return UnsafePointer/UnsafeMutablePointer types 2022-07-26 15:30:14 +01:00
Roberto Rosmaninho
da8847d907 Replacing iostream by cstdio and cout by printf 2022-07-19 15:03:31 -03:00
Roberto Rosmaninho
b15c6a5537 Implementing a naive exception to be thrown in C++ if an Error is thrown in Swift
Creating new Interop - SwiftToCxx test
2022-07-15 20:14:13 -03:00
Roberto Rosmaninho
ff222acebc Setting hardcode SWIFT_NOEXCEPT and noexcept flags only to
non-throwing functions.
Activating swift-functions-errors tests
Inserting macros and additional parameters in C and C++ functions following the pattern to lowering to LLVM IR.
2022-07-14 12:34:53 -03:00
Alex Lorenz
d7fd1233a9 [interop][SwiftToCxx] emit instance property getters for structs 2022-06-14 17:20:37 -07:00
Tongjie Wang
0505266ef7 fix printing for inout type with nullability 2022-06-14 11:20:19 -07:00
Tongjie Wang
96da7dbe0c disable availability checking for async test 2022-06-09 10:06:33 -07:00
Tongjie Wang
f6443f0684 fix test case for concurrency availability 2022-06-08 10:37:19 -07:00
Tongjie Wang
abfccd1613 expose @_transparent; don't expose @_alwaysEmitIntoClient and async 2022-06-07 16:21:58 -07:00
Tongjie Wang
c295db47ec [cxx-interop] Don't expose unsupported top-level async or @_transparent functions 2022-06-06 20:43:57 -07:00
Alex Lorenz
0591246907 Merge pull request #59217 from Robertorosmaninho/interop/SwiftToCXXErrorTest
[Interop] [SwiftToCxx] New Throw Error Test
2022-06-02 19:41:33 -07:00
Roberto Rosmaninho
c4ca064327 Creating new test to check that a function don't throws when it should throw 2022-06-02 00:46:01 -03:00
Tongjie Wang
fb926800f7 add test for generated C declaration 2022-06-01 11:14:35 -07:00
Tongjie Wang
b9c492aed4 print as pointer type in C layer 2022-05-31 20:23:04 -07:00
Tongjie Wang
ba2dcfb389 [cxx-interop] support inout params as cxx references 2022-05-29 20:55:13 -07:00
Tongjie Wang
3adb9d3888 add pass through test for simd vector cxx interop 2022-04-12 04:37:48 -07:00
Alex Lorenz
8d4366b2d5 [cxx-interop] emit correct parameter name in the inline C++ function when the identifier conflicts with a keyword 2022-03-30 10:08:49 -07:00
Alex Lorenz
f7902a6095 [cxx-interop] Emit C++ inline function thunks that with correct primitive types 2022-03-29 13:37:01 -07:00
Alex Lorenz
80bc75ab9b [cxx-interop] Emit C++ declarations only when '-clang-header-expose-public-decl' is enabled
This fix also ensures that we only emit C++ functions for now
2022-03-20 20:22:02 -07:00
Alex Lorenz
2e3aa87737 Revert "Revert "Merge pull request #41831 from hyp/unify-header""
This reverts commit 4c9582c295.
2022-03-19 13:36:28 -07:00
Alex Lorenz
4c9582c295 Revert "Merge pull request #41831 from hyp/unify-header"
This reverts commit cd93d23bac, reversing
changes made to f9f5476e9a.
2022-03-18 10:03:07 -07:00
Alex Lorenz
9d52099d5b [cxx-interop] start to emitting a unified header file for a Swift module
This change removes the -emit-cxx-header option, and adds a new -emit-clang-header-path option instead. It's aliased to -emit-objc-header-path for now, but in the future, -emit-objc-header-path will alias to it. After this change Swift can start emitting a single header file that can be expose declarations to C, Objective-C, or C++. For now C++ interface is generated (for all public decls) only when -enable-cxx-interop flag is passed, but that behavior will change once  attribute is supported.
2022-03-17 10:34:47 -07:00
Alex Lorenz
6b8108bf59 [cxx-interop] use SWIFT_EXTERN for Swift function prototypes
This will allow these functions to be used from C.
2022-03-13 12:11:35 -07:00
Alex Lorenz
858a847d27 [cxx-interop] use SWIFT_NOEXCEPT for Swift function prototypes
This will allow these functions to be used from C.

Also add a static_assert to verify that noexcept is actually used.
2022-03-13 11:08:32 -07:00
Alex Lorenz
2c2fa566d8 [cxx-interop][test] add %check-interop-cxx-header-in-clang test command substitution to parse and validated generated C++ header in multiple C++ language modes
This ensures that we validate C++14, C++17, and C++20
2022-03-11 20:51:24 -08:00
Alex Lorenz
ebcf2f707a [interop] fixup the interop build test substitutions 2022-03-10 10:19:06 -08:00
Alex Lorenz
07a1f569c6 [interop] add target-interop-clangxx test expansion to build C++ file with /MD msvc mode 2022-03-10 09:27:05 -08:00
Alex Lorenz
846fdb5307 [interop] add target-build-swift-link-cxx option for windows to link correctly 2022-03-10 08:05:52 -08:00
Alex Lorenz
1d3b68208e [interop][SwiftToC++] fix execution tests to hopefully link correctly on windows 2022-03-09 20:44:16 -08:00
Alex Lorenz
fcdcb2a9f1 [interop][SwiftToC++] print C++ interface for top-level Swift functions 2022-03-09 14:53:12 -08:00