[driver] Add -lldb-repl and -integrated-repl modes.

Since LLDB is taking over as the REPL for Swift, we eventually want "swift"
and "swift -repl" to invoke "lldb --repl" rather than the frontend. However,
we only want to do this if the LLDB that's present is related to the Swift
that's present -- we don't want to invoke some random LLDB on the system
or in some other Xcode installation. Therefore, Swift searches for LLDB--
first next to the driver, then in the usr/bin/ outside of a toolchain--
before choosing to use it.

If the user just passes -repl and an LLDB is not found relative to the
driver, the existing "integrated" REPL will be launched instead.*

If the user passes -lldb-repl and an LLDB is not found relative to the
driver, one from the user's PATH will be chosen (like the linker).

The user can also pass -integrated-repl to get the existing behavior.
"swift -frontend -repl" always uses the integrated REPL.

* Since LLDB's not quite ready to be the REPL yet, "swift -repl" still
invokes the integrated REPL. "swift -repl -experimental-prefer-lldb" tests
the new behavior; this option will become the default (and the flag removed)
in <rdar://problem/16776719>.

<rdar://problem/16776705>

Swift SVN r17134
This commit is contained in:
Jordan Rose
2014-05-01 02:15:53 +00:00
parent c9baa6d739
commit 9c6ddc085f
9 changed files with 149 additions and 11 deletions

View File

@@ -161,7 +161,7 @@ static bool ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
Action = FrontendOptions::DumpAST;
} else if (Opt.matches(OPT_print_ast)) {
Action = FrontendOptions::PrintAST;
} else if (Opt.matches(OPT_repl)) {
} else if (Opt.matches(OPT_repl) || Opt.matches(OPT_integrated_repl)) {
Action = FrontendOptions::REPL;
} else if (Opt.matches(OPT_i)) {
Action = FrontendOptions::Immediate;