19 #ifndef LLVM_SUPPORT_COMMANDLINE_H 20 #define LLVM_SUPPORT_COMMANDLINE_H 40 #include <initializer_list> 42 #include <type_traits> 72 const char *EnvVar =
nullptr,
73 bool LongOptionsUseDoubleDash =
false);
80 const char *Overview =
"");
196 void registerCategory();
201 : Name(Name), Description(Description) {
221 void registerSubCommand();
222 void unregisterSubCommand();
226 : Name(Name), Description(Description) {
227 registerSubCommand();
233 explicit operator bool()
const;
261 virtual bool handleOccurrence(
unsigned pos,
StringRef ArgName,
264 virtual enum ValueExpected getValueExpectedFlagDefault()
const {
269 virtual void anchor();
347 : NumOccurrences(0), Occurrences(OccurrencesFlag),
Value(0),
349 FullyInitialized(
false), Position(0), AdditionalVals(0) {
350 Categories.push_back(&GeneralCategory);
356 virtual ~
Option() =
default;
366 void removeArgument();
369 virtual size_t getOptionWidth()
const = 0;
374 virtual void printOptionInfo(
size_t GlobalWidth)
const = 0;
376 virtual void printOptionValue(
size_t GlobalWidth,
bool Force)
const = 0;
378 virtual void setDefault() = 0;
380 static void printHelpStr(
StringRef HelpStr,
size_t Indent,
381 size_t FirstLineIndentedBy);
388 bool MultiArg =
false);
432 template <
class Opt>
void apply(Opt &
O)
const { O.setInitialValue(Init); }
448 template <
class Opt>
void apply(Opt &
O)
const { O.setLocation(O, Loc); }
462 template <
class Opt>
void apply(Opt &
O)
const { O.addCategory(Category); }
471 template <
class Opt>
void apply(Opt &
O)
const { O.addSubCommand(Sub); }
476 template <
typename R,
typename Ty>
struct cb {
477 std::function<R(Ty)>
CB;
481 template <
typename Opt>
void apply(Opt &
O)
const { O.setCallback(CB); }
485 template <
typename F>
488 template <
typename R,
typename C,
typename...
Args>
492 static_assert(
sizeof...(
Args) == 1,
"callback function must have one and only one parameter");
493 static_assert(std::is_same<result_type, void>::value,
494 "callback return type must be void");
496 std::is_lvalue_reference<arg_type>::value &&
497 std::is_const<
typename std::remove_reference<arg_type>::type>::value,
498 "callback arg_type must be a const lvalue reference");
502 template <
typename F>
525 virtual void anchor();
532 template <
class DataType,
bool isClass>
570 assert(Valid &&
"invalid option value");
591 template <
class DataType>
603 template <
class DataType>
634 void anchor()
override;
651 void anchor()
override;
665 #define clEnumVal(ENUMVAL, DESC) \ 666 llvm::cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC } 667 #define clEnumValN(ENUMVAL, FLAGNAME, DESC) \ 668 llvm::cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC } 683 template <
class Opt>
void apply(Opt &
O)
const {
684 for (
auto Value : Values)
713 : Name(name), HelpStr(helpStr) {}
727 virtual unsigned getNumOptions()
const = 0;
730 virtual StringRef getOption(
unsigned N)
const = 0;
736 virtual size_t getOptionWidth(
const Option &
O)
const;
743 virtual void printOptionInfo(
const Option &O,
size_t GlobalWidth)
const;
747 size_t GlobalWidth)
const;
753 template <
class AnyOptionValue>
755 const AnyOptionValue &Default,
756 size_t GlobalWidth)
const {
757 printGenericOptionDiff(O, V, Default, GlobalWidth);
766 if (!Owner.hasArgStr())
767 for (
unsigned i = 0,
e = getNumOptions(); i !=
e; ++i)
783 if (Owner.hasArgStr())
824 return Values[
N].HelpStr;
835 if (Owner.hasArgStr())
840 for (
size_t i = 0,
e = Values.
size(); i !=
e; ++i)
841 if (Values[i].Name == ArgVal) {
842 V = Values[i].V.getValue();
846 return O.
error(
"Cannot find option named '" + ArgVal +
"'!");
853 assert(findOption(Name) == Values.
size() &&
"Option already exists!");
854 OptionInfo
X(Name, static_cast<DataType>(V), HelpStr);
862 unsigned N = findOption(Name);
863 assert(N != Values.
size() &&
"Option not found!");
886 size_t getOptionWidth(
const Option &
O)
const;
891 void printOptionInfo(
const Option &O,
size_t GlobalWidth)
const;
895 void printOptionNoValue(
const Option &O,
size_t GlobalWidth)
const;
901 virtual void anchor();
905 void printOptionName(
const Option &O,
size_t GlobalWidth)
const;
939 size_t GlobalWidth)
const;
942 void anchor()
override;
964 size_t GlobalWidth)
const;
967 void anchor()
override;
986 size_t GlobalWidth)
const;
989 void anchor()
override;
1008 size_t GlobalWidth)
const;
1011 void anchor()
override;
1030 size_t GlobalWidth)
const;
1033 void anchor()
override;
1052 size_t GlobalWidth)
const;
1055 void anchor()
override;
1075 size_t GlobalWidth)
const;
1078 void anchor()
override;
1093 unsigned long long &Val);
1099 size_t GlobalWidth)
const;
1102 void anchor()
override;
1121 size_t GlobalWidth)
const;
1124 void anchor()
override;
1143 size_t GlobalWidth)
const;
1146 void anchor()
override;
1168 size_t GlobalWidth)
const;
1171 void anchor()
override;
1193 size_t GlobalWidth)
const;
1196 void anchor()
override;
1208 template <
class ParserClass,
class DT>
1220 P.printOptionNoValue(O, GlobalWidth);
1235 template <
class ParserClass,
class ValDT>
1242 printer.
print(O, static_cast<const ParserClass &>(P), V, Default,
1253 template <
class Opt>
static void opt(
const Mod &M, Opt &
O) { M.apply(O); }
1294 "cl::Grouping can only apply to single charater Options.");
1300 template <
class Opt,
class Mod,
class... Mods>
1301 void apply(Opt *
O,
const Mod &M,
const Mods &... Ms) {
1306 template <
class Opt,
class Mod>
void apply(Opt *
O,
const Mod &M) {
1317 template <
class DataType,
bool ExternalStorage,
bool isClass>
1322 void check_location()
const {
1323 assert(Location &&
"cl::location(...) not specified for a command " 1324 "line option with external storage, " 1325 "or cl::init specified before cl::location()!!");
1333 return O.
error(
"cl::location(x) specified more than once!");
1339 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1364 template <
class DataType>
1369 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1370 DataType::operator=(V);
1394 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1413 template <
class DataType,
bool ExternalStorage =
false,
1417 std::is_class<DataType>::value> {
1420 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1422 typename ParserClass::parser_data_type Val =
1423 typename ParserClass::parser_data_type();
1424 if (Parser.parse(*
this, ArgName, Arg, Val))
1426 this->setValue(Val);
1427 this->setPosition(pos);
1432 enum ValueExpected getValueExpectedFlagDefault()
const override {
1433 return Parser.getValueExpectedFlagDefault();
1437 return Parser.getExtraOptionNames(OptionNames);
1441 size_t getOptionWidth()
const override {
1442 return Parser.getOptionWidth(*
this);
1445 void printOptionInfo(
size_t GlobalWidth)
const override {
1446 Parser.printOptionInfo(*
this, GlobalWidth);
1449 void printOptionValue(
size_t GlobalWidth,
bool Force)
const override {
1450 if (Force || this->getDefault().
compare(this->getValue())) {
1451 cl::printOptionDiff<ParserClass>(*
this, Parser, this->getValue(),
1452 this->getDefault(), GlobalWidth);
1456 template <
class T,
class =
typename std::enable_if<
1457 std::is_assignable<T&, T>::value>
::type>
1458 void setDefaultImpl() {
1464 template <
class T,
class =
typename std::enable_if<
1465 !std::is_assignable<T&, T>::value>
::type>
1466 void setDefaultImpl(...) {}
1468 void setDefault()
override { setDefaultImpl<DataType>(); }
1472 Parser.initialize();
1477 opt(
const opt &) =
delete;
1478 opt &operator=(
const opt &) =
delete;
1486 this->setValue(Val);
1488 return this->getValue();
1491 template <
class... Mods>
1492 explicit opt(
const Mods &... Ms)
1499 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1503 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1504 [](
const typename ParserClass::parser_data_type &) {};
1530 return O.
error(
"cl::location(x) specified more than once!");
1536 assert(Location != 0 &&
"cl::location(...) not specified for a command " 1537 "line option with external storage!");
1538 Location->push_back(V);
1551 std::vector<DataType> Storage;
1554 using iterator =
typename std::vector<DataType>::iterator;
1564 using size_type =
typename std::vector<DataType>::size_type;
1568 bool empty()
const {
return Storage.empty(); }
1573 using reference =
typename std::vector<DataType>::reference;
1585 return Storage.erase(first, last);
1590 return Storage.erase(first, last);
1594 return Storage.insert(pos, value);
1597 return Storage.insert(pos, value);
1601 return Storage.insert(pos, value);
1604 return Storage.insert(pos, value);
1610 operator std::vector<DataType>&() {
return Storage; }
1613 const std::vector<DataType> *
operator&()
const {
return &Storage; }
1615 template <
class T>
void addValue(
const T &V) { Storage.push_back(V); }
1624 std::vector<unsigned> Positions;
1627 enum ValueExpected getValueExpectedFlagDefault()
const override {
1628 return Parser.getValueExpectedFlagDefault();
1632 return Parser.getExtraOptionNames(OptionNames);
1635 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1637 typename ParserClass::parser_data_type Val =
1638 typename ParserClass::parser_data_type();
1639 if (Parser.parse(*
this, ArgName, Arg, Val))
1643 Positions.push_back(pos);
1649 size_t getOptionWidth()
const override {
1650 return Parser.getOptionWidth(*
this);
1653 void printOptionInfo(
size_t GlobalWidth)
const override {
1654 Parser.printOptionInfo(*
this, GlobalWidth);
1658 void printOptionValue(
size_t ,
bool )
const override {
1661 void setDefault()
override {
1668 Parser.initialize();
1674 list &operator=(
const list &) =
delete;
1679 assert(optnum < this->
size() &&
"Invalid option index");
1680 return Positions[optnum];
1685 template <
class... Mods>
1693 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1697 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1698 [](
const typename ParserClass::parser_data_type &) {};
1706 template <
typename D,
typename S,
typename P>
1720 unsigned *Location =
nullptr;
1722 template <
class T>
static unsigned Bit(
const T &V) {
1723 unsigned BitPos =
reinterpret_cast<unsigned>(V);
1724 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1725 "enum exceeds width of bit vector!");
1734 return O.
error(
"cl::location(x) specified more than once!");
1740 assert(Location != 0 &&
"cl::location(...) not specified for a command " 1741 "line option with external storage!");
1742 *Location |=
Bit(V);
1747 template <
class T>
bool isSet(
const T &V) {
1748 return (*Location &
Bit(V)) != 0;
1758 template <
class T>
static unsigned Bit(
const T &V) {
1760 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1761 "enum exceeds width of bit vector!");
1770 template <
class T>
bool isSet(
const T &V) {
return (Bits &
Bit(V)) != 0; }
1779 std::vector<unsigned> Positions;
1782 enum ValueExpected getValueExpectedFlagDefault()
const override {
1783 return Parser.getValueExpectedFlagDefault();
1787 return Parser.getExtraOptionNames(OptionNames);
1790 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1792 typename ParserClass::parser_data_type Val =
1793 typename ParserClass::parser_data_type();
1794 if (Parser.parse(*
this, ArgName, Arg, Val))
1796 this->addValue(Val);
1798 Positions.push_back(pos);
1804 size_t getOptionWidth()
const override {
1805 return Parser.getOptionWidth(*
this);
1808 void printOptionInfo(
size_t GlobalWidth)
const override {
1809 Parser.printOptionInfo(*
this, GlobalWidth);
1813 void printOptionValue(
size_t ,
bool )
const override {
1816 void setDefault()
override {}
1820 Parser.initialize();
1826 bits &operator=(
const bits &) =
delete;
1831 assert(optnum < this->
size() &&
"Invalid option index");
1832 return Positions[optnum];
1835 template <
class... Mods>
1843 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1847 std::function<void(const typename ParserClass::parser_data_type &)> Callback =
1848 [](
const typename ParserClass::parser_data_type &) {};
1858 bool handleOccurrence(
unsigned pos,
StringRef ,
1860 return AliasFor->handleOccurrence(pos, AliasFor->
ArgStr, Arg);
1864 bool MultiArg =
false)
override {
1869 size_t getOptionWidth()
const override;
1870 void printOptionInfo(
size_t GlobalWidth)
const override;
1873 void printOptionValue(
size_t ,
bool )
const override {
1876 void setDefault()
override { AliasFor->
setDefault(); }
1878 ValueExpected getValueExpectedFlagDefault()
const override {
1884 error(
"cl::alias must have argument name specified!");
1886 error(
"cl::alias must have an cl::aliasopt(option) specified!");
1888 error(
"cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1889 Subs = AliasFor->
Subs;
1901 error(
"cl::alias must only have one cl::aliasopt(...) specified!");
1905 template <
class... Mods>
2014 bool MarkEOLs =
false);
2029 bool MarkEOLs =
false);
2048 bool MarkEOLs =
false);
2086 bool RelativeNames =
false,
2128 #endif // LLVM_SUPPORT_COMMANDLINE_H iterator erase(const_iterator pos)
void addValue(const T &V)
const_reference front() const
bool isPositional() const
void setValue(const T &V, bool initial=false)
SmallVector< OptionInfo, 8 > Values
void print(const Option &O, const parser< DT > &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
ParserClass & getParser()
void ResetCommandLineParser()
Reset the command line parser back to its initial state.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
enum ValueExpected getValueExpectedFlag() const
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
OptionValue< std::string > & operator=(const std::string &V)
typename std::tuple_element< 0, std::tuple< Args... > >::type arg_type
OptionCategory GeneralCategory
OptionValue< cl::boolOrDefault > & operator=(const cl::boolOrDefault &V)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
IntrusiveRefCntPtr< FileSystem > getRealFileSystem()
Gets an vfs::FileSystem for the 'real' file system, as seen by the operating system.
void push_back(const DataType &value)
bool parse(Option &, StringRef, StringRef Arg, char &Value)
This class represents lattice values for constants.
const GenericOptionValue & getOptionValue(unsigned N) const override
OptionValue(const DataType &V)
void apply(Option &O) const
bool compare(const DataType &V) const
bool isConsumeAfter() const
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
unsigned getNumOptions() const override
void PrintVersionMessage()
Utility function for printing version number.
void print(const Option &O, const parser< ParserDT > &P, const ValDT &, const OptionValue< ValDT > &, size_t GlobalWidth)
void push_back(const T &Elt)
void apply(Option &O) const
DataType getValue() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
void setValueStr(StringRef S)
OptionValue< DataType > Default
void setValue(const T &V, bool initial=false)
void ResetAllOptionOccurrences()
Reset all command line options to a state that looks as if they have never appeared on the command li...
StringRef getValueName() const override
void tokenizeConfigFile(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char *> &NewArgv, bool MarkEOLs=false)
Tokenizes content of configuration file.
iterator insert(iterator pos, const DataType &value)
void addValue(const T &V)
const OptionValue< DataType > & getDefault() const
APInt operator &(APInt a, const APInt &b)
void ParseEnvironmentOptions(const char *progName, const char *envvar, const char *Overview="")
ParseEnvironmentOptions - An alternative entry point to the CommandLine library, which allows you to ...
block Block Frequency true
SmallVector< Option *, 4 > SinkOpts
COFF::SymbolStorageClass StorageClass
GenericOptionInfo(StringRef name, StringRef helpStr)
bool compare(const GenericOptionValue &V) const override
StringRef getValueName() const override
static void opt(OptionHidden OH, Option &O)
StringMap< Option * > & getRegisteredOptions(SubCommand &Sub= *TopLevelSubCommand)
Use this to get a StringMap to all registered named options (e.g.
bool readConfigFile(StringRef CfgFileName, StringSaver &Saver, SmallVectorImpl< const char *> &Argv)
Reads command line options from the given configuration file.
bool compare(const DataType &) const
bool parse(Option &, StringRef, StringRef Arg, std::string &Value)
StringRef getValueName() const override
bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
Option(enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
void getExtraOptionNames(SmallVectorImpl< StringRef > &OptionNames)
StringRef getValueName() const override
unsigned getPosition(unsigned optnum) const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
void setNumAdditionalVals(unsigned n)
OptionValue< DataType > WrapperType
ParserClass & getParser()
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char *> &Argv, bool MarkEOLs=false, bool RelativeNames=false, llvm::vfs::FileSystem &FS= *llvm::vfs::getRealFileSystem(), llvm::Optional< llvm::StringRef > CurrentDir=llvm::None)
Expand response files on a command line recursively using the given StringSaver and tokenization stra...
void apply(Opt *O, const Mod &M, const Mods &... Ms)
void push_back(DataType &&value)
OptionValue< DataType > V
StringRef getValueName() const override
void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char *> &NewArgv, bool MarkEOLs=false)
Tokenizes a Windows command line which may contain quotes and escaped quotes.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Position
Position to insert a new instruction relative to an existing instruction.
void getExtraOptionNames(SmallVectorImpl< StringRef > &)
StringRef getDescription() const
virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false)
static void opt(StringRef Str, Opt &O)
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
OptionValue(const cl::boolOrDefault &V)
StringRef getValueName() const override
std::function< void(raw_ostream &)> VersionPrinterTy
SmallVector< Option *, 4 > PositionalOpts
StringRef getValueName() const override
StringRef getValueName() const override
iterator erase(iterator first, iterator last)
StringRef getValueName() const override
typename std::vector< DataType >::size_type size_type
StringRef getValueName() const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
LLVM_NODISCARD size_t size() const
size - Get the string size.
iterator insert(iterator pos, DataType &&value)
StringRef getName() const
DataType operator->() const
ParserClass & getParser()
reference operator[](size_type pos)
ManagedStatic< SubCommand > AllSubCommands
bool setLocation(Option &O, DataType &L)
StringMap< Option * > OptionsMap
void HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub= *TopLevelSubCommand)
Mark all options not part of this category as cl::ReallyHidden.
static void opt(const Mod &M, Opt &O)
const DataType & getValue() const
const DataType & getValue() const
initializer< Ty > init(const Ty &Val)
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V)
void setNumOccurrencesFlag(enum NumOccurrencesFlag Val)
SubCommand(StringRef Name, StringRef Description="")
unsigned getNumAdditionalVals() const
void PrintHelpMessage(bool Hidden=false, bool Categorized=false)
This function just prints the help message, exactly the same way as if the -help or -help-hidden opti...
value_desc(StringRef Str)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
typename std::vector< DataType >::iterator iterator
bool setLocation(Option &O, StorageClass &L)
int getNumOccurrences() const
void setHiddenFlag(enum OptionHidden Val)
typename std::vector< DataType >::reference reference
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
const OptionValue< DataType > & getDefault() const
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
void SetVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// SetVersionPrinter - Over...
StringRef getDescription() const
void addValue(const T &V)
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
void setPosition(unsigned pos)
bool isInAllSubCommands() const
void setValue(const DataType &V)
PassInfo class - An instance of this class exists for every pass known by the system, and can be obtained from a live Pass by calling its getPassInfo() method.
iterator erase(const_iterator CI)
Value(Type *Ty, unsigned scid)
iterator insert(const_iterator pos, DataType &&value)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool setLocation(Option &O, unsigned &L)
void removeLiteralOption(StringRef Name)
removeLiteralOption - Remove the specified option.
const_iterator end() const
generic_parser_base(Option &O)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
void setFormattingFlag(enum FormattingFlags V)
bool isDefaultOption() const
OptionValue(const std::string &V)
virtual ~basic_parser_impl()
void setInitialValue(const DataType &V)
void setValueExpectedFlag(enum ValueExpected Val)
void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char *> &NewArgv, bool MarkEOLs=false)
Tokenizes a command line that can contain escapes and quotes.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const DataType & getValue() const
void apply(list< D, S, P > &L) const
void setDescription(StringRef S)
StringRef getValueName() const override
The virtual file system interface.
basic_parser_impl(Option &)
void setValue(const T &V, bool initial=false)
unsigned getPosition() const
bool error(const Twine &Message, raw_ostream &Errs)
CHAIN = SC CHAIN, Imm128 - System call.
void setAliasFor(Option &O)
OptionInfo(StringRef name, DataType v, StringRef helpStr)
void setNumAdditionalVals(unsigned n)
virtual void setDefault()=0
bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i)
Parses Arg into the option handler Handler.
void printOptionDiff(const Option &O, const AnyOptionValue &V, const AnyOptionValue &Default, size_t GlobalWidth) const
The access may modify the value stored in memory.
A range adaptor for a pair of iterators.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
const DataType & getValue() const
SmallPtrSet< SubCommand *, 1 > Subs
const_iterator begin() const
void AddLiteralOption(Option &O, StringRef Name)
Adds a new option for parsing and provides the option it refers to.
void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr)
addLiteralOption - Add an entry to the mapping table.
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
ValuesClass(std::initializer_list< OptionEnumValue > Options)
static void opt(StringRef Str, Opt &O)
iterator erase(const_iterator first, const_iterator last)
Defines the virtual file system interface vfs::FileSystem.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer...
StringRef getValueName() const override
void(*)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) TokenizerCallback
String tokenization function type.
static void opt(MiscFlags MF, Option &O)
virtual void getExtraOptionNames(SmallVectorImpl< StringRef > &)
void setMiscFlag(enum MiscFlags M)
OptionCategory(StringRef const Name, StringRef const Description="")
static void opt(ValueExpected VE, Option &O)
bool error(const Twine &Message, StringRef ArgName=StringRef(), raw_ostream &Errs=llvm::errs())
void setValue(const DT &)
bool compare(const GenericOptionValue &) const override
DataType & operator=(const T &Val)
iterator erase(iterator pos)
iterator insert(const_iterator pos, const DataType &value)
typename std::vector< DataType >::const_iterator const_iterator
typename std::vector< DataType >::const_reference const_reference
int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)
Compare two scaled numbers.
const_reference operator[](size_type pos) const
static void opt(NumOccurrencesFlag N, Option &O)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const OptionValue< DataType > & getDefault() const
LLVM Value Representation.
StringRef getOption(unsigned N) const override
void AddExtraVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// AddExtraVersionPrinter -...
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > callback(F CB)
StringRef getDescription(unsigned N) const override
OptionValue< DataType > & operator=(const DT &V)
ManagedStatic< SubCommand > TopLevelSubCommand
This class implements an extremely fast bulk output stream that can only output to a stream...
void addSubCommand(SubCommand &S)
print Print MemDeps of function
unsigned getMiscFlags() const
StringRef - Represent a constant reference to a string, i.e.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)
SmallVector< OptionCategory *, 1 > Categories
static void opt(StringRef Str, Opt &O)
iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > getRegisteredSubcommands()
Use this to get all registered SubCommands from the provided parser.
void addValue(const T &V)
void apply(alias &A) const
OptionValue< DataType > Default
LocationClass< Ty > location(Ty &L)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
StringRef getName() const
cb(std::function< R(Ty)> CB)
alias(const Mods &... Ms)
initializer(const Ty &Val)
virtual StringRef getValueName() const
unsigned getPosition(unsigned optnum) const
OptionCategory & Category