Commit Graph

473 Commits

Author SHA1 Message Date
Jordan Rose
e4684ddb1a [swift2objc] Handle block types.
C's wonderful declarator syntax makes this rather non-trivial. I've chosen
to implement this by pushing cleanups that will get called at the end of
a "full type", in reverse order.

With much thanks to cdecl.org (created by Peter Ammon from the AppKit team).

Swift SVN r12189
2014-01-11 01:39:08 +00:00
Jordan Rose
9a4a560cfc [swift2objc] Re-order types to be closer to TypeNodes.def.
...but still not exactly in sync, to keep similar bits of code together.

No functionality change.

Swift SVN r12188
2014-01-11 01:39:05 +00:00
Jordan Rose
1a024c1c75 [swift2objc] Handle UnsafePointer.
The @objc validator still rejects UnsafePointers of any non-mapped type,
so things like "NSRect *" and "MyClass **" get rejected, but this code
will do the right thing for those as well.

Swift SVN r12170
2014-01-11 00:02:46 +00:00
Jordan Rose
9f56b54ece [swift2objc] Handle imported enums.
We assume the enum is safe if it got this far.

Swift SVN r12169
2014-01-11 00:02:46 +00:00
Jordan Rose
710e43d7df [swift2objc] Fix bug with protocol composition metatypes: Class, not id!
Swift SVN r12168
2014-01-11 00:02:45 +00:00
Jordan Rose
31e6108304 [swift2objc] Look through ParenTypes (and substituted and syntax-sugar types)
The latter two can't show up right now but if they ever become valid we
should just ignore them.

Swift SVN r12167
2014-01-11 00:02:42 +00:00
Jordan Rose
1213b52e10 [swift2objc] Add COpaquePointer -> void * mapping.
Also, drop special cases for AnyObject and AnyClass; they are handled as
DynamicLookup and DynamicLookup.metatype.

Swift SVN r12163
2014-01-10 23:14:31 +00:00
Jordan Rose
ddada62075 [swift2objc] Handle protocol and protocol composition types.
These get translated as "id <MyProto>" and "id <MyProto, OtherProto>",
of course. There's special handling for protocol metatypes so that we get
"Class <MyProto>". (Objective-C doesn't have any other way to specify what
operations are available on a particular Class, so this is pretty important!)

Swift SVN r12162
2014-01-10 23:14:28 +00:00
Jordan Rose
17dfc5979a [swift2objc] Print class types for arguments and return values as "Foo *".
This just assumes the class has already been declared. The next step here
is to add something that walks all of the referenced types /before/ starting
to print the @interface, and makes sure they've been defined or at least
forward-declared.

Swift SVN r12087
2014-01-09 01:20:04 +00:00
Jordan Rose
d58d4835c1 [swift2objc] Handle structs and typealiases that represent ObjC primitives.
...by matching their names in the standard library.

Swift SVN r12085
2014-01-09 01:20:03 +00:00
Jordan Rose
06d1d6a49a [swift2objc] Start printing members (only methods for now).
There is code here to print an entire Objective-C method, but the only type
that's handled is (), so we can't test that yet.

Swift SVN r12084
2014-01-09 01:20:02 +00:00
Jordan Rose
37a578ad0b [swift2objc] Sort output for determinism reasons.
If Module::getTopLevelDecls ever becomes guaranteed to be deterministic,
we can drop this sort.

Swift SVN r12083
2014-01-09 01:20:01 +00:00
Jordan Rose
f83df8c047 [swift2objc] Pull printing code into an ASTVisitor, like the Swift ASTPrinter.
No functionality change.

Swift SVN r12082
2014-01-09 01:19:57 +00:00
Jordan Rose
37e2e1de0e Merge swift2objc (the tool) into swift-ide-test, as -print-as-objc.
The actual printing should move to a library at some point, but for now this
keeps us from having to link Yet Another Testing Binary.

Swift SVN r12034
2014-01-08 02:19:03 +00:00
Chris Lattner
4bed0d6fce more added dependencies, this really doesn't seem right.
Swift SVN r11093
2013-12-10 21:20:27 +00:00
Greg Parker
fbd1c95292 Add support for iOS builds using cmake.
Swift SVN r9499
2013-10-18 21:52:37 +00:00
Greg Parker
485ed71b86 Rename SWIFT_SDK to MODULES_SDK in make to match cmake.
Swift SVN r8386
2013-09-18 02:26:18 +00:00
Greg Parker
0da2b85241 Embed the same SDK path in swift-ide-test as in swift itself.
Swift SVN r8248
2013-09-14 10:06:12 +00:00
Dmitri Hrybenko
5a88513e71 Don't link to curses library explicitly
LLVM build system has been fixed to pass down this linker flag automatically.


Swift SVN r7048
2013-08-08 17:46:52 +00:00
Doug Gregor
3de1f5a9b5 More attempts at fixing the CMake build
Swift SVN r6988
2013-08-07 18:22:47 +00:00
Argyrios Kyrtzidis
778e6fae6e [CMake] Utilize the SWIFT_MODULE_CACHE_PATH variable as the default value for a clang::CompilerInvocation.
Swift SVN r6475
2013-07-22 21:39:07 +00:00
Dmitri Hrybenko
3c5b12fc0f Code completion: add a lot of infrastructure code
* Added a mode in swift-ide-test to test code completion.  Unlike c-index-test,
  the code completion token in tests is a real token -- we don't need to
  count lines and columns anymore.

* Added support in lexer to produce a code completion token.

* Added a parser interface to code completion.  It is passed down from the
  libFrontend to the parser, but its functions are not called yet.

* Added a sketch of the interface of code completion consumer and code
  completion results.

Note: all this is not doing anything useful yet.


Swift SVN r6128
2013-07-10 20:53:40 +00:00
Dmitri Hrybenko
2a4dfc1d00 Rename swift-index-test -> swift-ide-test per Doug's suggestion
Swift SVN r6042
2013-07-06 00:52:11 +00:00