Commit Graph

1272 Commits

Author SHA1 Message Date
Jordan Rose
099d37830a [driver] Pass -Xfrontend options to the module-merge tool.
...and honor -o for -emit-module mode if we're not emitting any other kind
of output.

Swift SVN r13400
2014-02-04 01:32:46 +00:00
Jordan Rose
0d5734c80b Remove test for -emit-dependencies.
This option (intended to be equivalent to Clang's -MD) was never fully
implemented, and is not immediately needed by Xcode. We can test this
again once it's actually needed.

Part of the migration to the new driver.

Swift SVN r13244
2014-01-31 19:57:59 +00:00
Jordan Rose
80ea14a1f4 [driver] Pass the SDK to the merge-module tool.
...as well as the target triple, include paths, and whether or not we're
compiling with debug info. (The last one doesn't currently make any
difference, but it seems prudent to be consistent.)

<rdar://problem/15930675>

Swift SVN r13080
2014-01-29 00:39:09 +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
6384482902 [driver] Added support to honor the SDKROOT environment variable.
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
2014-01-22 23:41:29 +00:00
Connor Wakamo
d0dcb4961b [test] Added a couple of tests for -output-file-map.
First, use -driver-print-output-file-map to ensure that the map we write out is, in fact, being deserialized properly.
Then, use -driver-print-bindings to ensure that we are preferring values in the output file map to default output paths.

Swift SVN r12775
2014-01-22 21:07:07 +00:00
Connor Wakamo
c6d23228db [frontend] Updated CompilerInvocation::parseArgs() so that it emits a diagnostic when it encounters an unknown argument.
Added a test which ensures that the driver invokes the integrated frontend in a way which does not produce any errors, in order to catch mismatches between the options the driver passes to the integrated frontend and the options which the integrated frontend accepts.

Swift SVN r11105
2013-12-11 00:26:06 +00:00
Connor Wakamo
3d9f94e715 Properly implemented "swift_driver -driver-print-bindings".
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
2013-12-06 21:23:03 +00:00
Connor Wakamo
f556ee54cc Added a few initial tests for swift_driver.
These tests currently only exercise the "swift_driver -driver-print-actions"
functionality, but at this point that is the only part of the driver which is
reasonably testable without the expectation that tests will break as output
formats change.

Swift SVN r10934
2013-12-06 21:23:03 +00:00
Jordan Rose
fb0fa908b6 [Frontend] Parse the main file last to make sure implicit visibility works.
Otherwise, we'll try to type-check bits of the main source file before we've
even looked at any of the supporting files.

This affects implicit multi-file mode, where "main.swift" is assumed to be
the main source file and all others are treated as library files. (See r9890.)

<rdar://problem/15526743>

Swift SVN r10795
2013-12-04 21:54:43 +00:00
Dmitri Hrybenko
5f63cbe375 Move driver test to a correct place
Swift SVN r10525
2013-11-17 09:38:43 +00:00
Jordan Rose
aeb22194a0 [driver] Treat "main.swift" as the main source file if given multiple inputs.
New rules for the driver (first match):
1. -repl: no input files allowed
2. -parse-sil: one input file allowed
3. -parse-as-library: any number of input files, all treated as Library
4. one input, extension is .sil: treated as SIL
5. one input: treated as Main
6. many inputs: treated as Library by default; "main.swift" is treated as Main

If we want more control here we can also add a -main-file option to explicitly
call out the main source file, but this at least unblocks building an entire
app target (like ListMaker) with a single Swift invocation.

Swift SVN r9890
2013-11-02 01:08:40 +00:00
Jordan Rose
3eec81a783 Add 'asserts' as a REQUIRES feature for lit tests.
Use this to test debug-only features.

Swift SVN r9574
2013-10-22 00:30:12 +00:00
Jordan Rose
bb7e33e09e First pass at emitting dependency (.d) files.
This can be used to optimize the build order in a build system. Note,
however, that no canonicalization is going on -- we're just printing
out the paths at which we found everything we imported or listed on the
command line.

Part of <rdar://problem/14899639>

Swift SVN r8013
2013-09-06 23:22:27 +00:00
Jordan Rose
158e5d06cd Only strip the last extension from a file when inferring a module name.
Previously, we were finding the /first/ dot in a name, and stripping
everything after that. If that's really what someone wants to do, they
can use -module-name explicitly.

Swift SVN r7374
2013-08-20 22:13:24 +00:00
Jordan Rose
caad4f3606 Allow -o to refer to an output directory.
In this case, the output filename is taken from the module name.

  swift -emit-module x/y.swift
    -> x/y.swiftmodule
  swift -emit-module x/y.swift -module-name z
    -> x/z.swiftmodule
  swift -emit-module x/y.swift -o w/
    -> w/y.swiftmodule
  swift -emit-module x/y.swift -o w/ -module-name z
    -> w/z.swiftmodule
  swift -emit-module x/y.swift -o explicit.module
    -> ./explicit.module

Swift SVN r6854
2013-08-02 21:00:56 +00:00
Dmitri Hrybenko
ee2fc97d5d Remove spurious object file
Swift SVN r6123
2013-07-10 18:39:13 +00:00
John McCall
6e79ed41f9 Per review, there's currently no need to reserve space
for future expansion in this.

Swift SVN r6122
2013-07-10 18:35:47 +00:00
Dmitri Hrybenko
99cc28c5ff Remove object file from test directory
Swift SVN r6118
2013-07-10 16:57:36 +00:00
John McCall
87ef9204d4 Rewrite the storage type of a [weak] or [unowned] variable.
getTypeOfReference drops the ReferenceStorageType from the
variable when it introduces the LValueType.

Swift SVN r6110
2013-07-10 07:56:38 +00:00
Dmitri Hrybenko
c7421211a3 Factor out logic that creates and configures all objects required for
compilation into a 'Frontend' library.

This library is still not in its best shape, but now it can be reused in
swift-index-test.


Swift SVN r6040
2013-07-06 00:46:19 +00:00
Dmitri Hrybenko
b9dfab2a8e Rename a driver test to something sane
Swift SVN r6019
2013-07-05 21:02:49 +00:00