LLDB mainline
OptionDefinition.h
Go to the documentation of this file.
1//===-- OptionDefinition.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_UTILITY_OPTIONDEFINITION_H
10#define LLDB_UTILITY_OPTIONDEFINITION_H
11
14#include "llvm/ADT/StringExtras.h"
15#include "llvm/Support/MathExtras.h"
16#include <climits>
17#include <cstdint>
18
19namespace lldb_private {
21 /// Used to mark options that can be used together. If
22 /// `(1 << n & usage_mask) != 0` then this option belongs to option set n.
23 uint32_t usage_mask;
24 /// This option is required (in the current usage level).
26 /// Full name for this option.
27 const char *long_option;
28 /// Single character for this option. If the option doesn't use a short
29 /// option character, this has to be a integer value that is not a printable
30 /// ASCII code point and also unique in the used set of options.
31 /// @see OptionDefinition::HasShortOption
33 /// no_argument, required_argument or optional_argument
35 /// If non-NULL, option is valid iff |validator->IsValid()|, otherwise
36 /// always valid.
38 /// If not empty, an array of enum values.
40 /// The kind of completion for this option.
41 /// Contains values of the lldb::CompletionType enum.
43 /// Type of argument this option takes.
45 /// Full text explaining what this options does and what (if any) argument to
46 /// pass it.
47 const char *usage_text;
48
49 /// Whether this has a short option character.
50 bool HasShortOption() const {
51 // See the short_option documentation for more.
52 return llvm::isUInt<CHAR_BIT>(short_option) &&
53 llvm::isPrint(short_option);
54 }
55};
56} // namespace lldb_private
57
58#endif // LLDB_UTILITY_OPTIONDEFINITION_H
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
llvm::ArrayRef< OptionEnumValueElement > OptionEnumValues
bool HasShortOption() const
Whether this has a short option character.
OptionValidator * validator
If non-NULL, option is valid iff |validator->IsValid()|, otherwise always valid.
const char * long_option
Full name for this option.
const char * usage_text
Full text explaining what this options does and what (if any) argument to pass it.
bool required
This option is required (in the current usage level).
uint32_t completion_type
The kind of completion for this option.
int option_has_arg
no_argument, required_argument or optional_argument
uint32_t usage_mask
Used to mark options that can be used together.
lldb::CommandArgumentType argument_type
Type of argument this option takes.
OptionEnumValues enum_values
If not empty, an array of enum values.
int short_option
Single character for this option.