1 //===-- OptionParser.h ------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_OptionParser_h_
11 #define liblldb_OptionParser_h_
16 #include "llvm/ADT/StringRef.h"
20 namespace lldb_private {
22 struct OptionDefinition;
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
29 // if flag not NULL, value to set *flag to; else return value
35 enum OptionArgument { eNoArgument = 0, eRequiredArgument, eOptionalArgument };
37 static void Prepare(std::unique_lock<std::mutex> &lock);
39 static void EnableError(bool error);
41 static int Parse(int argc, char *const argv[], llvm::StringRef optstring,
42 const Option *longopts, int *longindex);
44 static char *GetOptionArgument();
45 static int GetOptionIndex();
46 static int GetOptionErrorCause();
47 static std::string GetShortOptionString(struct option *long_options);
51 #endif // liblldb_OptionParser_h_