Commit Graph

673 Commits

Author SHA1 Message Date
Saleem Abdulrasool
7514adf66a Driver: introduce new -libc option for Windows
On Windows, there are multiple variants of the C runtime that must be
explicitly specified and consistently used from the runtime to the
application.  The new `-libc` option allows us to control the linking
phase by correctly embedding the requested library to be linked.  It is
made into a required parameter on Windows and will add in the
appropriate flags for the imported C headers as well.  This ensures that
the C library is not incorrectly linked.
2019-05-16 21:01:47 -07:00
Jordan Rose
5191b036f2 Merge pull request #24008 from allevato/batch-mode-response-files
Fix response file support for batch jobs.
2019-05-16 08:18:18 -07:00
Tony Allevato
a1aab6a34e Add test for batch mode with -driver-force-response-files. 2019-05-15 08:35:57 -07:00
Alexander Shaposhnikov
1525e9bfc5 [Windows] Add initial implementation for TaskQueue 2019-05-14 11:42:08 -07:00
Keith Smiley
99341a7aa7 Move color-diagnostics to Options.td (#24144)
This allows us to mark this flag as DoesNotAffectIncrementalBuild, so
that switching between a tty and non-tty doesn't cause full rebuilds
with swiftpm.

https://bugs.swift.org/browse/SR-7982
2019-04-18 19:32:00 -07:00
Tony Allevato
6d7223023d Fix response file support for batch jobs. 2019-04-13 10:06:30 -07:00
Harlan Haskins
150ad99457 [ModuleInterfaces] Replace 'module file' with 'compiled module'
...only in diagnostics. And make the tests pass.

rdar://49359734
2019-04-11 18:05:09 -07:00
Harlan Haskins
6d72977642 [test] [ModuleInterfaces] Get tests passing with new diagnostics 2019-04-11 18:05:09 -07:00
Saleem Abdulrasool
285e2acdd0 test: adjust for Windows file extensions
Windows tools have the `.exe` suffix which may or may not be present.
Adjust the test to account for that.
2019-04-03 13:36:24 -07:00
Saleem Abdulrasool
5b6e8cd061 test: make the test more resilient to path setup on Windows
Windows tools have a .exe suffix which may or may not be found.  Adjust
the tests to accommodate them.
2019-04-02 13:17:07 -07:00
Julian Lettner
da453618b4 Merge pull request #23645 from apple/driver-tsan-linux-linker-flags
[Driver] TSan runtime now has a link-time dependency on libdispatch
2019-04-01 15:20:05 -07:00
Saleem Abdulrasool
0f5362e349 Driver: Win32 support for Driver.batch_mode_parseable_output_cancellation
We now emit memory usage information upon the completion of a job.
Adjust the emission expectations.
2019-04-01 10:15:56 -07:00
Julian Lettner
1cac0bedf1 [Driver] TSan runtime now has a link-time dependency on libdispatch
Previously, the TSan runtime only required libdispatch on Darwin, which
required no explicit linker flags, because libdispatch is always
provided by the system (libSystem).

Now, the TSan runtime also has a link-time dependency on libdispatch on
Linux, where libdispatch (and the blocks runtime) is just another
library. We therefore need to specify them as additonal linker options.
2019-03-28 17:53:49 -07:00
Julian Lettner
34f830116d [Driver][NFC] Define sanitizer mapping <kind, name, file> in one place
Lower maintenance cost for explicit mapping between sanitizer enum and
string values.
2019-03-28 13:56:54 -07:00
Julian Lettner
e24585dc17 [Driver] Delegate linking of sanitizer runtimes to underlying Clang
For Unix tool chains.
2019-03-26 10:56:52 -07:00
Saleem Abdulrasool
b001aa71de test: fix/enable Driver.actions test
This fixes the Driver.actions test on Windows and enables it for Linux
and FreeBSD as well.
2019-03-22 21:21:15 -07:00
David Zarzycki
d2c5597707 [Tests] Stabilize output order maps against incidental changes
The output file map is created in DenseMap order, which is an unordered
and "unstable" collection type.
2019-03-18 07:22:23 -04:00
Jordan Rose
d12e9420da Merge pull request #23040 from jmittert/Use-The-Force-Luke-16
Fix Unicode Tests on Windows
2019-03-11 13:39:50 -07:00
Gwen Mittertreiner
16dc9094d2 Fix Unicode Tests on Windows 2019-03-08 11:31:52 -08:00
Gwen Mittertreiner
8a6d28c7d0 Fix the Rest of the Windows Driver Tests 2019-03-06 14:23:49 -08:00
Jason Mittertreiner
24c10fe8f7 Fix Response Files on Windows (#22985)
This prevents response files on Windows from being overridden after they
are read.
2019-03-01 19:03:46 -08:00
Jason Mittertreiner
b895f0cf17 Have Windows Call Signaled Callback on Crashes (#23018)
The signaled callback is treated more as a general crash handler clean
up wise. While it doesn't 100% line up, have Windows call the signaled
callback on exit codes considered to be errors.
2019-03-01 17:49:26 -08:00
Jason Mittertreiner
2680c34a15 Implement SeparateErrors on Windows
To display stack traces from child processes, the driver combines stdout
and stderror together on Unix. This makes the Basic implementation also
do that.
2019-02-27 14:39:50 -08:00
Jordan Rose
86a9cc3393 [test] Fix loaded_module_trace.swift for arch's that sort before "M" (#22907)
This field is reverse-path-sorted, so the order depends on what
architecture we're compiling for. That's not what's being tested,
so just use a CHECK-DAG.

rdar://problem/48377454
2019-02-26 08:40:04 -08:00
Jason Mittertreiner
ac0d9ef31a Fixed Driver Dependency Tests on Windows
All Driver/Dependency Tests now pass on Windows!
2019-02-21 11:19:57 -08:00
Jason Mittertreiner
9eeabc9875 Allow Arguments in -driver-use-frontend-path (#22596)
Windows doesn't know what a shebang is, so it's unable to run tests that
use -driver-use-frontend-path with a script. This allows the script
interpreter to be run as the executable with the script as its first
argument. e.g. --driver-use-frontend-path "python;my-script.py"
2019-02-20 11:20:21 -08:00
Jordan Rose
43feb9cbe1 On Apple platforms, use swiftmodule directories for the stdlib (#21797)
This changes the Swift resource directory from looking like

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          x86_64/
            Swift.swiftmodule
            Swift.swiftdoc
            Darwin.swiftmodule
            Darwin.swiftdoc

to

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          Swift.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc
          Darwin.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc

matching the layout we use for multi-architecture swiftmodules
everywhere else (particularly frameworks).

There's no change in this commit to how Linux swiftmodules are
packaged. There's been past interest in going the /opposite/ direction
for Linux, since there's not standard support for fat
(multi-architecture) .so libraries. Moving the .so search path /down/
to an architecture-specific directory on Linux would allow the same
resource directory to be used for both host-compiling and
cross-compiling.

rdar://problem/43545560
2019-02-19 14:47:21 -08:00
Doug Gregor
0181ea586d Merge pull request #22118 from DougGregor/remote-ast-private-types
[RemoteAST] Improve resolution of private types from metadata
2019-01-25 15:21:00 -08:00
Devin Coughlin
a5cabe0ea9 [Tests] Fix LIT prefixes for Driver/linker-clang_rt and update test
The Driver/linker-clang_rt test had some of its run lines with incorrect prefixes.
(For example, the prefix for the iOS tests was 'IOS' rather than 'CHECK-IOS'). The
effect is that the CHECK lines in the test weren't actually used and so little was
being tested.

The commits updates the --prefix arguments so that the CHECK lines are active.
This also updates the test to specify the current behavior: namely that the
compiler-rt path is in "/lib/swift/clang/lib/darwin/" rather than "/lib/clang/darwin/".

I've also updated one of the tvOS lines to use the "tvos" in the target rather than
"ios". I suspect that was typo that wasn't caught the test wasn't running.
2019-01-23 22:25:56 -08:00
Doug Gregor
580c992aa1 [Driver] -g implies -enable-anonymous-context-mangled-names.
Including the mangled names in anonymous context metadata can bloat
code size, and is not needed for normal runtime resolution. However,
it aids debugging, so have -g implies the emission of this extra
metadata, which is always optional.
2019-01-22 10:22:23 -08:00
sarveshtamba
56318f3e1f Changes for #SR-9413:Swift 5.0 test failures on PowerPC 2018-12-24 11:37:38 +00:00
Jordan Rose
a090761d3f [test] Tweak Driver/subcommands.swift not to actually run anything
Whoever touched this test last didn't know the rule for arguments
passed to the interpreter: if they're after the file to interpret,
they're treated as arguments to the script rather than the compiler.
2018-12-11 11:31:09 -08:00
Jason Mittertreiner
4e0b092fbe Fixing Driver tests on Windows (#20209) 2018-12-10 18:27:37 -08:00
Jordan Rose
00ed3e1185 [Driver] Don't suggest using the "major version" for -swift-version (#20563)
This was a nice feature when people said "-swift-version 3.1"...
up until we got "-swift-version 4.2" as an actual valid version.
Just drop the special case.

https://bugs.swift.org/browse/SR-8850
2018-12-10 08:41:21 -08:00
Saleem Abdulrasool
bfaa42f109 test: invoke touch.py with the interpreter
Ensure that we use the interpreter explicitly when running the touch.py
script.  This is important for platforms that do not support shebangs
for interpreter execution.
2018-12-05 13:09:22 -08:00
Saleem Abdulrasool
b5eb132ba5 test: use %empty-directory more aggressively
The copy would fail on Windows even with the GNUWin32 tools.  Use
%empty-directory to clean up and create the structure for the test.
NFC.
2018-12-05 10:08:55 -08:00
Daniel Rodríguez Troitiño
8dd8fc0cfa Add -Xclang-linker option to the compiler. (#20441)
In the Darwin toolchain the linker is invoked directly, and compiler_rt
is used if it is found, but in Unix platforms, clang++ is invoked
instead, and the clang driver will invoke the linker. Howerver there was
no way of modifying this clang++ invocation, so there's no way of
providing `--rtlib=` and change the platform default (which is normally
libgcc). The only workaround is doing the work that the Swift driver is
doing "manually".

The change adds a new option (with help hidden, but we can change that)
to allow providing extra arguments to the clang++ invocation. The change
is done in the two places in the Unix and Windows toolchains that I
found the clang driver was being used.

Includes some simple tests.
2018-11-28 10:48:20 -08:00
Ted Kremenek
cf2dce9166 Merge branch 'master' of https://github.com/apple/swift into swift5-verison
# Conflicts:
#	test/api-digester/Outputs/stability-stdlib-source.swift.expected
2018-11-14 17:31:55 -08:00
Vinicius Vendramini
64c3bd753c Fix an incorrect regex that matched more than it should
For example, the first regex matched the following text incorrectly (the `-filelist` argument matched until the first open double-quote in `"BUILD_DIR/\$(CONFIGURATION)...`).

````
BUILD_DIR/Debug/bin/swift -frontend -c -filelist /var/folders/.../sources-098836 -primary-filelist /var/folders/.../primaryInputs-b8aa5a -supplementary-output-file-map /var/folders/.../supplementaryOutputs-b1a037 -target x86_64-apple-macosx10.9 -enable-objc-interop -module-cache-path "BUILD_DIR/\$(CONFIGURATION)\$(EFFECTIVE_PLATFORM_NAME)/swift-test-results/x86_64-apple-macosx10.9/clang-module-cache" -swift-version 4 -module-name main -output-filelist /var/folders/.../outputs-c97286
````

Also removes unused variables.
2018-11-14 13:38:01 -02:00
Vinicius Vendramini
39d3963131 Fix broken tests
- Many tests got broken because of two things:
  - AST dump now outputs to stdout, but many tests expected stderr. This was a straightforward fix.
  - Many tests call swift with specific parameters; specifically, many call `swift frontend` directly. This makes them go through the compiler in unexpected ways, and specifically it makes them not have primary files, which breaks the new AST dump implementation. This commit adds the old implementation as a fallback for those cases, except it dumps to `stdout` to maintain some consistence.

Finally, the `/test/Driver/filelists.swift` failed for unknown reasons. It seems its output now had some lines out of order, and fixing the order made the test pass. However, as the reasons why it failed are unknown, this fix might not have been a good idea. Corrections are welcome.
2018-11-14 13:38:01 -02:00
Vinicius Vendramini
2778a97f37 Add a test for -o in the driver 2018-11-14 13:38:01 -02:00
Vinicius Vendramini
e6b5acdda4 Add tests for frontend and driver. 2018-11-14 13:38:01 -02:00
Ted Kremenek
62799c013d Merge branch 'master' into swift5-version
# Conflicts:
#	test/api-digester/Outputs/stability-stdlib-source.swift.expected
2018-11-13 13:55:51 -08:00
Rahul Malik
d3cc043e58 Add Undefined Behavior sanitizer to Swift Driver (#18553)
This change allows the swift driver to link the ubsan runtime if
`-sanitize=undefined` is specified.
This is useful for sanitizing linked Objective-C code.
2018-11-13 12:11:56 -08:00
Jason Mittertreiner
d8e4a8fb5e Fix 2 Driver tests on Windows (#20172)
Most of the driver tests currently don't work on Windows, but these two were relatively fixable.
- Moved the dsym checks to actions-dsym and ignore that on windows
- alternatively match the full path of dsymutil, which on Windows is
  given as "C:\....\dsymutil.exe" verify-debug-info ...
2018-11-12 15:53:36 -08:00
Ted Kremenek
46510a5eba Bump compiler version to Swift 5.
Main pieces:

- Bump swift-version to 5
- Remove -swift-version 3 support
2018-11-06 14:38:55 -08:00
Jordan Rose
0967f72738 [test] Test -index-store-path invocation with a bridging PCH (#20331) 2018-11-05 15:37:50 -08:00
Jordan Rose
45cbaeabd3 [test] Fix two more Driver tests to not dump files in $PWD (#20253)
Which is build/test-*/Driver/, not anywhere important, but still.
2018-11-05 11:35:09 -08:00
Harlan Haskins
6229ceaaab Move argument verification test away from driver test 2018-10-31 16:33:35 -07:00
Harlan Haskins
3ce15d12ad Add test to make sure interfaces get arguments with filelists 2018-10-31 10:16:45 -07:00