Commit Graph

2062 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
cfa64f4f6e [IDE] For AST printing, adjust recordDeclLoc() invocations at the point where Decl::getLoc() would point,
which is generally before the name.

Fixes rdar://16887111

Swift SVN r18448
2014-05-20 07:36:25 +00:00
Doug Gregor
5783d0b313 Revert r19185: Add T* syntactic sugar type for UnsafePointer<T>.
Swift SVN r18255
2014-05-17 16:43:46 +00:00
Doug Gregor
806daf3a87 Add T* syntactic sugar type for UnsafePointer<T>.
This is the basic plumbing for <rdar://problem/16912508>.


Swift SVN r18195
2014-05-16 15:30:26 +00:00
Doug Gregor
c4622014f8 Start importing NSArray* with the sugar AnyObject[]! rather than Array<AnyObject>!.
... and simplify type printing so we don't overparenthesize such types.



Swift SVN r18183
2014-05-16 06:17:38 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Joe Pamer
1e5b9116d4 More array casting work:
- Continue adding support for checked downcasts of array types (rdar://problem/16535104)
- Fix non-bridged array conversions post-r17868
- Fix rdar://problem/16773693
- Add tests for NSArray coercions to and from Array<T>

Swift SVN r17957
2014-05-12 20:49:42 +00:00
Dmitri Hrybenko
266cd9714a AST printing: print native documentation comments
This will be extremely useful for the standard library.

rdar://16829672


Swift SVN r17826
2014-05-10 16:30:12 +00:00
Argyrios Kyrtzidis
be7e6653fd [IDE] Don't print inherited types and conformances that start with underscore,
if PrintOptions.SkipLeadingUnderscoreDecls is enabled.

Swift SVN r17762
2014-05-09 06:10:22 +00:00
Argyrios Kyrtzidis
16d4b98b83 [ASTPrinter] Add more printing options, SkipAttributes/SkipIntroducerKeywords/ArgAndParamPrintingMode.
Swift SVN r17677
2014-05-08 04:17:40 +00:00
Ted Kremenek
0b2c23ffec Remove special printing of ImplicitlyUnwrappedOptional<T>.
Part of <rdar://problem/16836463>

Swift SVN r17610
2014-05-07 06:59:52 +00:00
Argyrios Kyrtzidis
42484084f2 [ASTPrinter] Add an option to always print the keyword argument and the parameter,
even if they are the same.

rdar://16799973

Swift SVN r17412
2014-05-05 00:52:06 +00:00
Chris Lattner
2427e36ff8 Introduce a new "convenience" context sensitive keyword, which can only be
used on init decls, with the same semantics as "-> Self".  Switch the ast
printer, and fixits to use it.

As driveby's, simplify verification of contextual keywords in declparsing,
and rename parseConstructor/Destructor to parseInit/Deinit.


Swift SVN r17356
2014-05-04 04:02:32 +00:00
Ted Kremenek
050fd53af7 Rename UncheckedOptional to ImplicitlyUnwrappedOptional.
Swift SVN r17232
2014-05-02 06:13:57 +00:00
Doug Gregor
d003b74c85 An argument with a default value has a keyword argument.
Arguments with default values are one of those places where you
really, really want keyword arguments: make that the default.


Swift SVN r17080
2014-04-30 06:51:43 +00:00
Doug Gregor
72e32c93af Make argument names default to keyword arguments in the cases where Objective-C has names.
Introduce a model where an argument name is a keyword argument if: 

  - It is an argument to an initializer, or
  - It is an argument to a method after the first argument, or
  - It is preceded by a back-tick (`), or
  - Both a keyword argument name and an internal parameter name are
    specified. 

Provide diagnostics Fix-Its to clean up cases where the user is
probably confused, i.e.,

  - "_ x: Int" -> "x: Int" where "x" would not have been a keyword
  argument anyway
  - "x x: Int" -> "`x: Int"

This covers the compiler side of <rdar://problem/16741975> and
<rdar://problem/16742001>.

Update the AST printer to print in this form, never printing just 
a type for a parameter name because we're also going to adopt
<rdar://problem/16737312> and it was easier to move the tests once
rather than twice.

Standard library and test updates coming separately.




Swift SVN r17056
2014-04-30 00:04:04 +00:00
Chris Lattner
a7012f23ef Remove swift::ArrayType. It is dead and vestigial code for supporting fixed size
arrays, which never got baked.  Remove it until we have time to do things right.


Swift SVN r16995
2014-04-28 21:18:27 +00:00
Ted Kremenek
6caf910d32 Implement new syntactic sugar for UncheckedOptional<T>.
This leaves in the existing syntax for @unchecked T?.  That will
be addressed in later patches.

There's still a mysterious case where some of the SIL output
includes UncheckedOptional<T> and some places T!.

Moreover, this doesn't handle SourceKit's behavior for printing
for overrides.  This just handles parsing the 'T!' syntax.

Swift SVN r16945
2014-04-27 21:59:29 +00:00
Dmitri Hrybenko
739c495282 AST printer: use identifier escaping
rdar://16233153


Swift SVN r16933
2014-04-27 17:25:24 +00:00
Dmitri Hrybenko
dc406b31c2 AST printer: don't print "let ... { get }" -- this is not valid syntax
rdar://16281510


Swift SVN r16927
2014-04-27 15:18:31 +00:00
Chris Lattner
0c390777ba Implement <rdar://problem/16204675> Need #elseif
This restructures IfConfigDecl/Stmt to be a list of clauses controlled
by a condition.  This makes it straight-forward to drop in #elseif support.

While I'm in here, this patch moves checking for extraneous stuff at the
end of the #if line from the lexer to the parser.  This means that you can
now put a comment on the same line as a #if/#else/#elseif/#endif.



Swift SVN r16912
2014-04-27 04:51:36 +00:00
Joe Groff
20b7736bd6 stdlib/AST: Make 'Hashable.hashValue' into a property.
As a step on the way to harmony with Cocoa, change Hashable's hashValue into a property requirement, and update the derived conformance generation to produce a computed property instead of a standalone function.

This is mostly Ted's patch, with some help from Dmitri to clean up the IDE aspects.

Swift SVN r16864
2014-04-26 01:29:24 +00:00
Dmitri Hrybenko
95f173da55 Fix tests: fixup 16730 (fix unreachable increment warning), the "break" is no
longer needed, because there is no loop here anymore, and now this break is
breaking out of the switch.


Swift SVN r16753
2014-04-24 11:46:24 +00:00
Chris Lattner
852da64f84 tidy code a bit more, thanks Jordan
Swift SVN r16732
2014-04-24 01:07:42 +00:00
Chris Lattner
00ef2cccb3 fix unreachable increment warning.
Swift SVN r16730
2014-04-24 00:54:12 +00:00
John McCall
b38a63950d Implement @unowned(unsafe).
This was part of the original weak design that
there was never any particular reason to rush the
implementation for.  It's convenient to do this now
so that we can use it to implement Unmanaged<T> for
importing CF types.

Swift SVN r16693
2014-04-23 08:51:23 +00:00
John McCall
8681963bcb A couple of long-overdue renames.
Builtin.ObjectPointer -> Builtin.NativeObject
Builtin.ObjCPointer -> Builtin.UnknownObject

Swift SVN r16634
2014-04-22 00:17:08 +00:00
Joe Groff
c73acc67f2 SIL: Add an "UnownedInnerPointer" result convention.
This will represent the return convention of imported __attribute__((objc_returns_inner_pointer)) methods. Leave it unimplemented for now until we can autorelease things sanely.

Swift SVN r16628
2014-04-21 21:57:13 +00:00
Argyrios Kyrtzidis
e1f4e81eee [ASTPrinter] Printing ParamDecls directly is useful.
Fixes a SourceKit test.

Swift SVN r16588
2014-04-20 17:01:07 +00:00
Doug Gregor
09797f7f99 Introduce a new declaration node, ParamDecl, for function parameters.
Use this node to capture the argument name and its source location in
the AST. We're only building these in one place at the moment; the
rest will be updated soon.


Swift SVN r16581
2014-04-20 05:23:35 +00:00
Doug Gregor
36889a2b1a Introduce DeclIterator and DeclRange for iterating over decl members.
NFC. DeclRange is a range over DeclIterators, and is used rather than
ArrayRef<Decl*> to retrieve the members of a nominal type declaration
or extension thereof. The intent is to change the representation of
DeclRange next.


Swift SVN r16571
2014-04-19 18:53:20 +00:00
Doug Gregor
812dc091eb Introduce the notion of factory initializers.
Factory initializers express an initializer that produces an object of
the given type, but is not inherited and not designated. Although they
have a syntactic form for presentation purposes (-> ClassName), there
is no way to specify or implement them within Swift. Rather, factory
initializers are created when importing an Objective-C factory method
that returns the class type rather than instancetype.

Swift SVN r16528
2014-04-18 16:04:48 +00:00
Doug Gregor
d80b689c51 Introduce "convenience factory" initializers.
Convenience factory initializers are convenience initializers produced
by importing an Objective-C factory method as a convenience
initializer. The distinction is currently only used to eliminate the
awful layering violation I recently introduced in name lookup, which
was consulting Clang AST nodes directly. It will also be useful in
SILGen.

Swift SVN r16527
2014-04-18 15:34:26 +00:00
Doug Gregor
8bc2ea4ea1 Use designated/convenience initializer terminology throughout. NFC
Introduce CtorInitializerKind to describe the kind of an enum, rather
than a bool, to make way for more initializer kinds in the future.

Swift SVN r16525
2014-04-18 15:10:13 +00:00
Doug Gregor
129aa191a6 Remove the use of ArgParamPatterns in the AST printer and dumper.
Swift SVN r16436
2014-04-17 03:33:46 +00:00
Argyrios Kyrtzidis
a9ea63a7f7 [IDE/ModuleInterface] Adjust the indentation of regular comments to match the current indentation level.
Swift SVN r16362
2014-04-15 06:27:40 +00:00
Joe Groff
f7cf592777 Add a SIL-only '@block_storage T' type to represent on-stack storage for blocks.
Blocks need to be born on the stack, so we need a way to represent that on-stack storage. @block_storage T will represent the layout of a block that contains storage for a capture of type T.

Swift SVN r16355
2014-04-15 03:56:09 +00:00
Chris Lattner
6e90d343be At long last, land the implementation of <rdar://problem/16397000> Should be able to override stored properties
This means that we now synthesize getters and setters a lot more than we used to, so the
implementation work on this shook out a ton of bugs with them.

There is still one failure that I don't understand at all (test/stdlib/NewArray.swift.gyb), 
nor do I understand how to diagnose the problem, so I XFAILed it and filed rdar://16604980 to
track fixing it.



Swift SVN r16299
2014-04-14 04:48:54 +00:00
Argyrios Kyrtzidis
f931674573 [IDE/ModuleInterface] Pick up the vertical spacing/grouping that is used in the clang module header.
Swift SVN r16294
2014-04-14 03:28:08 +00:00
Argyrios Kyrtzidis
c1fd5b5a31 [IDE] For the module interface, add an option to not print parameter names.
rdar://16600455

Swift SVN r16275
2014-04-13 05:33:06 +00:00
Argyrios Kyrtzidis
293d771905 [IDE] Add an option to skip printing declarations that start with '_', for the module interface.
rdar://16559411

Swift SVN r16272
2014-04-13 04:35:30 +00:00
Argyrios Kyrtzidis
defccdea36 [ASTPrinter] Introduce a function for the logic of whether to print a declaration or not.
Swift SVN r16270
2014-04-13 04:35:27 +00:00
Dmitri Hrybenko
01c26070ec AST printer: default to new-style function declaration syntax:
func f(paramName argName: Type)


Swift SVN r16260
2014-04-12 18:21:25 +00:00
Argyrios Kyrtzidis
4c91bd074f [IDE] Print out regular comments from the clang module headers, for the module interface.
rdar://16451119

Swift SVN r16249
2014-04-12 05:21:08 +00:00
John McCall
8a85750c4c Plumb a lot of querying for different kinds of existential
type.

Swift SVN r16232
2014-04-11 22:30:14 +00:00
Dmitri Hrybenko
6a24e5475e Remove a separate bit for @objc inference, and use normal implicit attributes
This allows us to get rid of /* @objc(inferred) */ completely.


Swift SVN r16215
2014-04-11 14:34:28 +00:00
Dmitri Hrybenko
3972e2b23a Reimplement @unchecked suppression: print '@unchecked T?' as 'T?' instead of
plain 'T'

rdar://16530754


Swift SVN r16213
2014-04-11 11:02:45 +00:00
Dmitri Hrybenko
6f099be5cd AST printer: add an option to disable printing function representation
attributes (@thin, @objc_block)


Swift SVN r16208
2014-04-11 10:03:07 +00:00
Dmitri Hrybenko
0fc4f3949c AST printer: add an option to hide @exported
Swift SVN r16168
2014-04-10 19:39:25 +00:00
Dmitri Hrybenko
e68fd4abd3 AST printer: add an option to hide 'override' keywords
rdar://16530754


Swift SVN r16162
2014-04-10 14:27:00 +00:00
Dmitri Hrybenko
cc30070f68 AST printer: add an option to suppress @unchecked in imported declarations
This is rdar://16530754.  For @unchecked in code completion see
rdar://16576739.


Swift SVN r16156
2014-04-10 10:40:30 +00:00