[Lldb-commits] [lldb] r349371 - [Driver] Fix --repl argument.
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 17 10:11:48 PST 2018
Author: jdevlieghere
Date: Mon Dec 17 10:11:48 2018
New Revision: 349371
URL: http://llvm.org/viewvc/llvm-project?rev=349371&view=rev
Log:
[Driver] Fix --repl argument.
The --repl option was incorrectly defined as "Separate" (option and
value separated by a space). This resulted in the option not being
picked up when no value was specified.
This patch fixes the driver so that `--repl` is recognized again. I
split the option into two:
- A flag: `--repl` and `-r` which take no arguments.
- A joined option: `--repl=<flags>` and `-r=<flags>` that forward its
values to the repl.
This should match the driver's old behavior.
Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Options.td
Modified: lldb/trunk/tools/driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=349371&r1=349370&r2=349371&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Mon Dec 17 10:11:48 2018
@@ -373,13 +373,14 @@ SBError Driver::ProcessArgs(const opt::I
}
}
- if (auto *arg = args.getLastArg(OPT_repl)) {
- auto arg_value = arg->getValue();
+ if (args.hasArg(OPT_repl)) {
m_option_data.m_repl = true;
- if (arg_value && arg_value[0])
+ }
+
+ if (auto *arg = args.getLastArg(OPT_repl_)) {
+ m_option_data.m_repl = true;
+ if (auto arg_value = arg->getValue())
m_option_data.m_repl_options = arg_value;
- else
- m_option_data.m_repl_options.clear();
}
// We need to process the options below together as their relative order
Modified: lldb/trunk/tools/driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Options.td?rev=349371&r1=349370&r2=349371&view=diff
==============================================================================
--- lldb/trunk/tools/driver/Options.td (original)
+++ lldb/trunk/tools/driver/Options.td Mon Dec 17 10:11:48 2018
@@ -46,7 +46,8 @@ def: Flag<["-"], "P">,
HelpText<"Alias for --python-path">,
Group<grp_scripting>;
-def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"<language>">,
+def script_language: Separate<["--", "-"], "script-language">,
+ MetaVarName<"<language>">,
HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
Group<grp_scripting>;
def: Separate<["-"], "l">,
@@ -57,13 +58,22 @@ def: Separate<["-"], "l">,
// Repl options.
def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
-def repl: Separate<["--", "-"], "repl">,
+def repl: Flag<["--", "-"], "repl">,
HelpText<"Runs lldb in REPL mode with a stub process.">,
Group<grp_repl>;
-def: Separate<["-"], "r">,
+def: Flag<["-"], "r">,
Alias<repl>,
HelpText<"Alias for --repl">,
Group<grp_repl>;
+def repl_: Joined<["--", "-"], "repl=">,
+ MetaVarName<"<flags>">,
+ HelpText<"Runs lldb in REPL mode with a stub process with the given flags.">,
+ Group<grp_repl>;
+def: Joined<["-"], "r=">,
+ MetaVarName<"<flags>">,
+ Alias<repl_>,
+ HelpText<"Alias for --repl=<flags>">,
+ Group<grp_repl>;
def repl_language: Separate<["--", "-"], "repl-language">,
MetaVarName<"<language>">,
More information about the lldb-commits
mailing list