]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/OptionParser.h
Upgrade Unbound to 1.7.3. More to follow.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / OptionParser.h
1 //===-- OptionParser.h ------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_OptionParser_h_
11 #define liblldb_OptionParser_h_
12
13 #include <mutex>
14 #include <string>
15
16 #include "llvm/ADT/StringRef.h"
17
18 struct option;
19
20 namespace lldb_private {
21
22 struct OptionDefinition;
23
24 struct Option {
25   // The definition of the option that this refers to.
26   const OptionDefinition *definition;
27   // if not NULL, set *flag to val when option found
28   int *flag;
29   // if flag not NULL, value to set *flag to; else return value
30   int val;
31 };
32
33 class OptionParser {
34 public:
35   enum OptionArgument { eNoArgument = 0, eRequiredArgument, eOptionalArgument };
36
37   static void Prepare(std::unique_lock<std::mutex> &lock);
38
39   static void EnableError(bool error);
40
41   static int Parse(int argc, char *const argv[], llvm::StringRef optstring,
42                    const Option *longopts, int *longindex);
43
44   static char *GetOptionArgument();
45   static int GetOptionIndex();
46   static int GetOptionErrorCause();
47   static std::string GetShortOptionString(struct option *long_options);
48 };
49 }
50
51 #endif // liblldb_OptionParser_h_