Commit Graph

1435 Commits

Author SHA1 Message Date
Connor Wakamo
399257e072 [frontend] Added a comment to indicate that the branch for choosing a default output filename should never be used when invoking the frontend via the driver.
Swift SVN r12882
2014-01-23 22:38:00 +00:00
Connor Wakamo
6325d2eac5 [frontend] Made EmitObject the default requested action.
This matches the behavior of the swift executable.

Swift SVN r12881
2014-01-23 22:20:07 +00:00
Connor Wakamo
6348426d3f [frontend] Added support for selecting a default OutputFilename.
If the user did not specify an OutputFilename, or if the user specified a
directory with -o, calculate a default OutputFilename based on the inputs,
module name, and requested action.

This matches the behavior of the swift executable.

Swift SVN r12880
2014-01-23 22:20:06 +00:00
Connor Wakamo
552558d03f [frontend] Removed the separate TargetOptions class.
TargetOptions only contained the target triple, which was duplicated in
IRGenOptions. These could get out-of-sync, which would cause issues during
IRGen. Since nothing was using TargetOptions other than CompilerInvocation,
removed TargetOptions in favor of making IRGenOptions the canonical home of the
target triple.

Swift SVN r12869
2014-01-23 19:07:55 +00:00
Connor Wakamo
b35b8451f4 [frontend] Fixed an issue with auto-detecting SIL input.
Swift SVN r12868
2014-01-23 18:30:54 +00:00
Connor Wakamo
39666501b0 [frontend] Added support for -enable-experimental-patterns to the integrated frontend.
Swift SVN r12867
2014-01-23 18:30:53 +00:00
Connor Wakamo
6dd1532788 [frontend] Added support for -disable-all-runtime-checks to the integrated frontend.
Swift SVN r12866
2014-01-23 18:30:53 +00:00
Jordan Rose
9cb81b0006 [driver] Add support for invoking ld.
swift_driver can now end-to-end compile a Swift file. Try it yourself!

echo 'println("hello")' | swift_driver -

Swift SVN r12840
2014-01-23 02:11:47 +00:00
Connor Wakamo
947f3be6e7 [driver] Removed the limited support for -module-source-list.
This option was never honored, and the main functionality that this option
would have implemented has been subsumed by -output-file-map.

Swift SVN r12800
2014-01-22 22:37:21 +00:00
Connor Wakamo
0a3202a46a [driver] Standardized the names of output-specifying options for secondary outputs.
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
2014-01-20 23:16:22 +00:00
Connor Wakamo
de753a659b [frontend] Added a check to disallow the combination of -i and -primary-file.
Swift SVN r12524
2014-01-18 00:55:47 +00:00
Connor Wakamo
a23b6408a9 [frontend] Added a check to ensure REPL mode is not requested with input files.
Swift SVN r12523
2014-01-18 00:55:46 +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
Adrian Prantl
035a1175df Debug info: Ensure that the SDK is emitted if it is implicit. Also do a
slightly better job at quoting.
<rdar://problem/15808224> Point ClangImporter at the right SDK for the target

Swift SVN r12310
2014-01-15 01:51:41 +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
0b7569fab7 [frontend] Add proper support for determining the InputKind.
Added checks to determine if the input should be treated as SIL, Library, REPL, or Main, based on the command line arguments and inputs.

Swift SVN r12176
2014-01-11 00:33:31 +00:00
Connor Wakamo
b0f27de6b8 [frontend] Move InputKind from CompilerInvocation to FrontendOptions, and move handling of -parse-as-library to ParseFrontendArgs().
Swift SVN r12174
2014-01-11 00:33:30 +00:00
Connor Wakamo
044be74855 [frontend] Move ParseStdlib from CompilerInvocation to FrontendOptions, and move handling of -parse-stdlib to ParseFrontendArgs().
Swift SVN r12173
2014-01-11 00:33:30 +00:00
Connor Wakamo
a7460947bd [frontend] Made -primary-file accept a value (instead of relying on relative position of arguments).
Also added a -primary-file= alias.

Swift SVN r12171
2014-01-11 00:06:24 +00:00
Connor Wakamo
8c04586911 [frontend] Add support for specifying the primary input with the -primary-file flag.
Swift SVN r12150
2014-01-10 22:39:05 +00:00
Joe Groff
e06ee37dca Enable SIL protocol witnesses.
We should be able to cut out another layer of IRGen grime now.

This does XFAIL one test, test/Prototypes/TextFormatting.swift, which fails because of a weird archetype ordering in a nested substitution list. This should get sorted out by switching to interface types, so I'm going to let it go until then.

Swift SVN r11618
2013-12-24 04:36:03 +00:00
Greg Parker
0e360cb26e Install stdlib into /usr/lib/swift/<OS name>/.
This reinstates r11411 with fixes for the autoconf+make build.


Swift SVN r11494
2013-12-20 01:01:35 +00:00
Argyrios Kyrtzidis
21518ab695 [Frontend] When setting the MainInputFilename in the compiler invocation, check first that the input filenames vector is not empty.
Swift SVN r11484
2013-12-19 22:29:27 +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
0f6c51dd5b [frontend] Add support for -enable-dynamic-value-type-layout.
Swift SVN r11454
2013-12-18 23:42:53 +00:00
Connor Wakamo
19c9107fa5 [frontend] Add support for -disable-llvm-optzns.
Swift SVN r11453
2013-12-18 23:42:52 +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
90480e9c13 [frontend] Add support for the -g option.
Added a static ParseIRGenArgs function, which includes a handler for -g (including setting up the DWARFDebugFlags appropriately).

Swift SVN r11449
2013-12-18 23:42:50 +00:00
Chris Lattner
073974dca4 revert r11411, which completely broke the makefile build.
Swift SVN r11414
2013-12-18 04:33:58 +00:00
Greg Parker
9032632299 Install stdlib into /usr/lib/swift/<OS name>/.
Swift SVN r11411
2013-12-18 02:19:29 +00:00
Connor Wakamo
7fae046c0e [frontend] Fix indentation issue.
Swift SVN r11402
2013-12-18 00:05:46 +00:00
Connor Wakamo
8ec19ce6e1 [frontend] Fix formatting issue.
Swift SVN r11401
2013-12-17 23:53:18 +00:00
Connor Wakamo
9bbb4fcbdf [frontend] Use "main" as a fallback module name if there's only one input file and it's kind is SourceFileKind::Main.
Swift SVN r11400
2013-12-17 23:36:56 +00:00
Connor Wakamo
129d307bc1 [frontend] Adjusted the handling of -module-name in the integrated frontend to provide fallbacks and diagnostics.
This matches the behavior of the swift executable.

Swift SVN r11394
2013-12-17 21:34:25 +00:00
Connor Wakamo
5a603a3cd1 [driver] Add support for -emit-ir and -emit-bc.
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
2013-12-17 02:43:40 +00:00
Connor Wakamo
3705f018ac [frontend] Make -dump-parse explicitly set ParseOnly to true.
Also updated the comments in FrontendOptions::ActionType to indicate that only -dump-parse skips type-checking. (Previously, the comments implied that -parse also skipped type-checking, which is not the desired behavior.)

Swift SVN r11374
2013-12-17 02:43:39 +00:00
Connor Wakamo
20e0d1c64e [frontend] Add support for parsing the action which the integrated frontend should perform.
Added an ActionType enum to FrontendOptions with the various actions that the integrated frontend will support, as well as a new RequestedAction member.
Added support for determining the user’s requested action in ParseFrontendArgs. (The integrated frontend does not yet honor this request; support for that is forthcoming.)

Swift SVN r11372
2013-12-17 02:43:27 +00:00
Connor Wakamo
3b80655e62 [driver] Switched from --help-hidden to -help-hidden.
Left --help-hidden in as an alias for consistency with clang, but -help-hidden is now the primary spelling of this option.

Swift SVN r11350
2013-12-16 19:23:16 +00:00
Connor Wakamo
40dfbc0bc8 [frontend] Add support for parsing ImmediateArgv.
These are not yet used, since the integrated frontend doesn’t yet support immediate mode, but they are ready for use once immediate mode is supported.

Swift SVN r11326
2013-12-15 00:58:28 +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
f203e1fd96 [frontend] Moved ModuleSourceListPath from CompilerInvocation to FrontendOptions.
Also moved the handling of -module-source-list from the loop to ParseFrontendArgs.

Swift SVN r11290
2013-12-14 01:44:12 +00:00
Connor Wakamo
8f465324cf [frontend] Split target-related options out from ComplierInvocation into a new TargetOptions class.
Removed CompilerInvocation::TargetTriple and replaced it with CompilerInvocation::TargetOpts, a TargetOptions object.
Added a static ParseTargetArgs function to set up TargetOptions, and moved handling of -target into that function.

Swift SVN r11288
2013-12-14 01:28:13 +00:00
Connor Wakamo
605589922a [frontend] Fix the handling of -debug-constraints-attempt.
StringRef::getAsInteger returns true, not false, when an error occurs.
Explicitly set the radix to 10, instead of inferring the radix.
For the invalid argument value diagnostic, switch the order of the argument string and the value.

Swift SVN r11279
2013-12-13 23:56:31 +00:00
Connor Wakamo
20ce2ba390 [frontend] Moved SDKPath from CompilerInvocation to SearchPathOptions.
Swift SVN r11237
2013-12-13 04:52:58 +00:00
Connor Wakamo
9a1c706be7 [frontend] Moved FrameworkSearchPaths from CompilerInvocation to SearchPathOptions.
Swift SVN r11216
2013-12-12 22:36:42 +00:00
Connor Wakamo
1ecc5cc3e6 [frontend] Moved ImportSearchPaths out of CompilerInvocation/ASTContext and into SearchPathOptions.
Also updated findModule() in SourceLoader.cpp and SerializedModuleLoader.cpp to get the ImportSearchPaths from the ASTContext’s SearchPathOpts, instead of directly from the ASTContext.

Swift SVN r11214
2013-12-12 22:15:58 +00:00