//===-- source/Host/common/OptionParser.cpp -------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "lldb/Host/OptionParser.h" #include "lldb/Host/HostGetOpt.h" #include "lldb/Utility/OptionDefinition.h" #include "lldb/lldb-private-types.h" #include using namespace lldb_private; void OptionParser::Prepare(std::unique_lock &lock) { static std::mutex g_mutex; lock = std::unique_lock(g_mutex); #ifdef __GLIBC__ optind = 0; #else optreset = 1; optind = 1; #endif } void OptionParser::EnableError(bool error) { opterr = error ? 1 : 0; } int OptionParser::Parse(llvm::MutableArrayRef argv, llvm::StringRef optstring, const Option *longopts, int *longindex) { std::vector