Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:57

0001 //===-- OptionDefinition.h --------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_UTILITY_OPTIONDEFINITION_H
0010 #define LLDB_UTILITY_OPTIONDEFINITION_H
0011 
0012 #include "lldb/lldb-enumerations.h"
0013 #include "lldb/lldb-private-types.h"
0014 #include "llvm/ADT/StringExtras.h"
0015 #include "llvm/Support/MathExtras.h"
0016 #include <climits>
0017 #include <cstdint>
0018 
0019 namespace lldb_private {
0020 struct OptionDefinition {
0021   /// Used to mark options that can be used together.  If
0022   /// `(1 << n & usage_mask) != 0` then this option belongs to option set n.
0023   uint32_t usage_mask;
0024   /// This option is required (in the current usage level).
0025   bool required;
0026   /// Full name for this option.
0027   const char *long_option;
0028   /// Single character for this option. If the option doesn't use a short
0029   /// option character, this has to be a integer value that is not a printable
0030   /// ASCII code point and also unique in the used set of options.
0031   /// @see OptionDefinition::HasShortOption
0032   int short_option;
0033   /// no_argument, required_argument or optional_argument
0034   int option_has_arg;
0035   /// If non-NULL, option is valid iff |validator->IsValid()|, otherwise
0036   /// always valid.
0037   OptionValidator *validator;
0038   /// If not empty, an array of enum values.
0039   OptionEnumValues enum_values;
0040   /// The kind of completion for this option.
0041   /// Contains values of the lldb::CompletionType enum.
0042   uint32_t completion_type;
0043   /// Type of argument this option takes.
0044   lldb::CommandArgumentType argument_type;
0045   /// Full text explaining what this options does and what (if any) argument to
0046   /// pass it.
0047   const char *usage_text;
0048 
0049   /// Whether this has a short option character.
0050   bool HasShortOption() const {
0051     // See the short_option documentation for more.
0052     return llvm::isUInt<CHAR_BIT>(short_option) &&
0053            llvm::isPrint(short_option);
0054   }
0055 };
0056 } // namespace lldb_private
0057 
0058 #endif // LLDB_UTILITY_OPTIONDEFINITION_H