Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorDavid Spickett <david.spickett@linaro.org>2022-05-09 13:58:21 +0300
committerDavid Spickett <david.spickett@linaro.org>2022-05-16 13:57:34 +0300
commit4a94e3801dd721c0083c1259d019a1540388d9d3 (patch)
treef729c16ad69501beb5197c51421f1fdec8206963 /lldb
parente473e79cd194d7a74158ff7e8b97076a7f71c511 (diff)
[lldb][NFC] Simplify GenerateOptionUsage
Once we get into the if block we know the value of only_print_args. Move some variables closer to point of use. Depends on D125218 Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D125219
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Interpreter/Options.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 5957f46f3442..1278f2ad5d7b 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -390,8 +390,6 @@ static bool PrintOption(const OptionDefinition &opt_def,
void Options::GenerateOptionUsage(Stream &strm, CommandObject &cmd,
uint32_t screen_width) {
- const bool only_print_args = cmd.IsDashDashCommand();
-
auto opt_defs = GetDefinitions();
const uint32_t save_indent_level = strm.GetIndentLevel();
llvm::StringRef name = cmd.GetCommandName();
@@ -402,6 +400,7 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject &cmd,
if (num_options == 0)
return;
+ const bool only_print_args = cmd.IsDashDashCommand();
if (!only_print_args)
strm.PutCString("\nCommand Options Usage:\n");
@@ -413,19 +412,16 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject &cmd,
// [options-for-level-1]
// etc.
- uint32_t num_option_sets = GetRequiredOptions().size();
-
if (!only_print_args) {
+ uint32_t num_option_sets = GetRequiredOptions().size();
for (uint32_t opt_set = 0; opt_set < num_option_sets; ++opt_set) {
- uint32_t opt_set_mask;
-
- opt_set_mask = 1 << opt_set;
if (opt_set > 0)
strm.Printf("\n");
strm.Indent(name);
// Different option sets may require different args.
StreamString args_str;
+ uint32_t opt_set_mask = 1 << opt_set;
cmd.GetFormattedCommandArguments(args_str, opt_set_mask);
// First go through and print all options that take no arguments as a
@@ -475,12 +471,9 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject &cmd,
}
if (args_str.GetSize() > 0) {
- if (cmd.WantsRawCommandString() && !only_print_args)
+ if (cmd.WantsRawCommandString())
strm.Printf(" --");
-
strm << " " << args_str.GetString();
- if (only_print_args)
- break;
}
}
}