695 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
Bob Wilson
c765d5e3a5 Merge remote-tracking branch 'origin/master' into master-next 2017-01-12 15:58:19 -08:00
Sean Callanan
399709ccb8 Optionally separate Tasks` stderr from stdout.
Fixes a serious problem where spurious output from xcrun breaks
swift's discovery of libarclite.

<rdar://problem/28573949>
2017-01-11 11:11:23 -08:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
deddf19aae Merge remote-tracking branch 'origin/master' into master-next 2016-12-13 10:23:03 -08:00
Jordan Rose
300d690ce0 [Driver] Remove unused "ToolChains" map from the Driver class. (#6114)
We only ever make one toolchain, and it's passed around explicitly
everywhere it's needed.

No functionality change.
2016-12-06 17:27:52 -08:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08: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
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
Bob Wilson
f10ae47b9f Merge remote-tracking branch 'origin/master' into master-next 2016-11-15 17:32:28 -08:00
Brian Gesiak
6a2d466e4b Merge pull request #5377 from modocache/sr-2855-malformed
[Driver] Show incremental is off with bad JSON
2016-11-14 15:07:56 -05:00
Brian Gesiak
847278e295 [Driver] Show incremental is off with bitcode, WMO
SR-2855 suggests `-driver-show-incremental` not only print information
about why certain files are included in incremental compilation, but
also print out why incremental compilation may be disabled altogether.

Add a message for two such reasons:

1. When whole module compilation is enabled, since optimizations for
   WMO require a full rebuild.
2. When embedding LLVM IR bitcode, which needs to be re-generated.
2016-11-12 16:54:26 -05:00
Bob Wilson
956c7150d5 Tweak my previous changes for reading and writing times.
As far as I know, the previous code worked OK but this version seems
cleaner.
2016-11-09 10:40:40 -08:00
Brian Gesiak
7a21445083 [Driver] Show incremental is off with bad JSON
SR-2855 suggests `-driver-show-incremental` not only print information
about why certain files are included in incremental compilation, but
also print out why incremental compilation may be disabled altogether.

Add a message for one such reason: when the build record file is
malformed.
2016-11-05 13:28:40 -07:00
Bob Wilson
564fc6f22d Clean up my changes for llvm r284966.
Sorry -- I meant to include this with the previous commit. LLVM is
moving away from llvm::sys:TimeValue in favor of std::chrono. For consistency
with LLVM, I used the new llvm::sys::TimePoint type in most places.
There are a few places, like the SourceKit files modified here, where it
makes more sense to use std::chrono directly.
2016-10-28 13:17:26 -07:00
Bob Wilson
5c4f517824 Checkpoint fixes for llvm r284966 (TimeValue) 2016-10-28 12:09:57 -07:00
Brian Gesiak
0e760b532d Show args mismatch in -driver-show-incremental
SR-2855 suggests `-driver-show-incremental` not only print information
about why certain files are included in incremental compilation, but
also print out why incremental compilation may be disabled
altogether.

Add a message for one such reason: when the arguments passed to the Swift
compiler don't match the ones used previously.
2016-10-19 21:54:39 -04:00
Brian Gesiak
c2002ea485 Show inputs mismatch in -driver-show-incremental
SR-2855 suggests `-driver-show-incremental` not only print information
about why certain files are included in incremental compilation, but
also print out why incremental compilation may be disabled altogether.

Add a message for one such reason: when the inputs passed to the
Swift compiler don't match the ones used previously.
2016-10-19 15:13:25 -04:00
Brian Gesiak
88ac6181bb Show version mismatch in -driver-show-incremental
SR-2855 suggests `-driver-show-incremental` not only print information
about why certain files are included in incremental compilation, but
also print out why incremental compilation may be disabled altogether.

Add a message for one such reason: when the version of the Swift
compiler being used to incrementally compile doesn't match the one used
to compile previously.
2016-10-17 18:56:09 -04:00
Brian Gesiak
685a952675 [Driver] Fix typo "BackenJobAction" (NFC) 2016-09-23 09:09:31 -04:00
practicalswift
b057000640 [gardening] Fix recently introduced typos 2016-09-22 17:16:13 +02: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
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
Brian Gesiak
2b3647efc4 [Driver] Move .swiftdeps strings (NFC)
Define compilation record (.swiftdeps) top-level keys, as well as string
identifiers used in compilation record files (like "!dirty" and "!private"), in
a single location. NFC.
2016-08-30 12:30:14 -04:00
Brian Gesiak
ba8009bfa3 [SR-1788] Add -driver-time-compilation option (#4367)
Add an option to print the time it takes each driver task to complete.

Here's an example of the output:

```
$ swiftc -driver-time-compilation \
         -emit-library -module-name Crispix \
         Crispix/A.swift Crispix/B.swift Crispix/C.swift
===-------------------------------------------------------------------------===
                           Driver Time Compilation
===-------------------------------------------------------------------------===
  Total Execution Time: 0.0000 seconds (0.0875 wall clock)

   ---Wall Time---  --- Name ---
   0.0245 ( 28.0%)  link /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0211 ( 24.1%)  compile /path/to/Crispix/A.swift
   0.0209 ( 23.9%)  compile /path/to/Crispix/B.swift
   0.0176 ( 20.1%)  compile /path/to/Crispix/C.swift
   0.0035 (  4.0%)  swift-autolink-extract /path/to/Crispix/A.swift /path/to/Crispix/B.swift /path/to/Crispix/C.swift
   0.0875 (100.0%)  Total
```
2016-08-23 13:35:48 -07:00
Brian Gesiak
cc32f9376d [SR-2400] Add -continue-building-after-errors (#4437)
Currently the Swift driver stops invoking frontend commands as soon as one of
them reports an error. Add a flag to control this behavior, so that users can
choose whether to see all the errors at once or bail out early.
2016-08-22 08:43:03 -07:00
Michael Gottesman
cae9dedde2 Merge pull request #3439 from danielmartin/swift-format-tool
swift-format tool
2016-08-08 21:54:32 -07:00
Daniel Martín
df15ec4f3b Swift-format driver tool
This driver tool formats Swift files or file ranges using some
parameters like tabs or spaces, tab width, or amount of spaces.
2016-08-08 11:07:15 +02:00
Dmitri Gribenko
0a1bfda1ce Merge pull request #3887 from tinysun212/pr-autolink-cygwin
[Autolink] Autolinking on COFF for Cygwin/MinGW
2016-08-07 12:54:57 -07:00
Han Sangjin
0747503b0f [Autolink] Autolinking on COFF for Cygwin/MinGW
Cygwin and MinGW should use the autolink feature in the sameway of Linux
due to the linker's limit. Now swift-autolink-extract recognizes the
COFF format file for Cygwin/MinGW.
2016-08-07 07:20:50 +09:00
Jordan Rose
c9c0df2e55 [Driver] Address Brian G's feedback on 848b3eb. (#4046)
No functionality change.
2016-08-05 17:26:03 -07:00
Jordan Rose
848b3eb6a3 [Driver] Make sure to rebuild dependents when a dirty file fails. (#3935)
Otherwise we get into a situation like this:

1. Change made to the interface of file A.swift that also causes an
   error in A.swift.
2. Fixing the error in A.swift does not affect A.swift's interface.
3. File B.swift that depends on A.swift is not rebuilt, since the most
   recent change to A.swift did not change its interface.

To fix this, mark downstream files as needing to be rebuilt even when
a compilation job fails with errors. Additionally, attempt to be extra
conservative when there's a crash.

rdar://problem/25405605
2016-08-02 19:07:29 -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
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -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
Zhuowei Zhang
7c502b6344 Port to Android
This adds an Android target for the stdlib. It is also the first
example of cross-compiling outside of Darwin.

Mailing list discussions:

1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html
2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html

The Android variant of Swift may be built using the following `build-script`
invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  --android \                                    # Build for Android.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

Android builds have the following dependencies, as can be seen in
the build script invocation:

1. An Android NDK of version 21 or greater, available to download
   here: http://developer.android.com/ndk/downloads/index.html.
2. A libicu compatible with android-armv7.
2016-04-12 19:26:21 -04:00
Jordan Rose
5810073579 Merge pull request #1908 from modocache/toolchain-hierarchy
[Toolchains] Cygwin toolchain inherits from Unix
2016-04-05 19:27:47 -07:00
Brian Gesiak
d0747b0f47 [Toolchains] Cygwin toolchain inherits from Unix
There is currently a great deal of duplication across the
`GenericUnix` and `Windows` toolchains. The Android port will
add even more duplication.

To mitigate this, have `Windows` inherit from `GenericUnix`, and
have them share most of their implementation.

In addition, rename `Windows` to `Cygwin` (it would be pretty strange
to have a `Windows` toolchain inherit from something named `*Unix`).
2016-04-05 21:20:10 -04:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
Dmitri Gribenko
cc2a2f8921 Revert "[Driver] Default SDKROOT to / on FreeBSD." 2016-03-02 09:26:06 -08:00
Davide Italiano
d9bc8bf13f Merge pull request #1500 from dcci/sdkroot
[Driver] Default SDKROOT to / on FreeBSD.
2016-03-01 22:14:21 -08:00
Davide Italiano
c82588b01b [Driver] Default SDKROOT to / on FreeBSD.
This is needed for the testusuite to run correctly.
2016-03-01 20:15:24 +00:00
AnnaZaks
767d9ca914 Merge pull request #1434 from apple/asan
[asan] Add basic support for Address Sanitizer function instrumentation
2016-02-29 18:58:40 -08:00
zaks
2110235fd3 [asan] Cleanup based on Jordan's review comments 2016-02-26 16:02:40 -08:00
zaks
d727c68fde [asan] Add "unsupported option .. for target" error message
ASan support for Linux does not exist at this point.
2016-02-25 15:20:51 -08:00
zaks
ef925f8fb3 [asan] Add basic support for Address Sanitizer function instrumentation
ASan allows to catch and diagnose memory corruption errors, which are possible
when using unsafe pointers.

This patch introduces a new driver/frontend option -sanitize=address to enable
ASan. When option is passed in, the ASan llvm passes will be turned on and
all functions will gain SanitizeAddress llvm attribute.
2016-02-24 09:45:38 -08:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
William Dillon
d0d9b1de5a Discard swift.ld and support gold linker 2016-02-17 17:47:35 -08:00