Commit Graph

479 Commits

Author SHA1 Message Date
Slava Pestov
7ea93d9ed0 Revert "Preserve SIL when merging modules" 2017-09-14 19:04:18 -07:00
Slava Pestov
ef583499a9 Driver: Pass the new -sil-merge-partial-modules flag
Also pass flags to disable SIL optimization passes when merging
modules, since that's completely unnecessary.

An evolution test that used to fail with WMO disabled now passes
with this change.

FIxes <rdar://problem/18913977>.
2017-09-14 15:54:06 -07:00
Jordan Rose
43ad758b76 Merge pull request #11669 from gmilos/test-pie-flag
Build -shared libs without -pie (on Linux), add tests
2017-09-01 08:56:17 -07:00
Jordan Rose
f8b7db4e76 Excise the terms "blacklist" and "whitelist" from Swift source. (#11687)
The etymology of these terms isn't about race, but "black" = "blocked"
and "white" = "allowed" isn't really a good look these days. In most
cases we weren't using these terms particularly precisely anyway, so
the rephrasing is actually an improvement.
2017-08-30 09:28:00 -07:00
Grzegorz Miłoś
e13efd4007 Inverse the check != DynamicLibrary => == Executable. 2017-08-30 14:00:34 +01:00
John Holdsworth
40c82b6dd0 Allows shared libraries on Linux 2017-08-29 15:33:38 +01:00
John Holdsworth
c4c6a820e5 Avoid adding -pie on Android apps which are -shared 2017-08-29 15:33:38 +01:00
George Karpenkov
020801beb4 Update -sanitize=fuzzer option to take into account new libFuzzer location. (#11595) 2017-08-28 17:16:55 -07:00
swift-ci
326756d7fa Merge pull request #11379 from cheshire/whitespace_cleanup 2017-08-07 19:01:45 -07:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
2017-08-07 18:16:51 -07:00
George Karpenkov
ddb7fcf81d [NFC] Clean up whitespace (no tabs!) and indentation. 2017-08-07 17:11:32 -07:00
Jordan Rose
d495e1c075 Merge pull request #11272 from gmilos/sr-5405-position-independent-executables-on-linux
Build position independent Linux binaries.
2017-08-02 08:49:57 -07:00
Huon Wilson
374826c960 Merge pull request #11219 from huonw/tbd-is-not-a-main-product
[Frontend] Emit tbd as an extra output, not a frontend action.
2017-07-31 18:46:02 -07:00
Grzegorz Miłoś
78938d8f86 Add -pie flag to clang++ linker invocation. 2017-07-31 19:21:32 +01:00
Huon Wilson
dfa8501e59 [Frontend] Emit tbd as an extra output, not a frontend action.
This means it can be emitted during an -emit-module frontend job, which is the
most common place it will be used, so reusing work like this is important for
performance.

For now, this has to happen as part of a single frontend invocation, i.e. -wmo
or -force-single-frontend-invocation.
2017-07-31 11:05:29 -07:00
John McCall
efaf5e66ba Now that the Clang importer honors and expects -O, make sure we
pass it to the PCH-generation job.

This depends on the merge-modules patch because we don't want merging
modules when optimization is enabled to re-run the optimizer.
(Thanks, Jordan!)

rdar://33541306
2017-07-27 10:21:02 -04:00
John McCall
dda3a3827c [SR-3063] Suppress SIL transforms when merging modules. 2017-07-27 10:21:02 -04:00
Pavel Yaskevich
4f8872598b [ConstraintSolver] NFC: Add option to control early termination of shrinking phase
Currently we have a number of unsolved disjunctions hard-coded to 5,
which breaks some existing code by terminating shrinking too early.
This patch makes it a command-line option so users have control over
what that threshold can be.

Resolves: rdar://problem/33433595
2017-07-20 12:44:48 -07:00
Jordan Rose
e994f61e58 Merge pull request #9958 from spevans/pr_static_libs
SR-648: Allow swiftpm to statically link binaries on Linux
2017-07-19 12:52:54 -07:00
Doug Gregor
f03685b6d0 Introduce a command-line option to limit the # of typo corrections.
Typo correction can be particularly expensive, so introduce a
command-line flag to limit the number of typo corrections we will
perform per type-checker instance. Default this limit to 10.

Addresses rdar://problem/28469270 to some extent.
2017-07-10 11:40:35 -07:00
Carl Brown
dacbb8750f Linux Address and Thread Sanitizer Support (#6446) 2017-07-02 12:42:01 -07:00
David Farler
645aaad551 [index/build] Upstream indexing while building changes
This patch upstreams previously AppleInternal changes for
indexing while building.
2017-06-29 16:20:06 -07:00
Simon Evans
3ac5e12c67 [Linux] Reorder the -Xlinker and -l arguments
- Move the -Xlinker and -l options to just before swift_end.o

- Add testcase to check linker option ordering.
2017-06-29 13:10:04 +01:00
Simon Evans
03b067b949 [Linux] Reorder arguments for autolink files from swift-autolink-extract
- Reordering the auto link files when linking in static libraries
  and object files is required because the ordering of arguments
  is important, and the dependant libraries need to come after the
  objects/libs that require them. This is not a problem for
  libswiftCore.a but can be an issue with libs that sit on top of
  it, e.g. libFoundation.a

- Dont add an -rpath to the Swift dynamic libraries if using
  -static-stdlib
2017-06-29 13:08:15 +01:00
Jordan Rose
ad3c773446 Merge pull request #10381 from keith/ks/no-linking-rpath
Don't add rpath to swift with statically linking.
2017-06-20 09:01:18 -07:00
Keith Smiley
607312663b Don't add rpath to swift with statically linking
This updates the rpath linking logic to only add the rpath that points
to the swift dylibs in the case that the libraries are not statically
linked into the binary.
2017-06-19 13:36:47 -07:00
George Karpenkov
9637bd2c36 Change driver logic for sanitizers support.
With this patch different sanitizers (tsan/asan) will be enabled or
disabled on the driver level on a particular OS depending on whether
the required library is present.

The current patch only supports Darwin architectures, but Linux support
should not be hard to add.
2017-06-16 13:26:46 -07:00
Doug Gregor
dc2159c170 [Driver] Pass -warn-swift3-objc-inference-(minimal|complete) to the frontend.
Fixes rdar://problem/32428233.
2017-05-26 10:29:25 -07:00
Michael Ilseman
4640246263 Revert "[stdlib] Static stdlib requires explicit -licucore"
This reverts commit 0de2425112.
2017-05-18 19:41:55 -07:00
Michael Ilseman
116b5330bb Revert "[stdlib] Static linking test case"
This reverts commit f1a7c3df5b.
2017-05-18 19:41:45 -07:00
Michael Ilseman
f1a7c3df5b [stdlib] Static linking test case
Adds a test case that the compiler driver will properly insert
-licucore for static standard library builds. This test runs even on
builds that don't build a static standard library, so PR testing can
regressions here.
2017-05-18 14:33:09 -07:00
Michael Ilseman
0de2425112 [stdlib] Static stdlib requires explicit -licucore 2017-05-18 12:08:17 -07:00
Argyrios Kyrtzidis
a6a3ebee6c [Driver] For the persistent PCH job there is no output path, the frontend determines the filename to use.
Previously the parseable output would have an empty string as the output of the PCH job, this fixes the issue.
2017-05-13 14:59:18 -07:00
Argyrios Kyrtzidis
4391ecc802 [Driver] For the 'emit persistent PCH' job, don't set an output filename. 2017-05-11 16:24:51 -07:00
Argyrios Kyrtzidis
c4b5b60d00 [Driver/ClangImporter] Changes for the driver to recognize -pch-output-dir and propagate to the frontend invocations
For the multiple-files mode -emit-pch is still invoked in separate frontend invocation but with using a persistent PCH.
Subsequent frontend invocations use the persistent PCH but they don't need to validate it.

For all-files mode (e.g. WMO) the frontend invocation uses a persistent PCH that it also validates.
2017-05-11 11:44:12 -07:00
David Farler
bf52ff032a [Migrator] Conservative and Minimal @objc inference workflows
Based on recommendations in SE-0160, there are two migration workflows:

- Conservative: Maintain @objc visibility that was inferred in Swift 3
  by adding @objc to all declarations that were implicitily visible to
  the Objective-C runtime. This is invoked in the migrator by adding the
  -migrate-keep-objc-visibility flag.
- Minimal: Only declarations that must be visible to Objective-C based
  on their uses (or in cases like dynamic vars) are migrated.

rdar://problem/31876357
2017-04-28 18:28:34 -07:00
David Farler
63776b507b When converting some of the old Migrator automation to the new Migrator,
I had set up the driver to invoke a separate frontend invocation with
the "update code" mode. We sort of did this last release, except we
forked to the swift-update binary instead. This is causing problems with
testing in Xcode.

Instead, let's perform a single compile and add the remap file as an
additional output during normal compiles. The driver, seeing
-update-code, will add -emit-remap-file-path $PATH to the -c frontend
invocation.

rdar://problem/31857580
2017-04-27 01:03:00 -07:00
Xi Ge
2a2731a797 migrator: add a flag to print incoming usrs to the API diff data store to facilitate testing. NFC (#8969) 2017-04-24 13:53:55 -07:00
Huon Wilson
d0739294ed Merge pull request #8887 from huonw/emit-loaded-module-trace
[Frontend] -frontend -emit-loaded-module-trace.
2017-04-21 13:25:52 -07:00
Huon Wilson
87aa3e6935 [Frontend] -frontend -emit-loaded-module-trace.
The -frontend jobs can output a JSON file summarizing the
swiftmodules (etc.) they load during compilation.
2017-04-21 11:14:29 -07:00
Xi Ge
c55b43efc0 [Migrator] Add the simple transformation from global variables to static member variables. (#8865)
This should also handle global string to string enum migration.
2017-04-20 18:36:33 -07:00
David Farler
303a3e5824 Start the Migrator library
The Swift 4 Migrator is invoked through either the driver and frontend
with the -update-code flag.

The basic pipeline in the frontend is:

- Perform some list of syntactic fixes (there are currently none).
- Perform N rounds of sema fix-its on the primary input file, currently
  set to 7 based on prior migrator seasons.  Right now, this is just set
  to take any fix-it suggested by the compiler.
- Emit a replacement map file, a JSON file describing replacements to a
  file that Xcode knows how to understand.

Currently, the Migrator maintains a history of migration states along
the way for debugging purposes.

- Add -emit-remap frontend option
  This will indicate the EmitRemap frontend action.
- Don't fork to a separte swift-update binary.
  This is going to be a mode of the compiler, invoked by the same flags.
- Add -disable-migrator-fixits option
  Useful for debugging, this skips the phase in the Migrator that
  automatically applies fix-its suggested by the compiler.
- Add -emit-migrated-file-path option
  This is used for testing/debugging scenarios. This takes the final
  migration state's output text and writes it to the file specified
  by this option.
- Add -dump-migration-states-dir

  This dumps all of the migration states encountered during a migration
  run for a file to the given directory. For example, the compiler
  fix-it migration pass dumps the input file, the output file, and the
  remap file between the two.

  State output has the following naming convention:
  ${Index}-${MigrationPassName}-${What}.${extension}, such as:
  1-FixitMigrationState-Input.swift

rdar://problem/30926261
2017-04-17 16:25:02 -07:00
John McCall
b233e872dc Fix the type-checker's recursive value type checking.
Track the types we've seen instead of the type declarations we've
passed through, which eliminates some holes relating to generic types.
Detect infinite expansions by imposing an arbitrary limit.

Fixes rdar://30355804
2017-04-12 15:55:45 -04:00
swift-ci
c39ffda2b8 Merge pull request #8477 from graydon/rdar-30961871-metrics-mark-2 2017-04-03 20:39:16 -07:00
Graydon Hoare
0245c83c4b [Stats] Add -stats-output-dir, wire UnifiedStatsReporter into place. 2017-04-03 18:08:59 -07:00
Doug Gregor
6244abf9f9 [Driver] Surface -warn-swift3-objc-inference to swiftc.
The `-warn-swift3-objc-inference` option turns out to be extremely
useful in vetting code for unintended `@objc` entry points, so make it
available directly on `swiftc`.

But, bury the enable/disable flags under `-frontend` (they were
effectively there anyway because the driver wasn't propagating them).
2017-03-31 21:53:59 -07:00
Huon Wilson
fba2ab49dc Merge pull request #8301 from huonw/symbol-list
Initial TBD push: list of (some) public symbols
2017-03-29 12:48:22 -07:00
Jordan Rose
8d3351c8ce Merge pull request #8404 from jrose-apple/Fsystem-is-not-a-linker-flag
[Driver] Fix passing -Fsystem to the linker.
2017-03-29 09:59:14 -07:00
Jordan Rose
4ad2ea5c0c [Driver] Fix passing -Fsystem to the linker.
-Fsystem is not a linker flag. Pass it as -F to ld on Apple platforms,
and -iframework to Clang on other platforms.
2017-03-29 08:59:57 -07:00
Huon Wilson
4eff6f1374 [FrontendTool] -emit-tbd and -validate-tbd-against-ir flags.
These, respectively, write a list of symbols to a file, and compare what
that list would be against the "true" list (the symbol names in the IR).
2017-03-28 16:31:09 -07:00