Commit Graph

71 Commits

Author SHA1 Message Date
Robert Widmann
d815e2724a [NFC] Add Compilation::Result
In order to extract the module dependency graph from the compilation the driver just ran, define a separate semantic type to hold a result code and the graph itself.
2020-12-09 19:25:56 -08:00
Xi Ge
84afba5cf0 driver: forward driver invocation to the new driver by default
rdar://71817843
2020-12-01 15:20:22 -08:00
Xi Ge
5b4cc58f8a driver: add an option to avoid forwarding to the new driver 2020-11-07 18:24:33 -08:00
Xi Ge
f8577b2aa8 driver: allow SWIFT_USE_NEW_DRIVER to specify a driver executable name 2020-11-07 10:26:50 -08:00
Xi Ge
11b2251ac1 Driver: forwarding driver invocations to the new driver when SWIFT_USE_NEW_DRIVER is defined
This allows us to experiment with the new swift-driver without changing build systems.
2020-10-02 14:02:13 -07:00
David Ungar
6f9df09766 Merge pull request #33701 from davidungar/handle-bad-j
Don't crash on a bad -j input
2020-08-29 22:26:55 -07:00
David Ungar
fcf398a17b Don't crash on a bad -j input 2020-08-29 19:36:04 -07:00
Brent Royal-Gordon
d48e397b86 Support --driver-mode with swift-frontend
This makes development in Xcode somewhat simpler.
2020-08-07 16:00:15 -07:00
Doug Gregor
6c0d957ffe [Driver] Execute the frontend when invoked via swift-frontend.
This obviates the need for "-frontend", although we still accept it
for backward compatibility. Switch lit's %target-swift-frontend et al
over to calling swift-frontend.
2020-06-23 13:00:26 -07:00
Brian Gesiak
9208154c16 Document what a "subcommand" is
There are a few references to "subcommands" in the repository, but no
explanation of what they are. Beef up the docblock for
`shouldRunAsSubcommand()` to make things a little clearer.
Specifically, I'd like to make the difference between driver jobs and
driver subcomnmands clearer.

In addition, remove a double negative comment, "If we are not run as
'swift', don't do anything special", and replace it with something a
little clearer (in my opinion).
2020-04-09 16:42:15 -07:00
Ashley Garland
7a3a0a9e23 Symbol graph support
Adds a tool `swift-symbolgraph-extract` that reads an existing Swift
module and prints a platform- and language-agnostic JSON description of
the module, primarly for documentation.

Adds a small sub-library `SymbolGraphGen` which houses the core
implementation for collecting relevant information about declarations.
The main entry point is integrated directly into the driver as a mode:
the tool is meant to be run outside of the normal edit-compile-run/test
workflow to avoid impacting build times.

Along with common options for other tools, unique options include
`pretty-print` for debugging, and a `minimum-access-level` options for
including internal documentation.

A symbol graph is a directed graph where the nodes are symbols in a
module and the edges are relationships between them. For example, a
`struct S` may have a member `var x`. The graph would have two nodes for
`S` and `x`, and one "member-of" relationship edge. Other relationship
kinds include "inherits-from" or "conforms to". The data format for a
symbol graph is still under development and may change without notice
until a specificiation and versioning scheme is published.

Various aspects about a symbol are recorded in the nodes, such as
availability, documentation comments, or data needed for printing the
shapes of declarations without having to understand specifics about the
langauge.

Implicit and public-underscored stdlib declarations are not included by
default.

rdar://problem/55346798
2020-01-10 09:53:37 -08:00
Argyrios Kyrtzidis
0135e01d02 Rename the swift-format utility to swift-indent
This is to distinguish the C++ indenting functionality from the new formatter that is written in Swift.
2019-07-26 11:40:54 -07:00
Jordan Rose
f4487881e4 Add PrettyStackTraceSwiftVersion, and use it in the swiftc executable (#24235)
As pointed out on a recent JIRA, crash traces don't mention what
version of Swift you were running. Usually that can be gleaned from
the path, but not always.
2019-04-24 15:53:56 -07: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
Jordan Rose
a23eaf4a02 Remove API notes compilation support from swiftc (#21759)
We don't use this feature anymore (see 0149129ed), and now that we've
branched Swift 5.0 for the last time it's time to rip it out of swiftc
(and then from Clang).

No functionality change, unless someone was compiling their own API
notes. If you were doing that, just copy them into place as text.
2019-01-16 10:39:39 -08:00
Bob Wilson
ca10ed04a6 [master-next] Remove unnecessary argument array copy from PR 17494 2018-07-03 17:26:14 -07:00
Bob Wilson
397ace0ac6 [master-next] NFC: Rename variable from PR #17494
Jordan reviewed my change and suggested using a better variable name
to avoid potential confusion between "args" and "argv".
2018-06-25 23:43:13 -07:00
Bob Wilson
ad9098fca0 [master-next] Fix up the driver's use of PROGRAM_START after PR #16362
On the master-next branch, the InitLLVM class used by the PROGRAM_START
macro can modify the argc/argv values (currently only on Windows).
Expanding response files before initializing the stack trace also modifies
the arguments so use a separate SmallVector for each copy of the argument
vector.
2018-06-25 17:01:01 -07:00
Bob Wilson
44712233c3 Merge remote-tracking branch 'origin/master' into master-next 2018-06-21 23:36:03 -07:00
Jordan Rose
7d8e40b0bb Merge pull request #16362 from dabelknap/frontend_responsefile
Wrap Command Line Arguments in a Response File if System Limits are Exceeded

https://bugs.swift.org/browse/SR-4517
2018-06-21 16:31:20 -07:00
Austin Belknap
be229fc173 Use subCommandArgs instead of argv within subcommand if block. 2018-06-20 15:24:37 -07:00
Austin Belknap
8e6abee651 Pass ArrayRefs by value. 2018-06-12 18:00:30 -07:00
Austin Belknap
6592b428f8 Style fixes. 2018-06-01 14:18:26 -07:00
Austin Belknap
3b38fa68a1 Preserve argv for the stack trace, and only create a copy if necessary. 2018-06-01 14:01:11 -07:00
swift-ci
6bcc013437 Merge remote-tracking branch 'origin/master' into master-next 2018-05-30 00:49:45 -07:00
Robert Widmann
d7493dd0fa [NFC] Expose the TaskQueue as a Compilation Parameter
Shuffle the responsibility for creating the TaskQueue out of the
Compilation's internal job state object and into the driver.  Expose
a builder convenience function that handles the argument parsing.
2018-05-29 21:58:27 -07:00
Austin Belknap
3fe62b94e7 Reformat verbose and stack trace printouts for response-files. 2018-05-23 11:05:20 -07:00
Saleem Abdulrasool
6b18cfe53f master-next: update for SVN r330216
sys::Process::GetArgumentVector has been removed.  It is unclear if it
was ever needed in the first place.  Simplify the code to avoid the use.
2018-04-23 11:24:02 -07:00
Austin Belknap
0e5f88c5ad Elaborate on the purpose of response files. 2018-04-18 09:54:59 -07:00
Austin Belknap
a7fe02e0c5 Add ability to expand response files from the command line. 2018-04-10 12:41:25 -07:00
Sho Ikeda
cea6c03eb2 [gardening] Use !empty() over size() > 0 2018-03-08 09:21:09 +09:00
Jordan Rose
3cd9f166bc Don't spend time initializing LLVM when running the driver (#14896)
Tiny start-up time optimization noticed while looking at how we do
PrettyStackTraceProgram. Also add PrettyStackTraceProgram to a few
more of our testing tools, via the new PROGRAM_START macro.
2018-02-28 19:56:19 -08:00
Graydon Hoare
d139ab2968 [BatchMode] Expand lifetime of ToolChain, pass reference to it to Compilation. 2018-01-24 10:31:19 -08:00
swift-ci
75dc7c1b73 Merge pull request #13011 from modocache/driver-typo 2017-11-18 14:00:29 -08:00
Brian Gesiak
70ad32c598 [Driver] Fix typo: half sentence and period 2017-11-18 12:25:34 -05:00
Ankit Aggarwal
d84e4b4de1 [Driver] Remove built-in run subcommand
This is as per discussion in https://bugs.swift.org/browse/SR-5332
2017-07-10 10:35:00 +05:30
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +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
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
John McCall
23f961bc0a Give the FrontendTool library its own header and allow users
to observe progress through the frontend.
2016-04-21 14:59:39 -07:00
John McCall
95eeabb025 Move the -frontend logic into its own library to allow re-use
and abstraction (to come).
2016-04-20 22:54:00 -07:00
Doug Gregor
da60535ced [Driver / API Notes] Re-introduce "-apinotes" driver flag to compile API notes.
Using Clang to compile API notes introduces a dependency on the
underlying Clang, which can cause problems as Clang's support for API
notes evolves. Re-introduce the "-apinotes" driver flag into the Swift
driver to allow us to compile API notes, and use that (rather than
Clang) to precompile API notes for the overlays.
2016-03-04 14:12:15 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Daniel Dunbar
a0f5bdfa50 [PATCH] [Driver] Add support for using 'swift' to exec subcommands.
- This allows 'swift <FOO>' to be used to invoke swift-<FOO>, so that we can
   use 'swift' as a namespace for additional commands (like ones used for the
   package manager.

 - This patch just adds the basic subcommand functionality, but doesn't rework
   either 'swift-autolink-extract' or 'swift -frontend' to follow this code path.

 - <rdar://problem/22844530> Provide 'swift' support for subcommands



Swift SVN r32367
2015-10-01 07:16:12 +00:00
Michael Gottesman
e864f02690 In all executables make sure to completely initialize LLVM.
I also added a macro called INITIALIZE_LLVM(argc, argv) which moves this logic
into one place and should be used at the beginning of *all* binaries. It
initializes an LLVM shutdown object, sets up the pretty stack trace, and then
initializes all of the parts of LLVM. This will make it easy to update this in
the future.

The reason why a macro was required was because of llvm_shutdown_obj, an RAII
object that cleans up LLVM. It has to be at the function level scope of the main
function.

Swift SVN r31815
2015-09-09 04:37:38 +00:00
Adrian Prantl
0de0d43773 Introduce a -modulewrap driver action that wraps a (merged) .swiftmodule
inside a swift ast section in an object file so it can be passed to the
linker. The driver automatically wraps merged swiftmodules iff the target
is ELF.

rdar://problem/22407666

Swift SVN r31641
2015-09-02 21:56:25 +00:00
Argyrios Kyrtzidis
8b250d6d35 [driver] Remove the 'swift-fixit' symlink and introduce '-emit-fixits-path' frontend option that
writes compiler fixits as source edits.

Driver option '-fixit-code' adds '-emit-fixits-path' for all the frontend invocations.

Swift SVN r27208
2015-04-10 17:33:29 +00:00
Argyrios Kyrtzidis
623b9827b4 [driver] Separate "delegate to the migrator with swift-update" and "get compiler fixits with swift-fixit" functionalities.
Swift SVN r27139
2015-04-08 22:02:23 +00:00
Arnold Schwaighofer
f79e6abd2e Missing header includes ...
Swift SVN r26454
2015-03-23 22:05:47 +00:00