Commit Graph

24 Commits

Author SHA1 Message Date
Arnold Schwaighofer
2c00862ed9 Fix ClangImporter directory 2023-06-20 12:48:24 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Alex Lorenz
9feb76419b [interop] ignore exceptions in existing interop tests 2023-02-22 11:00:51 -08:00
Anthony Latsis
9596dcd1df Gardening: Migrate test suite to GH issues: ClangImporter 2022-08-12 06:58:42 +03:00
Ehud Adler
0056129d57 [cxx-interop] std::string::push_back is broken (#41240)
* [cxx-interop] fix  std::string::push_back by fixing mapping between clang/swift self/this type for cxx methods

* cleanup

* Fix unit test

* XFail test: operators/member-inline on linux-android

* add `C++` in expandExternalSignatureTypes comment

* Fix rebase

* Fix mapping issue in externalizeArguments

* Improve cxx_interop_ir test regex
2022-03-08 13:09:38 -05:00
zoecarver
b8e52a7ad2 [cxx-interop] Lazily import members of Clang namespaces and records via requests.
Also adds a ClangImporter request zone and move some requests into it.
2021-10-20 14:52:43 -07:00
Egor Zhdan
04dde14124 C++ Interop: fix ClangImporter/cxx_interop_ir.swift on 32-bit
Fixes SR-14986
2021-07-29 10:30:01 +03:00
Mishal Shah
b897e0c0c5 Disable cxx_interop_ir test (SR-14986) 2021-07-28 22:17:23 -07:00
Egor Zhdan
a8f126f7cd C++ Interop: import const methods as non-mutating
This change makes ClangImporter import some C++ member functions as non-mutating, given that they satisfy two requirements:
* the function itself is marked as `const`
* the parent struct doesn't contain any `mutable` members

`get` accessors of subscript operators are now also imported as non-mutating if the C++ `operator[]` satisfies the requirements above.

Fixes SR-12795.
2021-07-25 15:18:33 +03:00
Egor Zhdan
e6a3905b04 Mangling: treat C++ namespaces as enums
C++ namespaces are imported as Swift enums, so let's mangle them as enums.

This fixes lookup of nested namespaces, for example, `std.__1`: previously during demangling the `__1` decl was filtered out in `ASTBuilder::getAcceptableTypeDeclCandidate` as it expects `Demangle::Node::Kind::Structure` instead of `Demangle::Node::Kind::Enum`. This caused "Failed to reconstruct type for x" error.
2021-04-13 12:14:18 +03:00
zoecarver
bd96959d14 [cxx-interop] Re-implement namespaces using enums + extensions.
C++ namespaces are module-independent, but enums are owned by their module's in Swift. So, to prevent declaring two enums with the same name, this patch implements a new approach to namespaces: enums with extensions.

Here's an example:
```
// Module A
namespace N { void test1(); }
// Module B
namespace N { void test2(); }
// __ObjC module
enum N { }
// Swift module A
extension N { func test1() }
// Swift module B
extension N { func test1() }
```

Thanks to @gribozavr for the great idea.
2021-02-14 16:54:24 -08:00
Saleem Abdulrasool
357face86e test: introduce new target-swiftxx-frontend for C++ interop
Add an convert to the new `target-swiftxx-frontend` substitution in lit
to control the C++ interop enabling in Swift.  This allows for a single
site which will enable control of both an overridden standard (for
testing multiple C++ standards) and simplify writing tests.
2021-01-12 11:45:36 -08:00
Arnold Schwaighofer
9ee12db2a9 Fix tests for LLVM change that added anonymous parameter labeling
Fix for r367755.
2019-08-15 14:57:24 -07:00
Thomas Roughton
1c1a6f2164 Import UsingShadowDecls (#26425) 2019-08-09 18:26:01 -07:00
Michael Munday
028b058bf9 [test] Fix ClangImporter test on IBM Z
The calling convention on IBM Z requires that arguments are sign or
zero extended to register width, so optionally allow that.
2019-08-08 12:02:35 -04:00
pschuh
6818eef1d8 [C++ Interop] Fix method mangling. (#26468) 2019-08-05 13:35:24 -07:00
swift-ci
49a037c116 Merge pull request #26460 from pschuh/cpp-7 2019-08-02 10:28:22 -07:00
pschuh
2a2ed0f843 [C++ Interop] Implement lookup within namespace. (#26439)
Known problems:
- The same namespace in multiple c++ modules will be subtly confused when doing
  lookup.
2019-08-01 18:21:08 -07:00
Parker Schuh
27f28861e0 [C++ interop] Check windows symbols. 2019-08-01 17:05:03 -07:00
pschuh
34bfeb4212 [C++ interop] Fix reflection info compiler crash. (#26438)
When a c++ namespace IRGens for reflection, it triggers a path that
expects the namespace to have a particular form. Because it is always
empty, we can treat it just like an empty swift enum.
2019-08-01 15:20:03 -07:00
John McCall
765d3383f8 Merge pull request #26047 from pschuh/cpp-2
Add importing cxx function decls and the basic requisite AbstractionPattern support.
2019-08-01 13:30:59 -04:00
Saleem Abdulrasool
9d083b58ed test: adjust the test for MS ABI
The decoration scheme on the Microsoft ABI is different than the itanium
style used on macOS and Linux.  Account for that in the test patterns.
2019-07-30 21:08:26 -07:00
Parker Schuh
4a5dae5ed4 Add importing cxx function decls and the basic requisite AbstractionPattern support. 2019-07-30 15:46:47 -07:00
pschuh
74803f0ab4 Import namespaces as EnumDecl. (#26339) 2019-07-30 15:17:08 -07:00