Commit Graph

462 Commits

Author SHA1 Message Date
Graydon Hoare
a95f5da86d [Bridging PCH] Add -emit-pch to Frontend; call emitBridgingPCH. 2017-01-13 15:18:39 -08:00
Mark Lacey
3903a43f97 Add a command-line option to time expression type-checking. 2017-01-11 00:15:38 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Jordan Rose
23f25e1de7 In immediate mode, detect the host OS version on Apple platforms.
This allows script mode to pick up the current version of macOS
instead of defaulting to 10.9, making it unnecessary to write #available.
A -target flag can still override this if you're trying to write a
portable script.

The logic is a little tortured to avoid having to actually link to
Foundation.framework or libobjc.

Finishes rdar://problem/29433205.
2016-12-22 17:01:33 -08:00
Jordan Rose
32206a5523 Merge pull request #6332 from mxswd/pc-macro
Added a new AST Walker that instruments the AST to provide callbacks that simulate a program counter
2016-12-21 15:35:48 -08:00
Maxwell Swadling
214efbfc3c Added a new AST Walker that instruments the AST to provide callbacks that simulate a program counter
Based off the PlaygroundTransform, this new ASTWalker leaves calls to __builtin_pc_before and __builtin_pc_after before and after a user would expect a program counter to enter a range of source code.
2016-12-19 10:56:40 -08:00
Maxwell Swadling
29088d9490 Added new Frontend flag to remove -fmodules-validate-system-headers from clang importer flags 2016-12-16 15:06:19 -08:00
Roman Levenstein
354fd29f31 Add a new -assume-single-threaded option
This is a hidden option. It should be used like: -assume-single-threaded

When this function is provided, the compiler assumes that the code will be executed in the single threaded mode. It then performs certain optimizations that can benefit from it, e.g. it  marks as non-atomic all reference counting instructions in the user code being compiled.
2016-12-05 10:05:34 -08:00
Hugh Bellamy
4779659f39 Fix warnings building swift/Frontend on Windows using MSVC 2016-12-02 12:50:39 +00:00
David Farler
6d8514b2a3 Add back the -parse flag, which doesn't typecheck 2016-11-28 10:50:55 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Janosch Hildebrand
06b3a0fdcb Fix typo 2016-11-25 09:56:06 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Slava Pestov
a760186505 AST: Remove -enable-experimental-nested-generic-types flag 2016-11-18 00:39:15 -08:00
John McCall
d123345689 Provide a frontend option to disable typo correction.
rdar://29003217
2016-11-02 14:08:56 -07:00
Michael Gottesman
b038a91b8f [semantic-arc] Add the assume-parsing-unqualified-ownership-sil argument ath forces the Parser to assume that all parsed code is unqualified. This overrides the parser ownership heuristic. 2016-10-29 20:11:08 -07:00
practicalswift
4181323880 [gardening] Fix recently introduced typo. 2016-10-21 22:25:35 +02:00
Michael Ilseman
5d540ababd [Swift version] Note all supported versions when -swift-version is misused. 2016-10-18 14:43:21 -07:00
Michael Ilseman
12efcc9db6 [Version] Don't allow effective sub-versions, only major versions
Also offer a note when the major version is valid on its own.
2016-10-18 14:43:21 -07:00
Mark Lacey
316492bed4 Fix -parse-sil for filenames not ending in .sil. 2016-10-18 06:51:13 -07:00
Michael Gottesman
e2b4e6f3fa [semantic-arc] Add the -enable-sil-ownership flag and propagate its value to SILOptions.EnableSILOwnershipModel.
This will allow for semantic arc work to remain behind a flag and not affect
other in tree developers. More importantly it enables for bots to be setup with
this flag enabled.

rdar://28685236
2016-10-11 11:29:12 -07:00
Joe Groff
2a86a6bca7 Add a -disable-sil-partial-apply frontend staging option. 2016-10-07 16:04:20 -07:00
Slava Pestov
745a4a3974 IRGen: Disable resilient class metadata unless -enable-class-resilience is passed in
Resilient classes are not fully implemented yet, and can cause
crashes at runtime; add a flag disabling them until the code is
done, to unblock standard library testing with resilience
enabled.
2016-09-30 18:28:11 -07:00
Graydon Hoare
8970d44675 Add "-swift-version <n>" that sets LangOpts.EffectiveLanguageVersion.
This flag switches the "effective language version" of the compiler,
at least to any version supported (as of this change: "3" or "3.0").

At the moment nothing uses it except the language version build
configuration statements (#if swift(...)) and various other places
that report, encode, or otherwise check version numbers.

In the future, it's intended as scaffolding for backwards compatibility.

Fixes SR-2582
2016-09-20 15:11:37 -07:00
Jordan Rose
5746671a19 Add -verify-apply-fixes to accompany -verify.
Enables Chris's auto-apply-fixes mode for -verify: if an expected-*
annotation has the wrong message, or if the expected fix-its are
incorrect, this option will **edit the original file** to update them.

This is a tool for compiler developers only; it doesn't affect
normal diagnostic printing or normal fix-its.
2016-09-15 10:38:43 -07:00
Michael Ilseman
d625ed288e [ClangImporter] remove antiquated swift_newtype options 2016-09-09 13:55:20 -07:00
Doug Gregor
2552f41556 [Name lookup] Add a staging flag for ASTScope-based name lookup. 2016-09-06 09:05:11 -07:00
Doug Gregor
412d1d5e1e [Scope map] Introduce an operation to find the innermost scope based on a given source location.
Given a source location, we can find the innermost enclosing scope
that describes that source location. Introduce this operation into the
scope map, then add a testing mode where we probe the scope map at
specifi locations to see what we find. Test for:

1) Finding the right innermost enclosing scope, and
2) That we're only expanding the part of the scope map that is needed
to identify that scope.
2016-09-02 17:13:05 -07:00
Doug Gregor
4e214687ca [WIP Name binding] Introduce a basic 'scope map' to model scopes in the AST.
The scope map models all of the name lookup scopes within a source
file. It can be queried by source location to find the innermost scope
that contains that source location. Then, one can follow the parent
pointers in the scope to enumerate the enclosing scopes.

The scope map itself is lazily constructed, only creating scope map
nodes when required implicitly (e.g, when searching for a particular
innermost scope) or forced for debugging purposes.

using a lazily-constructed tree that can be searched by source
location. A search within a particular source location will
2016-09-02 17:13:05 -07:00
Doug Gregor
f99904ac66 Eliminate the useless flag -enable-experimental-collection-casts.
This eliminates a pile of now-dead code in:
  * The type checker, where we no longer have special cases for bridging conversions
  * The expression ASTs, where we no longer need to distinguish bridging collection up/down casts
  * SILGen, which no longer uses

Still to come is the removal of the
_(set|dictionary)Bridge(From|To)ObjectiveC(Conditional)? entrypoints
from the standard library. They're still used by some tests.
2016-08-19 21:17:10 -07:00
Doug Gregor
51529ae888 Eliminate the -enable-id-as-any flag; it's always on now anyway.
Simplify e.g., ASTContext::getBridgedToObjC(), which no longer needs
the optional return.

Eliminate the now-unused constraint kind for checking bridging to
Objective-C.
2016-08-19 21:17:09 -07:00
Doug Gregor
f9d109442a Remove -suppress-argument-labels-in-types; it's dead. 2016-08-19 14:27:29 -07:00
Doug Gregor
fe7e780559 Remove -Womit-needless-words; it was a hack to bring up the Grand Renaming.
I'm slightly sad about losing the lovely code to detect
redundantly-specified defaulted arguments, but we could bring it back
later as a separate warning.
2016-08-19 14:19:51 -07:00
Doug Gregor
eb3ba78d94 Remove the swift3_migration attribute.
This attribute was a (my) bad idea that we ended up not using. Kill it.
2016-08-19 14:04:06 -07:00
Jordan Rose
38e6b2808e Do even less availability checking under -disable-availability-checking. (#4214)
...and make sure we're in that mode for SIL inputs and for sil-opt and
sil-extract, even when working with AST types and declarations rather
than SIL types.

Without this, we get zillions of deprecation warnings coming out of
the validation tests SIL/parse_stdlib_*.sil, which dump the standard
library and then attempt to re-parse it. This has been causing the
"long" tests to take, well, too long.
2016-08-11 10:19:46 -07:00
Jordan Rose
b5aca663bc [ClangImporter] Remove importer-based NS stripping. (#3880)
* [ClangImporter] Remove importer-based NS stripping.

As Tony puts it, in the end we wound up with more Foundation
declarations imported as members or keeping "NS" than those that
dropped it, and any further decisions will be made on a case-by-case
basis. Move all of the existing cases of prefix-stripping into
Foundation's API notes and drop the logic from the compiler.

Tested by dumping the generated interface for Foundation and its
submodules for both macOS and the iOS simulator, and comparing the
results. A few cases did slip through here because of the interaction
between "SwiftName" and "Availability: nonswift".

The next commit will re-add "NS" to some stragglers that we missed.

rdar://problem/26880017

* APINotes: Add "NS" back to a few types.

NSKeyedUnarchiverDelegate
NSKeyedArchiverDelegate
NSTextCheckingTypes
NSBinarySearchingOptions
NSEnumerationOptions
NSSortOptions

More rdar://problem/26880017

* Remove now-redundant SwiftNames from API notes.

No change observed in the generated interface of Foundation and its
submodules.

Finishes rdar://problem/26880017.
2016-08-01 20:54:26 -07:00
Chris Lattner
62e4811dac Remove support for nominal type patterns, which have never been supported in an
official swift release and have bitrotted.
2016-07-31 18:44:08 -07:00
Doug Gregor
a9536906ff [SE-0111] Drop argument labels on references to function values.
When referencing a function in the type checker, drop argument labels
when we don't need them to type-check an immediate call to that
function. This provides the semantic behavior of SE-0111, e.g.,
references to functions as values produce unlabeled function types,
without the representational change of actually dropping argument
labels from the type system.

At the moment, this only works for bare references to functions. It
still needs to be pushed through more of the type checker and more AST
nodes to work in the general case.

Keep this work behind the frontend flag
-suppress-argument-labels-in-types for now.
2016-07-28 15:40:11 -07:00
Slava Pestov
1ae8e37058 Remove -enable-protocol-typealiases staging flag
It looks like migration fixits are done, and this doesn't
expose any new bugs that were not possible before, because
you could already define typealiases inside protocol
extensions.

To prevent some compiler_crasher regressions, add a simple
circularity-breaking hack. I'll need to do a sweep to clean
these up some day soon.
2016-07-25 23:18:49 -07:00
John McCall
445ff27082 Basic Sema support for covariant collection casting.
The previous revert was required because of missing stdlib support.
I believe that support is now present, at least so that this won't
crash on Linux.
2016-07-19 14:35:03 -07:00
Mishal Shah
8a660e5b85 Revert "Basic Sema support for covariant collection casting."
Ubuntu 14.04 and 15.10 bots failing due to this commit.

This reverts commit 4b6a57292f.
2016-07-14 12:35:40 -07:00
John McCall
4b6a57292f Basic Sema support for covariant collection casting. 2016-07-13 19:13:02 -07:00
adrian-prantl
b1e0afc039 Merge pull request #3350 from adrian-prantl/25498103
Debug info diet!
2016-07-07 11:34:21 -07:00
Saleem Abdulrasool
53b9eb46ed Frontend: add -autolink-library= option to support Windows
All modules on Windows need to link against one of {libcmtd.lib, libcmt.lib,
msvcrtd.lib, msvcrt.lib}.  In addition to being the C library, it is the
equivalent of crtbegin0.o on other targets.  It is responsible for providing the
entry point itself.  Traditionally, cl will embed the linkage requirement into
all objects based on the flags given -- one of {/MTd, /MT, /MDd, /MD}.  clang
emulates this via the `--dependent-lib=` option.  Emulate that behaviour in the
swift driver so that swift objects being compiled for Windows targets can
auto-link to the required libraries.
2016-07-06 17:53:04 -07:00
Joe Groff
231db9d108 Clang importer: Import ObjC 'id' as Swift 'Any' (behind a flag).
For experimentation purposes, add a flag to cause the Clang importer to map ObjC APIs using `id` to `Any` instead of `AnyObject`.
2016-07-05 12:29:45 -07:00
Adrian Prantl
6b1263bf5a [Driver] Add a -gdwarf-types option and set it up as an alias for -g (NFC-ish)
Background
----------

Now that Swift AST type support in LLDB has matured, we can stop emitting DWARF
type information by default to reduce compile time and ibject file size.
A future commit will change -g to emit only AST type references.

The full set of debug options will be
-gnone
-gline-tables-only
-g                 // AST types (= everything that LLDB needs)
-gdwarf-types      // AST types + DWARF types (for legacy debuggers)
2016-07-05 12:06:23 -07:00
Slava Pestov
011e306fe8 Sema: Add -enable-experimental-nested-generic-types frontend flag
Also, split up test/decl/nested.swift into several files.
2016-06-13 16:46:41 -07:00
gregomni
2f9ac3444e Disable typealiases in protocols and add frontend flag to re-enable.
Goes back to Swift 2.2 behavior of treating the 'typealias' keyword inside a protocol as a deprecated form of an associatedtype. To get the newer (but still partly buggy) behavior of treating it as an actual typealias, add "-Xfrontend -enable-protocol-typealiases" to the compile invocation. 'decl/typealias/typealias.swift' now uses this flag to continue testing the enabled behavior.
2016-06-01 14:11:56 -07:00
Dan Liew
827f573d6b Teach the Swift front-end to generate code with
"Sanitizer Coverage" with a new flag ``-sanitize-coverage=``. This
flag is analogous to Clang's ``-fsanitize-coverage=``.

This instrumentation currently requires ASan or TSan to be enabled
because the module pass created by ``createSanitizerCoverageModulePass()``
inserts calls into functions found in compiler-rt's "sanitizer_common".
"sanitizer_common" is not shipped as an individual library but instead
exists in several of the sanitizer runtime libraries so we have to
link with one of them to avoid linking errors.

The rationale between adding this feature is to allow experimentation
with libFuzzer which currently relies on "Sanitizer Coverage"
instrumentation.
2016-05-27 13:34:31 -07:00
David Farler
a38a4ce596 SwiftRemoteMirror: Turn on reflection metadata by default
Flip the enable flags to disable and make these IRGen options
true by default.

rdar://problem/26206547
2016-05-21 17:40:37 -07:00