// "platform process list"
-static OptionDefinition g_platform_process_list_options[] = {
+static PosixPlatformCommandOptionValidator posix_validator;
+static constexpr OptionDefinition g_platform_process_list_options[] = {
#define LLDB_OPTIONS_platform_process_list
#include "CommandOptions.inc"
};
public:
CommandOptions()
: Options(), match_info(), show_args(false), verbose(false) {
- static llvm::once_flag g_once_flag;
- llvm::call_once(g_once_flag, []() {
- PosixPlatformCommandOptionValidator *posix_validator =
- new PosixPlatformCommandOptionValidator();
- for (auto &Option : g_platform_process_list_options) {
- switch (Option.short_option) {
- case 'u':
- case 'U':
- case 'g':
- case 'G':
- Option.validator = posix_validator;
- break;
- default:
- break;
- }
- }
- });
}
~CommandOptions() override = default;
def platform_process_list_parent : Option<"parent", "P">, GroupRange<2, 6>,
Arg<"Pid">, Desc<"Find processes that have a matching parent process ID.">;
def platform_process_list_uid : Option<"uid", "u">, GroupRange<2, 6>,
- Arg<"UnsignedInteger">,
+ Arg<"UnsignedInteger">, Validator<"&posix_validator">,
Desc<"Find processes that have a matching user ID.">;
def platform_process_list_euid : Option<"euid", "U">, GroupRange<2, 6>,
- Arg<"UnsignedInteger">,
+ Arg<"UnsignedInteger">, Validator<"&posix_validator">,
Desc<"Find processes that have a matching effective user ID.">;
def platform_process_list_gid : Option<"gid", "g">, GroupRange<2, 6>,
- Arg<"UnsignedInteger">,
+ Arg<"UnsignedInteger">, Validator<"&posix_validator">,
Desc<"Find processes that have a matching group ID.">;
def platform_process_list_egid : Option<"egid", "G">, GroupRange<2, 6>,
- Arg<"UnsignedInteger">,
+ Arg<"UnsignedInteger">, Validator<"&posix_validator">,
Desc<"Find processes that have a matching effective group ID.">;
def platform_process_list_arch : Option<"arch", "a">, GroupRange<2, 6>,
Arg<"Architecture">,
////////////////////////////////////////////////////////////////////////////////
// Field: validator
// Default value: 0 (No validator for option)
-// Set by: Nothing. This is currently only set after initialization in LLDB.
+// Set by:
+// - `Validator`: Sets the value to a given validator (which has to exist in
+// the surrounding code.
////////////////////////////////////////////////////////////////////////////////
// Field: enum_values
// Default value: {} (No enum associated with this option)
class Completion<string completion> {
list<string> Completions = [completion];
}
+
+// Sets the validator for a given option.
+class Validator<string validator> {
+ string Validator = validator;
+}