Commit Graph

2092 Commits

Author SHA1 Message Date
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
Dmitri Hrybenko
069469c485 Unindent code within a namespace. NFC.
Swift SVN r16124
2014-04-09 18:27:07 +00:00
Dmitri Hrybenko
f90e0c153b Make 'override' a keyword
rdar://16462192

Swift SVN r16115
2014-04-09 14:19:50 +00:00
Joe Groff
8adaab0233 Fold ExtInfo::isThin and ::isBlock into a "Representation" enum.
These bits are orthogonal to each other, so combine them into one, and diagnose attempts to produce a type that's both. Spot-fix a bunch of places this revealed by inspection that we would have crashed in SILGen or IRGen if blocks were be handled.

Swift SVN r16088
2014-04-09 00:37:26 +00:00
Doug Gregor
9e75a46c8c swift-ide-test: Add a -skip-unavailable option to skip unavailable declarations
Swift SVN r16056
2014-04-08 16:34:44 +00:00
Dmitri Hrybenko
f661691962 Don't serialize @final twice and add tests for printing @final
Swift SVN r15962
2014-04-04 23:20:55 +00:00
Dmitri Hrybenko
f198c28d75 Serialize @required as a DeclAttribute
Also introduce an invalid bit on a DeclAttribute for use by semantic analysis.

This fixes AST printing for @required.


Swift SVN r15938
2014-04-04 15:24:47 +00:00
Doug Gregor
5fd25eb4ef Revert "AST printing for functions where the first parameter has a separate name."
This reverts r15141.

Conflicts:
	lib/AST/ASTPrinter.cpp

Swift SVN r15845
2014-04-02 23:27:50 +00:00
Doug Gregor
6496d69cb8 Simplify down to a single command-line option for preposition splitting.
Swift SVN r15835
2014-04-02 21:44:19 +00:00
Dmitri Hrybenko
78e354b2b9 AST printing: make PrintDefaultParameterPlaceholder the default (since we are
not going to implement expression printing any time soon), and fix a bug in its
implementation: when used with deserialized modules, "= default" was not
printed.


Swift SVN r15798
2014-04-02 13:56:54 +00:00
Dmitri Hrybenko
e42a3e5762 AST printer: undo the damage of r15737, while retaining the whitespace handling
refactoring, allowing ASTPrinter callbacks to be called exactly when a first
non-whitespace character of the declaration is printed, ignoring the
indentation and leading blank lines.


Swift SVN r15743
2014-04-01 20:07:41 +00:00
Dmitri Hrybenko
95cc4ef483 AST printer: print a blank line before a declaration with a documentation
comment

rdar://16432279


Swift SVN r15741
2014-04-01 17:53:19 +00:00
Dmitri Hrybenko
e531e4dd0f AST printer: improve handling of newlines and indentation to more precisely
capture source ranges of declarations


Swift SVN r15737
2014-04-01 17:10:41 +00:00
John McCall
f1180f5e6d in order to work correctly for non-@objc protocols.
Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
2014-04-01 00:38:28 +00:00
Doug Gregor
d51744e396 Clang importer: add @objc(name) attributes to imported classes and protocols.
Now that we represent the Objective-C runtime names of classes and
protocols in a uniform way, stop peeking into the Clang AST nodes to
get this information for imported classes and protocols. This is
better layering and helps test that new code path.


Swift SVN r15632
2014-03-29 21:15:29 +00:00
Doug Gregor
055e0ef136 Add an "implicit" bit to DeclAttribute.
Swift SVN r15623
2014-03-29 17:24:15 +00:00
Dmitri Hrybenko
1d6c76c352 Module interface printing: pass through documentation comments for imported
declarations

rdar://16408910


Swift SVN r15576
2014-03-28 10:54:06 +00:00
Sonny Falk
275eb64dd6 Rename the option for default parameter placeholder to better reflect
the meaning, PrintDefaultParameterPlaceholder.

Swift SVN r15566
2014-03-27 21:26:42 +00:00
Sonny Falk
7f83777900 Add an option to print a placeholder for variable initializers.
This allows us to pretty print default function parameters as:
func foo(arg1: Int = default)

Swift SVN r15564
2014-03-27 20:53:58 +00:00
Sonny Falk
4867e37b01 Restore r15378: fix the AST printer to print "let" for let variables.
Update the associated tests.

Swift SVN r15536
2014-03-26 23:44:52 +00:00
Dmitri Hrybenko
92b29ef045 Revert "Module interface printing: pass through documentation comments for
imported declarations"

rdar://16408910


Swift SVN r15527
2014-03-26 21:28:42 +00:00