19 static std::mutex g_mutex;
20 lock = std::unique_lock<std::mutex>(g_mutex);
32 llvm::StringRef optstring,
const Option *longopts,
34 std::vector<option> opts;
37 opt.flag = longopts->
flag;
38 opt.val = longopts->
val;
44 opts.push_back(option());
45 std::string opt_cstr = std::string(optstring);
46 return getopt_long_only(argv.size() - 1, argv.data(), opt_cstr.c_str(),
61 if (long_options[i].name ==
nullptr && long_options[i].has_arg == 0 &&
62 long_options[i].flag ==
nullptr && long_options[i].val == 0) {
65 if (long_options[i].flag ==
nullptr && isalpha(long_options[i].val)) {
66 s.append(1, (
char)long_options[i].val);
67 switch (long_options[i].has_arg) {
72 case optional_argument:
75 case required_argument:
static llvm::raw_ostream & error(Stream &strm)
static void Prepare(std::unique_lock< std::mutex > &lock)
static int Parse(llvm::MutableArrayRef< char * > argv, llvm::StringRef optstring, const Option *longopts, int *longindex)
Argv must be an argument vector "as passed to main", i.e.
static std::string GetShortOptionString(struct option *long_options)
static int GetOptionIndex()
static char * GetOptionArgument()
static void EnableError(bool error)
static int GetOptionErrorCause()
A class that represents a running process on the host machine.
const char * long_option
Full name for this option.
int option_has_arg
no_argument, required_argument or optional_argument
const OptionDefinition * definition