695 Commits

Author SHA1 Message Date
Sho Ikeda
1508b6f131 [gardening][Driver] Replace typedef with using 2018-03-23 19:14:50 +09:00
David Ungar
807dd5864e Renamed swift::types to swift::file_types. 2018-03-22 08:40:06 -07:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
David Ungar
90d2740817 Merge pull request #14961 from davidungar/PR-18-10-HHH
[Batch mode] Restore -### functionality for batch-mode by extending OutputLevel.
2018-03-06 09:54:03 -08:00
Jordan Rose
be4c2b97fc Merge pull request #14950 from Nonchalant/sr_7040_redundant_D
[SR-7040] Redundant prefix of compilation flag specific error
2018-03-06 08:56:27 -08:00
David Ungar
17a81f6981 Restore -### functionality for batch-mode by extending OutputLevel. 2018-03-05 11:07:20 -08:00
Nonchalant
3fca891628 active conditional compilations: show friendly error message 2018-03-03 13:02:16 +09:00
George Karpenkov
a65da887f2 Determine whether a given sanitizer is available based on the presenc… (#14919)
Determine whether a given sanitizer is available based on the presence of the library.

rdar://37192887
2018-03-02 16:57:45 -08:00
Graydon Hoare
45c78c4f7d [BatchMode] Add a pile of asserts to CommandOutput. 2018-02-28 14:07:25 -08:00
Ben Langmuir
d991452367 Merge pull request #14746 from benlangmuir/working-directory
[driver] Add -working-directory option
2018-02-21 14:56:56 -08:00
Ben Langmuir
20cb3e3eb2 [driver] Add -working-directory option
Adds a -working-directory option which can be used to modify how
relative paths are resolved. It affects all other paths used in driver
options (controlled by a new ArgumentIsPath flag on options) as well as
the contents of output file maps and auxilliary file paths generated
implicitly by the compiler itself.

rdar://37713856
2018-02-21 09:42:05 -08:00
Graydon Hoare
263c4c54d5 [BatchMode] Preserve intra-batch order, add a seed mode. 2018-02-20 18:31:41 -08:00
Graydon Hoare
3d9ce0afb9 [BatchMode] Store -{enable,disable}-batch-mode as a flag in Compilation. 2018-02-15 15:38:09 -08:00
Graydon Hoare
a2c718777d [BatchMode] Pass OutputInfo to Compilation on construction. 2018-02-15 15:38:08 -08:00
Graydon Hoare
f9d7bd2584 [BatchMode] Add PrettyStackTrace helpers to Driver. 2018-02-09 14:10:46 -08:00
Graydon Hoare
ef61f721d4 [BatchMode] Change all CommandOutputs to use a shared OutputFileMap. 2018-02-09 14:08:50 -08:00
Graydon Hoare
dd75636377 [BatchMode] Add -driver-print-derived-output-file-map 2018-02-09 14:06:23 -08:00
Saleem Abdulrasool
b49d69f4b3 Driver: avoid unnecessary break after return in switch
Adjust the style to avoid the unnecessary break after the return in the
switch cases.  NFC.
2018-02-07 15:11:16 -08:00
Graydon Hoare
d139ab2968 [BatchMode] Expand lifetime of ToolChain, pass reference to it to Compilation. 2018-01-24 10:31:19 -08:00
Graydon Hoare
18023832e9 [BatchMode] Fix mis-chosen name in previous PR, NFC. 2018-01-24 10:31:19 -08:00
Graydon Hoare
c4e58af039 [BatchMode] Add BatchModeCompile, multi-input form of StandardCompile. 2018-01-24 10:31:19 -08:00
Graydon Hoare
e738d01940 [BatchMode] Split some code out of getOutputFilename in Driver.cpp, NFC. 2018-01-19 12:38:31 -08:00
Graydon Hoare
ba4335b17d [BatchMode] Split up Driver::buildJobsForAction, NFC. 2018-01-19 12:36:03 -08:00
Brian Gesiak
97f7f276e9 Merge pull request #12708 from modocache/sr-2660-swiftmodule-inputs-with-g
[SR-2660][Driver] Pass .swiftmodule to linker
2017-11-13 22:26:21 -05:00
Brian Gesiak
fe56692063 [SR-2660][Driver] Pass .swiftmodule to linker
Summary:
The following two invocations of `swiftc` behave differently, despite
their only difference being the `-g` option:

```
swiftc foo.swift bar.o baz.swiftmodule -o foo
swiftc -g foo.swift bar.o baz.swiftmodule -o foo
```

The first invocation compiles `foo.swift`, links it with `bar.o`, and
passes the AST information from `baz.swiftmodule` to the linker. The
second invocation results in the following error:

```
<unknown>:0: error: cannot load module 'baz' as 'foo'
```

The source of the problem is that the driver determines whether to
generate a module based on the debug info level that has been
requested, and merges all .swiftmodule inputs if a module is being
generated.

Modify this behavior to instead pass .swiftmodule inputs directly to the
linker if our output is to be linked. This results in both the `swiftc` and
the `swiftc -g` invocations above succeeding.

Test Plan:
1. `utils/build-script --test` passes.
2. After cloning https://github.com/modocache/SR-2660 and modifying its
   `build-driver.sh` to point at the local Swift source build
   directory, running `build-driver.sh` succeeds, and lldb is able to
   print descriptions with accurate debug info.
2017-11-13 13:52:46 -05:00
swift-ci
b382fa1f76 Merge pull request #12443 from modocache/driver-inferred-dylib-name-fixme 2017-11-01 16:10:49 -07:00
Adam Nemet
66085a8aef Save optimization remarks in an external YAML file
This brings the capability from clang to save remarks in an external YAML files.
YAML files can be viewed with tools like the opt-viewer.

Saving the remarks is activated with the new option -save-optimization-record.

Similarly to -emit-tbd, I've only added support for single-compile mode for now.
In this case the default filename is determined by
getOutputFilenameFromPathArgOrAsTopLevel, i.e. unless explicitly specified
with -save-optimization-record-path, the file is placed in the directory of the
main output file as <modulename>.opt.yaml.
2017-10-27 10:14:27 -07:00
Brian Gesiak
b81ad22cab [SR-2660][Driver] Handle .swiftmodule inputs
Allow users to pass `.swiftmodule` files into the Swift driver when
compiling without `-g`. The `.swiftmodule` files are then passed to the
linker via `-add_ast_path` so that LLDB can access their AST
information.

This addresses one of two driver changes suggested in the comments of
https://bugs.swift.org/browse/SR-2660.
2017-10-19 15:03:03 -07:00
Brian Gesiak
e2aa7a619c [Driver] Infer target-specific dylib names
When the Swift driver is invoked with the `-emit-library` option, but
without an `-o` option that specifies the emitted library's filename,
logic in the `getOutputFilename()` function derives a filename:
`"lib" + <a plasible base name>"`, and then the value of the
`LTDL_SHLIB_EXT` macro.

There are two problems here:

1. Windows shared library file names, by convention, do not begin with "lib".
2. The `LTDL_SHLIB_EXT` macro is set by
   `llvm/cmake/modules/HandleLLVMOptions.cmake`, based on
   `CMAKE_SHARED_LIBRARY_SUFFIX`, a built-in CMake variable that is set
   at the time LLVM is configured to be built. So, if LLVM and Swift
   were built on a Linux machine, but the `swiftc` executable that was
   built was then invoked to produce a shared library for a Darwin target,
   the library would have a ".so" suffix, not ".dylib". (It's for this
   reason that the tests for this name inference, in
   `test/Driver/linker.swift`, must use a regular expression that
   matches both ".dylib" and ".so", despite specifying a Darwin
   `-target`.)

In order to produce conventionally correct prefixes and suffixes based
on the target, modify the `getOutputFilename()` function to take an
`llvm::Triple` argument.
2017-10-15 00:25:14 -04:00
swift-ci
64f5b45eb1 Merge pull request #12263 from modocache/remove-old-input-type-arg-code-and-fixme 2017-10-05 20:35:48 -07:00
Brian Gesiak
3f8e8084ff [Driver] Remove unused input type code (NFCI)
Summary:
When the Swift driver executable was first added in
ed2038585f,
the code included a FIXME to support input types, like Clang's
`-x <language>` option. Perhaps as a first step in implementing this
functionality, it also included dead code that manipulated an input type
argument, even though the variable for storing the argument was never
written to.

Remove the unused input type code, and the FIXME. The FIXME is now
tracked with a Swift bug URL, so that a discussion on next steps can be had:
https://bugs.swift.org/browse/SR-6054

Test plan: `utils/build-script --release --test`
2017-10-04 13:53:14 -04:00
Brian Gesiak
6652e8f699 [Driver] Remove obsolete "APPLE-ONLY" comments
A post-commit reviewer on https://github.com/apple/swift/pull/10716
asked that the comments be removed. Remove them, as they're no longer
demarcating code that is internal to Apple.
2017-10-04 00:34:56 -04:00
Vedant Kumar
1621facc6c [SwiftPGO] Add driver support for -profile-use=<path>
This option tells the compiler where to find a profdata file. The
information in this file enables PGO. For more information about the PGO
infrastructure, look for the -profile-generate option and for the
llvm-profdata tool [1].

[1] http://llvm.org/docs/CommandGuide/llvm-profdata.html
2017-09-26 10:52:08 -07:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Huon Wilson
08a2e35b3f Merge pull request #11563 from huonw/emit-module-path-wmo
[Driver] Obey -emit-module-path in -wmo that only does -emit-module.
2017-08-23 14:07:56 -07:00
Huon Wilson
151bbf95a3 [Driver] Obey -emit-module-path in -wmo that only does -emit-module. 2017-08-23 11:18:52 -07:00
Jordan Rose
0a4cf89a33 Merge pull request #11482 from jrose-apple/take-action
[Driver] Clean up ownership of Action objects
2017-08-16 09:40:17 -07:00
Jordan Rose
47872d9190 [Driver] Transfer all ownership of Actions to the Compilation.
Previously, Actions were responsible for freeing their inputs...
except for the ones that weren't. Or the ones that were supposed
to, but then they needed to share an input, so they couldn't anymore.
If this sounds ridiculous, you're right; now Actions are just
immediately allocated and owned by the Compilation.

The graph structure of the actions is still useful for some things; in
particular, "top-level" actions get to put their outputs somewhere
permanent rather than TMPDIR. But I expect these things to get cleaned
up in the future too.
2017-08-11 21:09:34 -07:00
Jordan Rose
64df9b1edc [Driver] Actually free Actions instead of just leaking them.
Fixes rdar://problem/32518867, though in a fairly messy way. Next
commit will clean this up again.
2017-08-11 21:09:34 -07:00
Jordan Rose
4934c57491 [Driver] Remove ActionList typedef, improve const correctness.
No functionality change.
2017-08-11 21:09:34 -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
swift-ci
d549147e43 Merge remote-tracking branch 'origin/master' into master-next 2017-07-31 18:48:50 -07: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
swift-ci
f6a4fb6b5c Merge remote-tracking branch 'origin/master' into master-next 2017-07-21 14:28:51 -07:00
Harlan
37f88e7372 Add frontend flag to serialize Syntax tree (#11095)
* Add frontend flag to serialize Syntax tree

* Rename dump-serialized-syntax-tree to emit-syntax
2017-07-21 14:23:50 -07:00
swift-ci
609f493fcd Merge remote-tracking branch 'origin/master' into master-next 2017-06-30 16:08:53 -07:00
Graydon Hoare
411b13309a Merge pull request #10733 from graydon/rdar-32984579-emit-bc-depends-on-bridging-pch-as-well
[Bridging PCH] Move dependency-on-bridging-PCH to -emit-bc JobAction itself
2017-06-30 16:06:16 -07:00
Graydon Hoare
d4ff4537b9 [Bridging PCH] Move dependency-on-bridging-PCH to -emit-bc JobAction itself. 2017-06-30 15:13:41 -07:00
Arnold Schwaighofer
a72b685927 Merge remote-tracking branch 'origin/master' into master-next 2017-06-30 12:21:33 -07:00