Commit Graph

168 Commits

Author SHA1 Message Date
Doug Gregor
5e11e3f728 Also map -enable-omit-needless-words to a language option.
Although omit-needless-words is almost entirely a Clang importer task,
there are a handful of other places in the compiler that will need to
query this flag as well. NFC for now; those changes will come soon.
2016-01-17 23:40:14 -08:00
Slava Pestov
81267ce1db AST: Serialize -enable-resilience flag on the ModuleDecl
Since resilience is a property of the module being compiled,
not decls being accessed, we need to record which types are
resilient as part of the module.

Previously we would only ever look at the @_fixed_layout
attribute on a type. If the flag was not specified, Sema
would slap this attribute on every type that gets validated.

This is wasteful for non-resilient builds, because there
all types get the attribute. It was also apparently wrong,
and I don't fully understand when Sema decides to validate
which decls.

It is much cleaner conceptually to just serialize this flag
with the module, and check for its presence if the
attribute was not found on a type.
2016-01-16 02:23:27 -08:00
Doug Gregor
657319903e Add a "-swift3-migration" frontend option and corresponding language option.
This is intended to enable various Fix-Its to perform the one-way
migration from Swift 2.x to Swift 3, with a focus on the issues
involving naming.
2016-01-14 00:21:47 -08:00
Doug Gregor
12d6f02c45 Remove the "-disable-self-type-mangling" flag and corresponding language option
NFC
2016-01-14 00:21:47 -08:00
Doug Gregor
be90d63a43 Remove the unused EnableCodeCompletionDelayedEnumConformanceHack; NFC 2016-01-13 16:53:01 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Landon Fuller
6bf5a4989e Add FreeBSD Option handling. 2015-12-04 12:26:39 -07:00
Slava Pestov
50add6a764 Rename @fixed_layout to @_fixed_layout and mark it UserInaccessible
This attribute is only intended for use by the standard library
(as least for now) so keep it out of sight to avoid scaring children
and pets.
2015-11-13 13:20:50 -08:00
Slava Pestov
57dd686742 Strawman @fixed_layout attribute and -{enable,disable}-resilience flags
A fixed layout type is one about which the compiler is allowed to
make certain assumptions across resilience domains. The assumptions
will be documented elsewhere, but for the purposes of this patch
series, they will include:

- the size of the type
- offsets of stored properties
- whether accessed properties are stored or computed

When -enable-resilience is passed to the frontend, all types become
resilient unless annotated with the @fixed_layout attribute.

So far, the @fixed_layout attribute only comes into play in SIL type
lowering of structs and enums, which now become address-only unless
they are @fixed_layout. For now, @fixed_layout is also allowed on
classes, but has no effect. In the future, support for less resilient
type lowering within a single resilience domain will be added, with
appropriate loads and stores in function prologs and epilogs.

Resilience is not enabled by default, which gives all types fixed
layout and matches the behavior of the compiler today. Since
we do not want the -enable-resilience flag to change the behavior
of existing compiled modules, only the currently-compiling module,
Sema adds the @fixed_layout flag to all declarations when the flag
is off. To reduce the size of .swiftmodule files, this could become
a flag on the module itself in the future.

The reasoning behind this is that the usual case is building
applications and private frameworks, where there is no need to make
anything resilient.

For the standard library, we can start out with resilience disabled,
while perfoming an audit adding @fixed_layout annotations in the
right places. Once the implementation is robust enough we can then
build the standard library with resilience enabled.
2015-11-13 13:20:49 -08:00
Michael Gottesman
7820961891 Revert commits to fix the build.
Revert "Fix complete_decl_attribute test for @fixed_layout"
Revert "Sema: non-@objc private stored properties do not need accessors"
Revert "Sema: Access stored properties of resilient structs through accessors"
Revert "Strawman @fixed_layout attribute and -{enable,disable}-resilience flags"

This reverts commit c91c6a789e.
This reverts commit 693d3d339f.
This reverts commit 085f88f616.
This reverts commit 5d99dc9bb8.
2015-11-12 10:40:54 -08:00
Slava Pestov
5d99dc9bb8 Strawman @fixed_layout attribute and -{enable,disable}-resilience flags
A fixed layout type is one about which the compiler is allowed to
make certain assumptions across resilience domains. The assumptions
will be documented elsewhere, but for the purposes of this patch
series, they will include:

- the size of the type
- offsets of stored properties
- whether accessed properties are stored or computed

When -enable-resilience is passed to the frontend, all types become
resilient unless annotated with the @fixed_layout attribute.

So far, the @fixed_layout attribute only comes into play in SIL type
lowering of structs and enums, which now become address-only unless
they are @fixed_layout. For now, @fixed_layout is also allowed on
classes, but has no effect. In the future, support for less resilient
type lowering within a single resilience domain will be added, with
appropriate loads and stores in function prologs and epilogs.

Resilience is not enabled by default, which gives all types fixed
layout and matches the behavior of the compiler today. Since
we do not want the -enable-resilience flag to change the behavior
of existing compiled modules, only the currently-compiling module,
Sema adds the @fixed_layout flag to all declarations when the flag
is off. To reduce the size of .swiftmodule files, this could become
a flag on the module itself in the future.

The reasoning behind this is that the usual case is building
applications and private frameworks, where there is no need to make
anything resilient.

For the standard library, we can start out with resilience disabled,
while perfoming an audit adding @fixed_layout annotations in the
right places. Once the implementation is robust enough we can then
build the standard library with resilience enabled.
2015-11-12 02:30:07 -08:00
Joe Groff
2368ce774b Remove self types from mangling by default.
And include some supplementary mangling changes:

- Give the first generic param (depth=0, index=0) a single character mangling. Even after removing the self type from method declaration types, 'Self' still shows up very frequently in protocol requirement signatures.
- Fix the mangling of generic parameter counts to elide the count when there's only one parameter at the starting depth of the mangling.

Together these carve another 154KB out of a debug standard library. There's some awkwardness in demangled strings that I'll clean up in subsequent commits; since decl types now only mangle the number of generic params at their own depth, it's context-dependent what depths those represent, which we get wrong now. Currying markers are also wrong, but since free function currying is going away, we can mangle the partial application thunks in different ways.

Swift SVN r32896
2015-10-26 22:05:20 +00:00
Doug Gregor
712796a7e2 Add a flag to enable the iterative type checker.
Swift SVN r32571
2015-10-09 17:18:48 +00:00
Joe Groff
5145a49d58 Add -disable-self-type-mangling staging option.
NFC yet.

Swift SVN r32397
2015-10-02 03:23:14 +00:00
Joe Groff
25b1110f5b Remove -enable-interface-type-mangling staging option.
Swift SVN r32285
2015-09-28 22:40:52 +00:00
David Farler
69b6763797 Emit a warning when using unknown arch/os build configurations
'arch' and 'os' build configurations with valid identifiers as
arguments, but which are unknown to the compiler, will cause the
compiler to silently skip over that code as it has an inactive clause.
Emit a diagnostic, but not an error so as not to inadvertantly break
code that may be in a compiler without knowledge of a particular
operating system or architecture.

rdar://problem/22052176

Swift SVN r32219
2015-09-25 05:24:34 +00:00
Doug Gregor
561d5fd4a9 Add an opt-in warning to complain about needless words in declarations.
The new option -Womit-needless-words finds places where names are
redundant with type information, producing warnings and Fix-Its to
shorten the names. Part of rdar://problem/22232287, to help bring
the same heuristics we're applying in the Clang importer to the user's
Swift code.

Swift SVN r31234
2015-08-13 23:39:35 +00:00
Chris Lattner
0001dc27bb remove support for the experiemental "character literals" feature.
Swift SVN r30509
2015-07-22 22:35:19 +00:00
Devin Coughlin
c1caddae62 Remove experimental support for treating unavailable symbols as optional.
This has always been off by default and is a language direction we have decided not to
pursue.

Swift SVN r30355
2015-07-18 01:56:25 +00:00
Joe Groff
bc55c4ef37 ClangImporter: Remove -enable-simd-import staging option.
Swift SVN r29765
2015-06-27 18:10:25 +00:00
Joe Groff
55a830df38 ClangImporter: Remove -enable-c-function-pointers staging option.
Swift SVN r29764
2015-06-27 18:10:21 +00:00
Dave Abrahams
d65f696344 Kill off [_]RawOptionSetType
Now that we are using OptionSetType for option sets, all the support for
doing things the old way can die.

Note: the fix-it that used to apply to RawOptionSetType, it seemed to me,
should still apply to OptionSetType, so I switched it over instead of
removing it.

Swift SVN r29066
2015-05-27 15:55:54 +00:00
David Farler
5dbc33f8ac Don't crash the frontend if a bad target is given
Provide a chance to emit a diagnostic instead.

rdar://problem/20931800

Swift SVN r28940
2015-05-23 00:58:05 +00:00
Joe Groff
32fb006386 Clang Importer: Enable OptionSetType import.
Update the tests to match.

Swift SVN r28906
2015-05-22 05:47:37 +00:00
Joe Groff
1af4659c4a Enable interface type mangling.
Fixes rdar://problem/18034517, and addresses a number of compiler crashers due to symbol collisions in the old mangling.

Swift SVN r28383
2015-05-09 22:20:57 +00:00
Joe Groff
92cb2d1d05 Staging option for NS_OPTIONS importer changes.
NFC yet.

Swift SVN r28204
2015-05-06 16:48:59 +00:00
Joe Groff
898f8c5c94 Add a staging option for interface type mangling.
NFC yet.

Swift SVN r28190
2015-05-06 01:29:10 +00:00
Joe Groff
faf085c932 Enable SIMD import by default.
Swift SVN r28089
2015-05-02 15:46:42 +00:00
Chris Willmore
c7a0963d60 Add --enable-throw-without-try option to suppress warning about missing 'try'.
To be used by the debugger so expression parsing doesn't require 'try'
everywhere. <rdar://problem/20356764>

Swift SVN r27949
2015-04-29 23:51:40 +00:00
David Farler
ca5876a866 swiftMarkup Library
Replace ReST-flavored documentation comments with Markdown.

rdar://problem/20180412

In addition to full Markdown support, the following extensions are
supported. These appear as lists at the top level of the comment's
"document". All of these extensions are matched without regard to
case.

Parameter Outlines
------------------

- Parameters:
  - x: ...
  - y: ...

Separate Parameters
-------------------

- parameter x: ...
- parameter y: ...

- Note:
Parameter documentation may be broken up across the entire comment,
with a mix of parameter documentation kinds - they'll be consolidated
in the end.

Returns
-------

- returns: ...

The following extensions are also list items at the top level, which
will also appear in Xcode QuickHelp as first-class citizens:

- Attention: ...
- Author: ...
- Authors: ...
- Bug: ...
- Complexity: ...
- Copyright: ...
- Date: ...
- Experiment: ...
- Important: ...
- Invariant: ...
- Note: ...
- Postcondition: ...
- Precondition: ...
- Remark: ...
- Remarks: ...
- See: ...
- Since: ...
- Todo: ...
- Version: ...
- Warning: ...

These match most of the extra fields in Doxygen, plus a few more per request.

Other changes
-------------
- Remove use of rawHTML for all markup AST nodes except for those
not representable by the Xcode QuickHelp XSLT - <h>, <hr/>, and of
course inline/block HTML itself.

- Update the doc comment RNG schema to more accurately reflect Xcode
QuickHelp.

- Clean up cmark CMake configuration.

- Rename "FullComment" to "DocComment"

- Update the Swift Standard Documentation (in a follow-up commit)

- Update SourceKit for minor changes and link against cmark
  (in a follow-up commit).

Swift SVN r27727
2015-04-26 00:07:15 +00:00
Doug Gregor
2c909b4d36 Remove Objective-C selector splitting options.
We're not going this way.

Swift SVN r27717
2015-04-25 03:59:00 +00:00
Joe Groff
b812db06e4 Turn on C function pointer imports by default.
Update tests to match, and rewrite SwiftPrivatePthreadExtras to take advantage of native C function pointer support instead of hacking it up through a stub C++ library.

Swift SVN r27604
2015-04-22 21:11:31 +00:00
Joe Groff
3b30be2580 Revert "Turn on C function pointer imports by default."
This reverts commit r27598, because SourceKit tests need updating to match.

Swift SVN r27600
2015-04-22 20:37:35 +00:00
Joe Groff
b0497db5ec Turn on C function pointer imports by default.
Update tests to match, and rewrite SwiftPrivatePthreadExtras to take advantage of native C function pointer support instead of hacking it up through a stub C++ library.

Swift SVN r27598
2015-04-22 19:54:35 +00:00
Joe Groff
31388b0899 ClangImporter: Import (some) vector types.
When -enable-simd-import is active, if we encounter a vector type, try to load the SIMD Swift module, and if successful, map float, double, and int vectors to SIMD.{Float,Double,Int}N types if they exist.

Swift SVN r27367
2015-04-16 19:04:09 +00:00
Ben Langmuir
3982ca5135 Extend the hack that delays enum conformance checking to code-completion
This works around a big performance regression in code completion
performance that was introduced with r25741.  This hack does not work
completely correctly with multiple file builds, but a) this should be a
minor issue for enum code completions, and b) this simply returns to the
pre-25741 behaviour.  This hack should disappear when we fix
rdar://problem/20047340.

For rdar://problem/20445407.

Swift SVN r27320
2015-04-15 16:46:31 +00:00
Ben Langmuir
f778836934 Add initializers to postfix-expr code completions
Previously, the only way to get initializers was completing after the
name of the type:
    Foo#^complete_here^#
    Foo(#^or_here^#

And now it will also work in unadorned expressions:
    #^a_top_level_completion^#
    bar(a, #^walked_into_a_bar^#

Unfortunately, not all our clients handle this well yet, so it's
protected by a language option.
    -code-complete-inits-in-postfix-expr

Swift SVN r27275
2015-04-14 14:54:08 +00:00
Devin Coughlin
d08b98b1ca Sema: Turn on availability checking by default
Enable checking for uses of potentially unavailable APIs. There is
a frontend option to disable it: -disable-availability-checking.

This commit updates the SDK overlays with @availability() annotations for the
declarations where the overlay refers to potentially unavailable APIs. It also changes
several tests that refer to potentially unavailable APIs to use either #available()
or @availability annotations.

Swift SVN r27272
2015-04-14 06:44:01 +00:00
Devin Coughlin
53fd9fb59c Sema: Finish staging back in availability checking in synthesized functions
Remove the suppression of deprecation and potential unavailability diagnostics in
synthesized functions. We still suppress some explicit unavailability diagnostics -- those
in synthesized functions in synthesized functions that are lexically contained in
declarations that are themselves annotated as unavailable. For these cases, the right
solution <rdar://problem/20491640> is to not synthesize the bodies of these functions in
the first place.

rdar://problem/20024980

Swift SVN r27203
2015-04-10 05:19:04 +00:00
Doug Gregor
5a22ea2339 Remove vestiges of "-diagnose-generic-extensions".
We're not going to require the type parameters to be redeclared on
extensions of generic types, so take away the staging option and
diagnostic.

Swift SVN r26854
2015-04-02 04:54:38 +00:00
Jordan Rose
960a4f164a Add LangOptions::EnableTargetOSChecking, so that LLDB can ignore OS mismatches.
In particular, this is problematic when libraries are loaded dynamically, and
may have newer deployment targets than the main executable.

Swift SVN r26786
2015-04-01 01:12:29 +00:00
Jordan Rose
8a3fcf621e Add -disable-testable-attr-requires-testable-module.
...which allows "@testable import" to work with modules not compiled for
testing. This isn't generally safe, but should be fine for clients like
SourceKit which just need to have the API available and might not be able
to properly rebuild the original target for testing.

We may revisit this in the future.

Swift SVN r26629
2015-03-27 16:36:41 +00:00
Devin Coughlin
bdc7475d6b Sema: Add temporary flag to stage in availability checking in implicit functions
This flag enables checking of availability (deprecation, explicit unavailability,
and potential unavailability) in synthesized functions. The flag will go away once this
checking is fully staged in.

Swift SVN r26624
2015-03-27 06:48:50 +00:00
Doug Gregor
af4aa6db65 Opt-in diagnostic for extensions of generic types without generic parameters.
This warning is temporarily going being a flag so that, once it is safe to place generic parameters on extensions of generic types, we can opt-in to update our code when it is convenient.

Swift SVN r26416
2015-03-22 12:35:27 +00:00
David Farler
544ef4002d Merge tvOS and watchOS Support
- Add frontend and standard library build support for tvOS.
- Add frontend support for watchOS.

watchOS standard library builds are still disabled during SDK bring-up.

To build for TVOS, specify --tvos to build-script.
To build for watchOS, specify --watchos to build-script (not yet supported).

This patch does not include turning on full tests for TVOS or watchOS, and
will be included in a follow-up patch.

Swift SVN r26278
2015-03-18 21:35:07 +00:00
Jordan Rose
c9eeed3e2d Remove staging option -enable-private-discriminators.
Private discriminators for everybody!

Swift SVN r25997
2015-03-11 23:07:44 +00:00
Argyrios Kyrtzidis
3e1390fe70 [LangOptions] Enable dollar identifiers under a separate language option.
I intend to use such identifiers for placeholder replacements.

Swift SVN r25896
2015-03-09 23:02:55 +00:00
Joe Groff
b5b65b83e9 Remove the -enable-union-import staging flag.
Swift SVN r25809
2015-03-06 23:08:11 +00:00
Dave Abrahams
1bc5f0eb29 ReST hacks: "handle" code blocks
This is at the expense of blockquotes, which we don't actually need at
the moment.  All blockquotes get interpreted as preformatted code.

Swift SVN r25459
2015-02-21 04:02:54 +00:00