Commit Graph

172 Commits

Author SHA1 Message Date
Jordan Rose
8cf19bf152 Don't set a default SDK in the new driver, either.
Goes with r12414.

Swift SVN r12439
2014-01-17 00:15:15 +00:00
Jordan Rose
11008f0ed1 Split diagnostics out into separate files.
Thanks to the way we've set up our diagnostics engine, there's not actually
a reason for /everything/ to get rebuilt when /one/ diagnostic changes.
I've split them up into five categories for now: Parse, Sema, SIL, IRGen,
and Frontend, plus a set of "Common" diagnostics that are used in multiple
areas of the compiler. We can massage this later.

No functionality change, but should speed up compile times!

Swift SVN r12438
2014-01-17 00:15:12 +00:00
Connor Wakamo
3a1810336e [frontend] Implement support for emitting modules with the integrated frontend.
Added support for the -emit-module and -module-output-path options. -emit-module
and -module-output-path function similarly to -serialize-diagnostics and
-serialized-diagnostics-path: notably, -module-output-path implies -emit-module,
but -emit-module can be passed without -module-output-path and a default path
will be determined based on other inputs.

Added support for the -module-link-name option, which specifies the name of the
library to link against when importing the generated module.

Note that support for these options is only implemented in the integrated
frontend; driver-level support for these options is forthcoming.

Swift SVN r12301
2014-01-14 23:38:36 +00:00
Connor Wakamo
00f076daa5 [frontend] Implemented support for emitting serialized diagnostics.
Reworked the -serialize-diagnostics option, so that it is now just a flag
indicating that the frontend should generate serialized diagnostics. The path at
which the diagnostics will be serialized is now specified by the
-serialized-diagnostics-path option, which is a frontend-only option. (The
frontend treats -serialized-diagnostics-path as implying -serialize-diagnostics.)

If -serialize-diagnostics is passed but -serialized-diagnostics-path is not
passed, the frontend will choose an output path from a few default values:

- If the frontend has a non-stdout output path, replace that path's extension
  with .dia.
- If there is a primary input filename, use that input's base name as the base
  name for the serialized diagnostics file.
- Otherwise, use the module name as the base name for the serialized diagnostics
  file.

Added support for setting up a serialized diagnostics DiagnosticConsumer in
frontend_main() if FrontendOptions::SerializedDiagnosticsPath is non-empty.

Swift SVN r12251
2014-01-13 21:38:03 +00:00
Connor Wakamo
c5af8e0269 [frontend] Implement support for primary file mode for post-PrintAST actions.
This, in concert with the driver-level changes to pass -primary-file, enables proper multi-file output in swift_driver.

Swift SVN r12158
2014-01-10 22:39:08 +00:00
Connor Wakamo
5d9e2461ce [frontend] Updated -dump-parse, -dump-ast, and -print-ast to operate on the primary input, if one is specified.
Other modes to follow.

Swift SVN r12157
2014-01-10 22:39:08 +00:00
Connor Wakamo
28d579fd1d [frontend] Add support for running SIL optimization passes in the integrated frontend if the optimization level is not zero.
Swift SVN r11483
2013-12-19 21:40:05 +00:00
Connor Wakamo
53a0acad66 [frontend] Added temporary support for setting MainInputFilename, Triple, and OutputFilename in IRGenOptions.
MainInputFilename and OutputFilename are pulled from the FrontendOptions, while Triple is parsed directly from the ArgList.
Eventually, MainInputFilename and OutputFilename should likely be removed from IRGenOptions, in favor of the values in FrontendOptions, while Triple will be in a separate TargetOptions class.

Swift SVN r11455
2013-12-18 23:42:53 +00:00
Connor Wakamo
8b808311b3 [frontend] Added support for parsing -O.
Swift SVN r11452
2013-12-18 23:42:52 +00:00
Connor Wakamo
39bb2bf2a2 [frontend] Added proper support for parsing -l and -framework.
Moved the responsibility for storing LinkLibraries from CompilerInvocation to the invocation’s IRGenOpts.
Moved the handling of -l and -framework into ParseIRGenArgs.

Swift SVN r11450
2013-12-18 23:42:51 +00:00
Connor Wakamo
9f113b59ca [frontend] In frontend_main(), switch from using a local IRGenOptions to using the CompilerInvocation's.
Swift SVN r11448
2013-12-18 23:42:50 +00:00
Connor Wakamo
59f18f9fc0 Renamed irgen::Options and irgen::OutputKind to IRGenOptions and IRGenOutputKind, and move both out of the irgen namespace now that they're in swiftAST.
Swift SVN r11405
2013-12-18 01:17:09 +00:00
Connor Wakamo
3e81830385 Move "include/swift/IRGen/Options.h" to "include/swift/AST/IRGenOptions.h".
This commit only moves the header file; updating the class so that it is no longer in the irgen namespace will be handled separately.

Swift SVN r11404
2013-12-18 01:17:09 +00:00
Connor Wakamo
b0092c4717 [frontend] Initial support for performing non-EmitObject actions in the integrated frontend.
The integrated frontend now supports:
  - Parse
  - DumpParse
  - DumpAST
  - PrintAST
  - EmitSILGen
  - EmitSIL
  - EmitIR
  - EmitBC
  - EmitAssembly
  - EmitObject

Moved the code for compiling into a separate performCompile() function in frontend_main.cpp, to facilitate using early returns while still supporting the diagnostic verifier.
Added some error output for the REPL, Immediate, and EmitModuleOnly actions, as the integrated frontend does not yet support these actions.

Swift SVN r11387
2013-12-17 18:35:00 +00:00
Connor Wakamo
620b5abc20 [frontend] Add support for -disable-diagnostic-passes.
Swift SVN r11322
2013-12-15 00:58:23 +00:00
Connor Wakamo
0d3369be03 [frontend] Add support for -help and --help-hidden.
Added PrintHelp and PrintHelpHidden to FrontendOptions.
Marked both -help and --help-hidden with the FrontendOption flag.
Updated ParseFrontendArgs to parse -help and --help-hidden.
Updated frontend_main() so that it prints the help for the frontend options.

Swift SVN r11320
2013-12-14 23:52:15 +00:00
Connor Wakamo
a1266393cd [frontend] Implemented support for verifying diagnostics with the integrated frontend.
Added a new DiagnosticOptions class to swiftBasic, and added a DiagnosticOptions member to CompilerInvocation.
Added a static ParseDiagnosticArgs function to parse diagnostic-related arguments.
Added -verify to FrontendOptions.td, and added support for parsing -verify in ParseDiagnosticArgs.
Updated frontend_main() to enable and trigger the DiagnosticVerifier when -verify is passed.

Swift SVN r11318
2013-12-14 22:08:08 +00:00
Connor Wakamo
debe69032e [frontend] Restructured frontend_main() so that SILGen, SILPasses, and IRGen are not attempted if earlier stages generated errors.
Swift SVN r11317
2013-12-14 21:22:16 +00:00
Connor Wakamo
e6b0f16ad0 [frontend] Add support for -print-stats.
Swift SVN r11190
2013-12-12 17:44:51 +00:00
Connor Wakamo
0e81e109b2 [frontend] In frontend_main(), fall back to SWIFT_MODULES_SDK if -sdk is not passed to the frontend.
This works around <rdar://problem/15639860>, which covers properly handling a missing -sdk argument at either the driver or frontend level (or at both levels).

Swift SVN r11153
2013-12-11 23:13:36 +00:00
Connor Wakamo
42c61e2df1 [frontend] Return immediately from frontend_main() if CompilerInvocation::parseArgs() failed.
Swift SVN r11109
2013-12-11 01:29:16 +00:00
Connor Wakamo
02c1532d27 Initial support for an integrated frontend in swift_driver.
- 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
2013-12-10 18:06:54 +00:00