Added DiagnosticsDriver.def and DiagnosticsDriver.h for driver-only diagnostics.
(Diagnostics which are shared with the frontend remain in
DiagnosticsFrontend.{def,h}.)
Added a DiagnosticEngine& to Compilation, so that it can emit diagnostics for
events which occur while performing Jobs.
Replaced all of the locations where we were manually printing error messages to
emitting real diagnostics, adding diagnostics if necessary.
Updated Driver::buildCompilation() so that it fails early if any errors were
encountered.
Updated test/Driver/actions.swift to pass a -module-name for multi-input tests.
Swift SVN r13175
This will occur if -emit-{library,executable} and -emit-module is passed but -g
is not, since both the LinkJobAction and the MergeModuleJobAction will be
top-level actions.
Swift SVN r13139
Since the driver may create only some of the diagnostics files it was asked to
create, start by removing all diagnostics files so clients can detect the
presence of one to determine if the command which creates it actually ran.
This is important so that clients do not mix old and new diagnostics files,
which may occur in the event of a compilation error.
Swift SVN r13074
This emits a dynamic library as the final build product (rather than an
executable), as well as implicitly passing -parse-as-library to the frontend.
Swift SVN r12930
...when no -module-name or -o is provided.
This makes the single-file compile /very/ easy: compiling "foo.swift"
produces an output named "foo", rather than "a.out". For multi-file
modes, the module name is used if -o is missing; if no module name is
provided, it defaults to "main".
In a nutshell:
explicit -o > explicit -module-name > single file's stem name > "main"
<rdar://problem/12593849>
Swift SVN r12841
Centralized the driver-level handling of the SDK path in OutputInfo and
Driver::buildOutputInfo(), and added support for falling back to getenv(SDKROOT)
if -sdk wasn't passed (and SDKROOT is set in the environment).
Updated Swift::constructJob() to get the SDK path from the OutputInfo instead of
just passing -sdk from the original driver invocation.
Also added a driver-level check to ensure that the specified SDK is present;
if not, print out a warning. This fixes <rdar://problem/14409974>.
Added test/Driver/sdk.swift to test the -sdk and SDKROOT behavior, as well as
the nonexistent SDK warning.
Swift SVN r12815
In Driver::buildJobsForAction(), consult the OutputFileMap if we're building a
Job for a CompileJobAction and we're not in SingleCompile mode.
Swift SVN r12774
Added an -output-file-map option which will specify the path to an
OutputFileMap.
Added Driver::buildOutputFileMap(), which constructs an OutputFileMap
from the arguments.
Added OutputFileMap* parameters to Driver::buildJobs() and
Driver::buildJobsForAction(). (These parameters are not yet honored, except to
pass to calls of these functions.)
Swift SVN r12772
Since a CommandOutput may have multiple outputs, print any additional outputs
after printing the primary output, using the following format:
... output: {<type>: "<primary output>", <type>: "<additional output>", ...}
Swift SVN r12690
The new format is "-<option>" and "-<option>-path". As a result:
- Renamed -serialized-diagnostics-path to -serialize-diagnostics-path.
- Renamed -module-output-path to -emit-module-path.
Swift SVN r12614
Added a SerializedDiagnostics entry to Types.def.
In Driver::buildJobsForAction(), set an appropriate path for serialized
diagnostics, if requested. In Swift::constructJob(), check for an additional
SerializedDiagnostics output to determine if -serialize-diagnostics and
-serialized-diagnostics-path should be passed.
This is necessary infrastructure for the output file map.
Swift SVN r12613
This sets OutputInfo::CompilerMode to a new SingleCompile mode, which in turn
causes the driver to create a single CompileJobAction for all inputs. This mode
also prevents the creation of a MergeModuleJobAction, since we can rely on the
frontend to generate a full swiftmodule.
This mode will allow the driver to properly compile the stdlib; if this mode is
necessary for other inputs, we can rename and publicize this option.
Swift SVN r12612
Introduced OutputInfo::Mode and OutputInfo::CompilerMode, which dictate how the
driver should invoke the integrated frontend. Currently, there are three
options:
- StandardCompile: invoke the frontend once-per-input, using -primary-file
- REPL: invoke the frontend as the REPL
- Immediate: invoke the frontend in immediate mode
Updated buildOutputInfo() to properly set the CompilerMode, and updated
buildActions() and Swift::constructJob() to honor the CompilerMode.
With these changes, "swift_driver" (with no inputs) and "swift_driver -repl"
should invoke the REPL, and "swift_driver -i" should invoke the frontend in
immediate mode.
Swift SVN r12547
This will indicate that the generated module was user-requested, so it should be
placed alongside other outputs.
Updated buildOutputInfo() in a few ways:
- Updated it to set ShouldTreatModuleAsTopLevelOutput correctly.
- Updated it such that -g implies that a module should be generated, but treated as an intermediate.
- Moved the fallback ModuleName handling into buildOutputInfo(), which requires passing an InputList.
Swift SVN r12502
First, prefer -module-output-path over any other options when binding the output
for a merge module Command. If that’s not set, use the same behavior as other
intermediate outputs, but use the module name as the base name (instead of the
BaseInput, which is not descriptive enough for a swiftmodule).
This does not yet handle the case where the emitted module should be treated as
a top-level output, even though it’s not the top-level job (essentially,
whenever -emit-module is passed but the driver isn't in EmitModuleOnly mode).
Swift SVN r12500
Adjusted Driver::buildJobs() and Driver::buildJobsForAction() to include a const OutputMode& parameter.
Updated Driver::buildJobsForAction() to set an additional swiftmodule output on Jobs generated from a CompileJobAction if the OutputMode says the driver should generate a module.
This change now causes frontend invocations to pass “-emit-module -module-output-path <path>” when a module is requested, though the partial modules are not yet properly merged.
Swift SVN r12495
Instead of having buildActions() call the private Driver::getOutputMode() function, establish an OutputMode using a new Driver::buildOutputMode() function.
This change will allow the OutputMode to be more easily shared across functions without needing to generate it each time (though, at the moment, only buildActions() uses the OutputMode).
Swift SVN r12494
Updated Driver::OutputMode to also contain a ShouldGenerateModule field.
Updated Driver::getOutputMode() to set OutputMode::ShouldGenerateModule appropriately.
Updated Driver::buildActions() to insert a MergeModuleJobAction into the Action graph if the Driver’s OutputMode indicates that a module should be generated.
Swift SVN r12492
This will allow the driver to specify the location for, among other things, the partial swiftmodule generated by a single frontend invocation.
Swift SVN r12449
Since a Job may be reached through multiple paths in the dependency graph, we
need to include support for caching Jobs. (Currently, the cache maps
Action/ToolChain pairs to Jobs.)
As a result of these changes, Tool::constructJob() and
Driver::buildJobsForAction() return a plain Job *, instead of a
std::unique_ptr<Job>, since the Jobs returned by buildJobsForAction() no longer
need to be unique.
Swift SVN r12443
This instructs the driver to skip task execution by using a DummyTaskQueue in Compilation::performJobsInList().
This option should generally only be used for testing, as DummyTaskQueue may provide fake buffered output.
Swift SVN r12350
Added driver-level support for generating commands with -emit-ir and -emit-bc as well integrated frontend support for handling -emit-ir and -emit-bc.
Swift SVN r11375
The driver does not yet support parallel execution, but this sets the Compilation up with the necessary information to execute commands in parallel.
Swift SVN r11333
In Driver::translateInputArgs(), don’t break apart the OPT__DASH_DASH argument if we’re in immediate mode.
Mark OPT__DASH_DASH as being a FrontendOption.
In Swift::constructJob(), add support for types::TY_Nothing, and pass the argument for OPT__DASH_DASH as-is if the driver is invoking the frontend in immediate mode.
Swift SVN r11325
- Added support for invoking the Swift frontend via "swift_driver -frontend".
- Added frontend_main.cpp, which implements the main entry point for the
integrated frontend. (Currently, this supports compiling an input Swift file
into an object file.)
- Removed lib/Frontend/FrontendOptions.td, and replaced its functionality with
options in include/Swift/Driver/Options.td and a new
include/Swift/Driver/FrontendOptions.td. Options supported by the frontend
are denoted by the FrontendOption flag; options which are not supported by
the driver are denoted by the NoDriverOption flag.
- Updated CompilerInvocation::parseArgs() to use the option table returned from
createDriverOptTable(), including renaming a handful of options. (-triple is
now -target, and -Xclang is now -Xcc.)
Swift SVN r11082
SIL emitted by -emit-silgen is treated internally as “raw-sil”, while SIL emitted by -emit-silgen is treated internally as “sil".
Externally, there are no changes; both kinds of SIL still have a “.sil” file extension.
Updated test/Driver/Actions.swift to account for the change in behavior with -emit-silgen.
Swift SVN r10947
This produces output similar to "clang -ccc-print-bindings".
Also added several tests to ensure that "swift_driver -driver-print-bindings"
behaves as expected.
Swift SVN r10935
- Added a couple of new targets:
- libswiftDriver, which contains most of the driver implementation
- swift_driver, which produces the actual executable
- Added centralized version information into libswiftBasic.
- Added a new "Driver Design & Internals" document, which currently describes
the high-level design of the Swift driver.
- Implemented an early version of the functionality of the driver, including
versions of the Parse, Pipeline, Bind, Translate, and Execute driver stages.
Parse, Pipeline, and Bind are largely implemented; Translate and Execute are
early placeholders. (Translate produces "swift_driver --version" and "ld -v"
commands, while Execute performs all subtasks sequentially, rather than in
parallel.)
This is just the starting point for the Swift driver. Tests for the existing
behavior are forthcoming.
Swift SVN r10933