Commit Graph

363 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
7b62fa0c44 [ASTPrinter] Introduce a callback invoked after printing the name of the declaration (the signature for functions).
Swift SVN r19973
2014-07-15 05:56:54 +00:00
Sonny Falk
6b053e6252 [IDE] Add support for Swift extension declarations to the document substructure.
Add tests for struct, protocol and extension.
This addresses the first part of <rdar://problem/15818966>.

Swift SVN r19766
2014-07-10 00:23:00 +00:00
Pete Cooper
0d0defff9a Update which matches clang r212408, ie, using ErrorOr for file loading
Swift SVN r19607
2014-07-07 14:49:01 +00:00
Anna Zaks
37c3ec4ed1 Rename the -import-tighter-objc-types option and add it to the frontend.
Swift SVN r19535
2014-07-03 21:46:38 +00:00
Argyrios Kyrtzidis
cff07de44e [IDE] Search for URLs in comments and report them in the syntax model.
Swift SVN r19424
2014-07-01 19:21:17 +00:00
Argyrios Kyrtzidis
e64821d268 [IDE] Search all comments for 'FIXME:', 'TODO:', 'MARK:' and report them in the syntax model.
Swift SVN r19423
2014-07-01 19:21:16 +00:00
Anna Zaks
6d15e0b76f Add resource-dir option to swift-ide-test.
Swift SVN r19179
2014-06-25 21:34:32 +00:00
Jordan Rose
20bc9ec2b9 Add accessibility printing, and test the accessibility inference so far.
Swift SVN r19144
2014-06-24 21:32:15 +00:00
Anna Zaks
9f122e56b7 Add initial support for importing with tighter Objective C pointer types.
Add the ability to store optionality of the ObjC method parameters and return
type in a sidecar. This hardcoded info is then used to import Objective C
object pointer types as either optional or none, instead of implicitly
unwrapped optionals.

The feature is enabled with -import-with-tighter-objc-types=true.

Swift SVN r19048
2014-06-20 19:19:43 +00:00
Jordan Rose
574054b8fd Distance SourceManager from llvm::SourceMgr.
...in preparation for non-source locations, i.e. locations that don't come
frome source buffers.

No functionality change, but a fair bit of SourceManager API and idioms have
changed.

Swift SVN r18942
2014-06-17 01:15:47 +00:00
Doug Gregor
dd8c668aa8 Import NSDictionary as Dictionary<NSObject, AnyObject>
Fixes <rdar://problem/16870626>.


Swift SVN r18907
2014-06-15 10:44:23 +00:00
Justin Bogner
a0c0dc25be Use std::error_code rather than llvm::error_code
std::error_code is no longer available via the llvm namespace as of
r210835.

Swift SVN r18851
2014-06-13 02:54:07 +00:00
Mark Lacey
dccd703315 Use <system_error> rather than llvm/Support/system_error.h.
Rafael removed the latter in r210803.

Swift SVN r18842
2014-06-12 21:53:16 +00:00
Argyrios Kyrtzidis
95bd9e1d28 [AST/IDE] Centralize the logic to determine if a symbols is a 'private' stdlib one and hide them more extensively.
-Hide vars that have a private type.
-Hide functions that have a parameter with private type or a parameter name with leading underscore.
-Minor change in StringUTF16.swift to avoid printing "func generate() -> IndexingGenerator<_StringCore>".

rdar://17027294

Swift SVN r18623
2014-05-25 03:49:02 +00:00
Argyrios Kyrtzidis
4bdfbd1cd2 [IDE] Have 'swift-ide-test -annotate-print' also indicate where the printed decl location is.
Swift SVN r18447
2014-05-20 07:36:22 +00:00
Argyrios Kyrtzidis
973beb0ae3 [IDE/CodeCompletion] Fix crash with code-completion when using -import-objc-header.
Swift SVN r18444
2014-05-20 04:05:52 +00:00
Doug Gregor
73528dc0e0 Enable importing factory methods as initializers by default.
Finishes <rdar://problem/16509024>.

Swift SVN r17972
2014-05-12 23:01:20 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
68e8fee5fc Comment parsing: put more information into the generated XML documents
This commit adds infrastructure for conversion and testing it.

The conversion is still incomplete, pending discussion about which tags should
we use in the XML documents.  I copied the RelaxNG schema from Clang, and will
edit it accordingly.


Swift SVN r16451
2014-04-17 15:42:51 +00:00
Jordan Rose
49ec7c1ea1 Use SWIFT_MODULE_CACHE_PATH for all tools.
Now that the standard library depends on Clang headers, every single tool
needs to specifically avoid using the default module cache when
SWIFT_MODULE_CACHE_PATH is set.

<rdar://problem/16294222>

Swift SVN r14937
2014-03-12 00:27:24 +00:00
Ted Kremenek
028f9d0561 Remove rest of Makefile build except for 'docs' and 'www'.
For 'docs' and 'www' it is possible these are still being used,
as they work independent of the Makefile build.  Keeping them for now.

Swift SVN r14418
2014-02-26 22:21:25 +00:00
Argyrios Kyrtzidis
bb4b57c053 [IDE] Introduce ide::printDeclUSR() which uses the mangler to provide a USR for a swift symbol.
Swift SVN r14279
2014-02-23 06:54:48 +00:00
Jordan Rose
16f8ece6e6 Drop -print-as-objc from swift-ide-test.
Use "swift -emit-objc-header" (or "swift -emit-objc-header-path output.h")
instead.

Swift SVN r13802
2014-02-12 01:19:14 +00:00
Jordan Rose
95461797aa Move -print-as-objc feature into a library.
No functionality change.

Swift SVN r13798
2014-02-12 01:19:09 +00:00
Doug Gregor
eaf410f9f5 Import Objective-C instancetype methods as DynamicSelf methods.
This eliminates a pile of extra casting when interacting with
Objective-C APIs. Addresses the majority of <rdar://problem/14044307>,
but there is still cleanup to do.


Swift SVN r13780
2014-02-11 06:42:53 +00:00
Jordan Rose
0de8d19514 Define globals for the names of the stdlib, ObjectiveC, and Foundation modules.
This is mostly useful for the standard library, whose name is going to
change to "Swift" soon. (See <rdar://problem/15972383>.) But it's good DRY.

Swift SVN r13758
2014-02-10 22:40:42 +00:00
Jordan Rose
63df4a5604 [swift2objc] Handle subscripts.
This is the last major Objective-C declaration kind that shows up in
printing bridged Swift classes!

As we modify our set of permitting parameter types, we'll need to continue
adding special cases so that they come out reasonable, but the major
infrastructure work here is pretty much complete.

Swift SVN r13649
2014-02-07 20:08:56 +00:00
Jordan Rose
ddc54844a5 [swift2objc] References to non-@objc classes should come through as 'id'.
Forward-declaring a non-@objc class seems like the right thing to do, but
that could cause a name conflict with an existing @objc class (either
from Clang or from another module). Just use 'id' (and 'Class') to refer
to these.

Swift SVN r13645
2014-02-07 19:31:27 +00:00
Jordan Rose
532a6e0bd3 [swift2objc] Handle properties.
All properties are considered nonatomic. If a property comes from Objective-C,
the accessor names may be customized, so always print them out in that case.

Swift SVN r13644
2014-02-07 19:31:26 +00:00
Jordan Rose
a195661833 [swift2objc] Stop generating inline prefix info for every generated header.
Swift SVN r13618
2014-02-07 01:55:02 +00:00
Jordan Rose
65e386bbc4 [swift2objc] Print initializers (as init methods).
Swift SVN r13549
2014-02-06 02:25:28 +00:00
Jordan Rose
cf602d3527 [swift2objc] Handle arguments with ignored names (_).
A single argument specified as "func foo(_: Int)" gets its input parameters
represented as a ParenPattern around a TypedPattern, not a TuplePattern.

Swift SVN r13543
2014-02-06 01:52:01 +00:00
Jordan Rose
e1d349d8e3 [swift2objc] Don't print accessor methods.
We don't print properties at all right now, but trying to print accessors
results in output with "(null identifier)" where a selector piece should be.

Swift SVN r13542
2014-02-06 01:52:00 +00:00
Jordan Rose
6b9de74d96 [swift2objc] Forward-declare protocols and classes referenced in methods.
This lets us handle circular dependencies.

Swift SVN r13541
2014-02-06 01:51:57 +00:00
Jordan Rose
1cdb9a0de5 [swift2objc] Minor cleanup; no functionality change.
Swift SVN r13540
2014-02-06 01:51:55 +00:00
Jordan Rose
08093c7874 [swift2objc] Handle @optional methods in protocols.
Swift SVN r13539
2014-02-06 01:51:54 +00:00
Enrico Granata
270bac639d Unbreak the Makefile build - LLDB still needs it
Swift SVN r13534
2014-02-06 01:11:03 +00:00
Doug Gregor
15c9359f05 Swift2ObjC: Print DynamicSelf as "instancetype".
... and properly register DynamicSelfType for serialization.


Swift SVN r13298
2014-02-01 07:11:28 +00:00
Jordan Rose
cf1bb3634f Allow Selector and ObjCBool in @objc methods.
...and update the print-as-ObjC type printer to handle them. IRGen and
@encode changes to come from Mark and Fariborz, presumably.

Swift SVN r12938
2014-01-24 22:27:36 +00:00
Jordan Rose
11d2e9282b [swift2objc] Print arbitrary class metatypes as "SWIFT_METATYPE(MyClass)"
...and then define SWIFT_METATYPE(X) as a macro for "Class", because
Objective-C doesn't have a way to constrain class types to a certain
hierarchy.

With this change, we should handle every type that makes it through the
@objc validator today.

Swift SVN r12190
2014-01-11 01:39:08 +00:00
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