Commit Graph

12 Commits

Author SHA1 Message Date
Joe Groff
0103fb4eaf Update ImportAsMember test not to use unprototyped function.
We now reject this in Clang.
2016-05-18 15:16:24 -07:00
Michael Ilseman
151a19d3b8 [Import as member] Fixes to apinotes and tests
Fixes and clarifies a few API notes, and adds some test cases showing
current SILGen issues.
2016-04-11 11:31:12 -07:00
Michael Ilseman
4e4c511cf0 [Import as error] Error on non-prototyped function declarations 2016-03-28 15:41:48 -07:00
Joe Groff
aec7be3930 SILGen: Handle C functions imported as property accessors. 2016-03-18 13:23:40 -07:00
Joe Groff
c4a69e9d5d SILGen: Basic code generation for C functions imported as methods.
Introduce abstraction patterns for curried C-functions-as-methods for type lowering, and plumb the "foreign self parameter index" through call emission so that we emit the "self" parameter in the right position. This gets us handling C functions imported as methods with explicit swift_name attributes in simple, fully-applied cases. There's still more work to be done for properties, partial applications, and initializers introduced by extensions.
2016-03-17 10:43:25 -07:00
Michael Ilseman
73f7fd2eb6 [Clang importer] Infer get-only properties and static properties.
Expands support for inference of computed properties, whether instance
or static, to include get-only. Adds test cases for both inference and
manual annotation for static computed properties.
2016-03-07 16:51:34 -08:00
Michael Ilseman
23c818ed57 [Clang importer] Support static methods in swift_name 2016-03-07 15:58:01 -08:00
Doug Gregor
47b2be3138 [Clang importer] Import a getter or getter/setter pair as a property.
When a global function is determined to be a lone getter or a
getter/setter pair, import it as a property. Handle global, instance,
and static properties.

As part of this, generalize importAsMethod to also handle static
methods and map pointer-to-non-const arguments to 'mutating' methods.
2016-03-06 21:25:43 -08:00
Michael Ilseman
e452b38119 [Clang Importer] Import as methods
Print module functionality hooked up to import global functions a
methods, if dictated by the swift_name attribute. Test case included.

No SILGen support yet.
2016-03-03 21:58:57 -08:00
Doug Gregor
42f0356aec [Clang importer] Wire up extensions for globals-as-members.
Wire up the extensions created when importing globals-as-members via
the same mechanisms we use for Objective-C categories, e.g.,
implementing loadAllExtensions() to find the extensions and lazily
loading their members via the member loader. Addresses most of my
comments on the way extensions were wired in.

Extend our testing for importing globals as members to two different
submodules, so we can see the separation of extensions.

As part of this, fold getOrCreateExtension into importDeclContextOf.
2016-03-03 17:22:47 -08:00
Michael Ilseman
c247bbf5b6 [Clang Importer] Import as member: bare bones variables.
Adds tentative and very basic functionality for importing global
variables as members of structs and classes. Test case added
2016-03-02 22:19:37 -08:00
Doug Gregor
f7ee0349ea [Clang importer] (De-)serialize globals-as-members for Swift name lookup tables.
Round-trip the globals-as-members table used by the Swift name lookup
tables. At present, there are no clients of this information except
the dumper.
2016-03-01 18:13:35 -08:00