LLDB  mainline
OptionParser.h
Go to the documentation of this file.
1 //===-- OptionParser.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 liblldb_OptionParser_h_
10 #define liblldb_OptionParser_h_
11 
12 #include <mutex>
13 #include <string>
14 
15 #include "llvm/ADT/StringRef.h"
16 
17 struct option;
18 
19 namespace lldb_private {
20 
21 struct OptionDefinition;
22 
23 struct Option {
24  // The definition of the option that this refers to.
25  const OptionDefinition *definition;
26  // if not NULL, set *flag to val when option found
27  int *flag;
28  // if flag not NULL, value to set *flag to; else return value
29  int val;
30 };
31 
32 class OptionParser {
33 public:
34  enum OptionArgument { eNoArgument = 0, eRequiredArgument, eOptionalArgument };
35 
36  static void Prepare(std::unique_lock<std::mutex> &lock);
37 
38  static void EnableError(bool error);
39 
40  static int Parse(int argc, char *const argv[], llvm::StringRef optstring,
41  const Option *longopts, int *longindex);
42 
43  static char *GetOptionArgument();
44  static int GetOptionIndex();
45  static int GetOptionErrorCause();
46  static std::string GetShortOptionString(struct option *long_options);
47 };
48 }
49 
50 #endif // liblldb_OptionParser_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
Node * Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc)
Parse the given postfix expression.
const OptionDefinition * definition
Definition: OptionParser.h:25