19#ifndef LLVM_SUPPORT_COMMANDLINE_H
20#define LLVM_SUPPORT_COMMANDLINE_H
38#include <initializer_list>
72 const char *EnvVar =
nullptr,
73 bool LongOptionsUseDoubleDash =
false);
185 void registerCategory();
190 : Name(Name), Description(Description) {
214 : Name(Name), Description(Description) {
228 explicit operator bool()
const;
264 virtual bool handleOccurrence(
unsigned pos,
StringRef ArgName,
267 virtual enum ValueExpected getValueExpectedFlagDefault()
const {
272 virtual void anchor();
344 : NumOccurrences(0), Occurrences(OccurrencesFlag),
Value(0),
346 FullyInitialized(
false), Position(0), AdditionalVals(0) {
383 size_t FirstLineIndentedBy);
391 size_t FirstLineIndentedBy);
398 bool MultiArg =
false);
440 template <
class Opt>
void apply(Opt &O)
const { O.setInitialValue(
Init); }
447 template <
class Opt>
void apply(Opt &O)
const { O.setInitialValues(
Inits); }
467 template <
class Opt>
void apply(Opt &O)
const { O.setLocation(O,
Loc); }
491 template <
class Opt>
void apply(Opt &O)
const {
493 O.addSubCommand(*
Sub);
496 O.addSubCommand(*SC);
502template <
typename R,
typename Ty>
struct cb {
503 std::function<R(Ty)>
CB;
507 template <
typename Opt>
void apply(Opt &O)
const { O.setCallback(
CB); }
514template <
typename R,
typename C,
typename... Args>
517 using arg_type = std::tuple_element_t<0, std::tuple<Args...>>;
518 static_assert(
sizeof...(Args) == 1,
"callback function must have one and only one parameter");
519 static_assert(std::is_same_v<result_type, void>,
520 "callback return type must be void");
521 static_assert(std::is_lvalue_reference_v<arg_type> &&
522 std::is_const_v<std::remove_reference_t<arg_type>>,
523 "callback arg_type must be a const lvalue reference");
549 virtual void anchor();
556template <
class DataType,
bool isClass>
569 bool compare(
const DataType & )
const {
return false; }
595 assert(Valid &&
"invalid option value");
605 bool compare(
const DataType &V)
const {
return Valid && (
Value == V); }
617template <
class DataType>
629template <
class DataType>
660 void anchor()
override;
677 void anchor()
override;
691#define clEnumVal(ENUMVAL, DESC) \
692 llvm::cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
693#define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
694 llvm::cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
709 template <
class Opt>
void apply(Opt &O)
const {
710 for (
const auto &
Value : Values)
773 size_t GlobalWidth)
const;
779 template <
class AnyOptionValue>
782 size_t GlobalWidth)
const {
866 for (
size_t i = 0, e =
Values.size(); i != e; ++i)
868 V =
Values[i].V.getValue();
872 return O.error(
"Cannot find option named '" + ArgVal +
"'!");
949extern template class basic_parser<bool>;
968 size_t GlobalWidth)
const;
993 size_t GlobalWidth)
const;
1014 size_t GlobalWidth)
const;
1035 size_t GlobalWidth)
const;
1056 size_t GlobalWidth)
const;
1077 size_t GlobalWidth)
const;
1099 size_t GlobalWidth)
const;
1116 unsigned long long &Val);
1122 size_t GlobalWidth)
const;
1143 size_t GlobalWidth)
const;
1164 size_t GlobalWidth)
const;
1188 size_t GlobalWidth)
const;
1212 size_t GlobalWidth)
const;
1223template <
class ParserClass,
class DT>
1227 P.printOptionDiff(O, OV,
Default, GlobalWidth);
1235 P.printOptionNoValue(O, GlobalWidth);
1244 P.printOptionDiff(O, V,
Default, GlobalWidth);
1250template <
class ParserClass,
class ValDT>
1268 template <
class Opt>
static void opt(
const Mod &M, Opt &O) { M.apply(O); }
1290 O.setNumOccurrencesFlag(
N);
1309 "cl::Grouping can only apply to single character Options.");
1315template <
class Opt,
class Mod,
class... Mods>
1321template <
class Opt,
class Mod>
void apply(Opt *O,
const Mod &M) {
1330template <
class DataType,
bool ExternalStorage,
bool isClass>
1332 DataType *Location =
nullptr;
1335 void check_location()
const {
1336 assert(Location &&
"cl::location(...) not specified for a command "
1337 "line option with external storage, "
1338 "or cl::init specified before cl::location()!!");
1346 return O.error(
"cl::location(x) specified more than once!");
1352 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1377template <
class DataType>
1382 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1383 DataType::operator=(V);
1407 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1426template <
class DataType,
bool ExternalStorage =
false,
1427 class ParserClass = parser<DataType>>
1430 public opt_storage<DataType, ExternalStorage, std::is_class_v<DataType>> {
1433 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1435 typename ParserClass::parser_data_type Val =
1436 typename ParserClass::parser_data_type();
1437 if (Parser.parse(*
this, ArgName, Arg, Val))
1445 enum ValueExpected getValueExpectedFlagDefault()
const override {
1446 return Parser.getValueExpectedFlagDefault();
1450 return Parser.getExtraOptionNames(OptionNames);
1454 size_t getOptionWidth()
const override {
1455 return Parser.getOptionWidth(*
this);
1458 void printOptionInfo(
size_t GlobalWidth)
const override {
1459 Parser.printOptionInfo(*
this, GlobalWidth);
1462 void printOptionValue(
size_t GlobalWidth,
bool Force)
const override {
1464 cl::printOptionDiff<ParserClass>(*
this, Parser, this->
getValue(),
1469 template <
class T,
class = std::enable_if_t<std::is_assignable_v<T &, T>>>
1470 void setDefaultImpl() {
1478 template <
class T,
class = std::enable_if_t<!std::is_assignable_v<T &, T>>>
1479 void setDefaultImpl(...) {}
1481 void setDefault()
override { setDefaultImpl<DataType>(); }
1485 Parser.initialize();
1504 template <
class... Mods>
1505 explicit opt(
const Mods &... Ms)
1512 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1516 std::function<void(
const typename ParserClass::parser_data_type &)>
Callback =
1517 [](
const typename ParserClass::parser_data_type &) {};
1520extern template class opt<unsigned>;
1521extern template class opt<int>;
1522extern template class opt<std::string>;
1523extern template class opt<char>;
1524extern template class opt<bool>;
1533 std::vector<OptionValue<DataType>>
Default =
1534 std::vector<OptionValue<DataType>>();
1535 bool DefaultAssigned =
false;
1544 return O.error(
"cl::location(x) specified more than once!");
1549 template <
class T>
void addValue(
const T &V,
bool initial =
false) {
1550 assert(Location !=
nullptr &&
1551 "cl::location(...) not specified for a command "
1552 "line option with external storage!");
1553 Location->push_back(V);
1576 std::vector<DataType> Storage;
1577 std::vector<OptionValue<DataType>> Default;
1578 bool DefaultAssigned =
false;
1581 using iterator =
typename std::vector<DataType>::iterator;
1591 using size_type =
typename std::vector<DataType>::size_type;
1595 bool empty()
const {
return Storage.empty(); }
1600 using reference =
typename std::vector<DataType>::reference;
1612 return Storage.erase(first, last);
1617 return Storage.erase(first, last);
1621 return Storage.insert(pos,
value);
1624 return Storage.insert(pos,
value);
1628 return Storage.insert(pos,
value);
1631 return Storage.insert(pos,
value);
1637 operator std::vector<DataType> &() {
return Storage; }
1640 const std::vector<DataType> *
operator&()
const {
return &Storage; }
1642 template <
class T>
void addValue(
const T &V,
bool initial =
false) {
1643 Storage.push_back(V);
1661 class ParserClass = parser<DataType>>
1663 std::vector<unsigned> Positions;
1666 enum ValueExpected getValueExpectedFlagDefault()
const override {
1667 return Parser.getValueExpectedFlagDefault();
1671 return Parser.getExtraOptionNames(OptionNames);
1674 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1676 typename ParserClass::parser_data_type Val =
1677 typename ParserClass::parser_data_type();
1682 if (Parser.parse(*
this, ArgName, Arg, Val))
1686 Positions.push_back(pos);
1692 size_t getOptionWidth()
const override {
1693 return Parser.getOptionWidth(*
this);
1696 void printOptionInfo(
size_t GlobalWidth)
const override {
1697 Parser.printOptionInfo(*
this, GlobalWidth);
1701 void printOptionValue(
size_t ,
bool )
const override {
1704 void setDefault()
override {
1713 Parser.initialize();
1724 assert(optnum < this->
size() &&
"Invalid option index");
1725 return Positions[optnum];
1736 "Cannot have two default values");
1738 for (
auto &Val : Vs)
1744 template <
class... Mods>
1752 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1756 std::function<void(
const typename ParserClass::parser_data_type &)>
Callback =
1757 [](
const typename ParserClass::parser_data_type &) {};
1765 template <
typename D,
typename S,
typename P>
1777 unsigned *Location =
nullptr;
1779 template <
class T>
static unsigned Bit(
const T &V) {
1780 unsigned BitPos =
static_cast<unsigned>(V);
1781 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1782 "enum exceeds width of bit vector!");
1791 return O.error(
"cl::location(x) specified more than once!");
1797 assert(Location !=
nullptr &&
1798 "cl::location(...) not specified for a command "
1799 "line option with external storage!");
1800 *Location |= Bit(V);
1811 return (*Location & Bit(V)) != 0;
1821 template <
class T>
static unsigned Bit(
const T &V) {
1822 unsigned BitPos =
static_cast<unsigned>(V);
1823 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1824 "enum exceeds width of bit vector!");
1829 template <
class T>
void addValue(
const T &V) { Bits |= Bit(V); }
1835 template <
class T>
bool isSet(
const T &V) {
return (Bits & Bit(V)) != 0; }
1841template <
class DataType,
class Storage =
bool,
1842 class ParserClass = parser<DataType>>
1844 std::vector<unsigned> Positions;
1847 enum ValueExpected getValueExpectedFlagDefault()
const override {
1848 return Parser.getValueExpectedFlagDefault();
1852 return Parser.getExtraOptionNames(OptionNames);
1855 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1857 typename ParserClass::parser_data_type Val =
1858 typename ParserClass::parser_data_type();
1859 if (Parser.parse(*
this, ArgName, Arg, Val))
1863 Positions.push_back(pos);
1869 size_t getOptionWidth()
const override {
1870 return Parser.getOptionWidth(*
this);
1873 void printOptionInfo(
size_t GlobalWidth)
const override {
1874 Parser.printOptionInfo(*
this, GlobalWidth);
1878 void printOptionValue(
size_t ,
bool )
const override {
1885 Parser.initialize();
1896 assert(optnum < this->
size() &&
"Invalid option index");
1897 return Positions[optnum];
1900 template <
class... Mods>
1908 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1912 std::function<void(
const typename ParserClass::parser_data_type &)>
Callback =
1913 [](
const typename ParserClass::parser_data_type &) {};
1923 bool handleOccurrence(
unsigned pos,
StringRef ,
1925 return AliasFor->handleOccurrence(pos, AliasFor->
ArgStr, Arg);
1929 bool MultiArg =
false)
override {
1934 size_t getOptionWidth()
const override;
1935 void printOptionInfo(
size_t GlobalWidth)
const override;
1938 void printOptionValue(
size_t ,
bool )
const override {
1941 void setDefault()
override { AliasFor->
setDefault(); }
1943 ValueExpected getValueExpectedFlagDefault()
const override {
1949 error(
"cl::alias must have argument name specified!");
1951 error(
"cl::alias must have an cl::aliasopt(option) specified!");
1953 error(
"cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1966 error(
"cl::alias must only have one cl::aliasopt(...) specified!");
1970 template <
class... Mods>
2089 bool MarkEOLs =
false);
2107 bool MarkEOLs =
false);
2131 bool MarkEOLs =
false);
2150 bool MarkEOLs =
false);
2172 bool RelativeNames =
false;
2176 bool MarkEOLs =
false;
2179 bool InConfigFile =
false;
This file defines the StringMap class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Given that RA is a live value
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Allocate memory in an ever growing pool, as if by bump-pointer.
Lightweight error class with error context and mandatory checking.
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
std::string str() const
str - Get the contents as an std::string.
constexpr bool empty() const
empty - Check if the string is empty.
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
LLVM Value Representation.
Value(Type *Ty, unsigned scid)
Contains options that control response file expansion.
ExpansionContext & setCurrentDir(StringRef X)
ExpansionContext & setVFS(vfs::FileSystem *X)
ExpansionContext & setMarkEOLs(bool X)
ExpansionContext & setSearchDirs(ArrayRef< StringRef > X)
ExpansionContext & setRelativeNames(bool X)
bool findConfigFile(StringRef FileName, SmallVectorImpl< char > &FilePath)
Looks for the specified configuration file.
Error expandResponseFiles(SmallVectorImpl< const char * > &Argv)
Expands constructs "@file" in the provided array of arguments recursively.
Error readConfigFile(StringRef CfgFile, SmallVectorImpl< const char * > &Argv)
Reads command line options from the given configuration file.
OptionCategory(StringRef const Name, StringRef const Description="")
StringRef getDescription() const
StringRef getName() const
OptionValueCopy & operator=(const OptionValueCopy &)=default
OptionValueCopy()=default
bool compare(const GenericOptionValue &V) const override
void setValue(const DataType &V)
~OptionValueCopy()=default
const DataType & getValue() const
OptionValueCopy(const OptionValueCopy &)=default
bool compare(const DataType &V) const
bool isPositional() const
virtual void getExtraOptionNames(SmallVectorImpl< StringRef > &)
void setValueExpectedFlag(enum ValueExpected Val)
void setPosition(unsigned pos)
bool isConsumeAfter() const
SmallPtrSet< SubCommand *, 1 > Subs
int getNumOccurrences() const
enum ValueExpected getValueExpectedFlag() const
void addCategory(OptionCategory &C)
void setValueStr(StringRef S)
void setNumOccurrencesFlag(enum NumOccurrencesFlag Val)
void setNumAdditionalVals(unsigned n)
virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false)
void setDescription(StringRef S)
void setFormattingFlag(enum FormattingFlags V)
void setHiddenFlag(enum OptionHidden Val)
void setMiscFlag(enum MiscFlags M)
enum FormattingFlags getFormattingFlag() const
virtual void printOptionInfo(size_t GlobalWidth) const =0
enum NumOccurrencesFlag getNumOccurrencesFlag() const
SmallVector< OptionCategory *, 1 > Categories
void addSubCommand(SubCommand &S)
void setArgStr(StringRef S)
bool isDefaultOption() const
unsigned getMiscFlags() const
virtual void setDefault()=0
virtual void printOptionValue(size_t GlobalWidth, bool Force) const =0
virtual ~Option()=default
static void printEnumValHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
unsigned getNumAdditionalVals() const
void removeArgument()
Unregisters this option from the CommandLine system.
Option(enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
enum OptionHidden getOptionHiddenFlag() const
bool error(const Twine &Message, raw_ostream &Errs)
static void printHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
virtual size_t getOptionWidth() const =0
unsigned getPosition() const
SubCommandGroup(std::initializer_list< SubCommand * > IL)
ArrayRef< SubCommand * > getSubCommands() const
StringRef getName() const
SubCommand(StringRef Name, StringRef Description="")
SmallVector< Option *, 4 > SinkOpts
static SubCommand & getTopLevel()
void unregisterSubCommand()
static SubCommand & getAll()
void registerSubCommand()
SmallVector< Option *, 4 > PositionalOpts
StringMap< Option * > OptionsMap
StringRef getDescription() const
ValuesClass(std::initializer_list< OptionEnumValue > Options)
alias(const alias &)=delete
void setAliasFor(Option &O)
alias & operator=(const alias &)=delete
alias(const Mods &... Ms)
void printOptionInfo(const Option &O, size_t GlobalWidth) const
enum ValueExpected getValueExpectedFlagDefault() const
void getExtraOptionNames(SmallVectorImpl< StringRef > &)
virtual StringRef getValueName() const
virtual ~basic_parser_impl()=default
void printOptionNoValue(const Option &O, size_t GlobalWidth) const
basic_parser_impl(Option &)
size_t getOptionWidth(const Option &O) const
void printOptionName(const Option &O, size_t GlobalWidth) const
OptionValue< DataType > OptVal
DataType parser_data_type
void addValue(const T &V)
void addValue(const T &V)
bool setLocation(Option &O, unsigned &L)
bits & operator=(const bits &)=delete
ParserClass & getParser()
unsigned getPosition(unsigned optnum) const
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
std::function< void(const typename ParserClass::parser_data_type &)> Callback
bits(const bits &)=delete
GenericOptionInfo(StringRef name, StringRef helpStr)
virtual size_t getOptionWidth(const Option &O) const
generic_parser_base(Option &O)
virtual StringRef getDescription(unsigned N) const =0
virtual const GenericOptionValue & getOptionValue(unsigned N) const =0
virtual unsigned getNumOptions() const =0
virtual StringRef getOption(unsigned N) const =0
void printOptionDiff(const Option &O, const AnyOptionValue &V, const AnyOptionValue &Default, size_t GlobalWidth) const
void printGenericOptionDiff(const Option &O, const GenericOptionValue &V, const GenericOptionValue &Default, size_t GlobalWidth) const
virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const
unsigned findOption(StringRef Name)
virtual ~generic_parser_base()=default
void getExtraOptionNames(SmallVectorImpl< StringRef > &OptionNames)
enum ValueExpected getValueExpectedFlagDefault() const
void push_back(DataType &&value)
typename std::vector< DataType >::const_iterator const_iterator
typename std::vector< DataType >::const_reference const_reference
const_iterator begin() const
iterator erase(const_iterator first, const_iterator last)
iterator insert(const_iterator pos, const DataType &value)
iterator erase(iterator first, iterator last)
const_reference operator[](size_type pos) const
void addValue(const T &V, bool initial=false)
void push_back(const DataType &value)
typename std::vector< DataType >::reference reference
reference operator[](size_type pos)
const std::vector< DataType > * operator&() const
iterator insert(iterator pos, const DataType &value)
typename std::vector< DataType >::size_type size_type
const_reference front() const
const_iterator end() const
iterator insert(const_iterator pos, DataType &&value)
iterator erase(iterator pos)
std::vector< DataType > * operator&()
const std::vector< OptionValue< DataType > > & getDefault() const
iterator erase(const_iterator pos)
iterator insert(iterator pos, DataType &&value)
typename std::vector< DataType >::iterator iterator
const std::vector< OptionValue< DataType > > & getDefault() const
void addValue(const T &V, bool initial=false)
bool setLocation(Option &O, StorageClass &L)
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
list(const list &)=delete
void setInitialValues(ArrayRef< DataType > Vs)
std::function< void(const typename ParserClass::parser_data_type &)> Callback
list & operator=(const list &)=delete
ParserClass & getParser()
unsigned getPosition(unsigned optnum) const
void setNumAdditionalVals(unsigned n)
OptionValue< DataType > Default
DataType operator->() const
const OptionValue< DataType > & getDefault() const
void setValue(const T &V, bool initial=false)
DataType getValue() const
void setValue(const T &V, bool initial=false)
OptionValue< DataType > Default
const DataType & getValue() const
const OptionValue< DataType > & getDefault() const
const DataType & getValue() const
bool setLocation(Option &O, DataType &L)
void setValue(const T &V, bool initial=false)
const OptionValue< DataType > & getDefault() const
ParserClass & getParser()
opt & operator=(const opt &)=delete
void setInitialValue(const DataType &V)
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
DataType & operator=(const T &Val)
std::function< void(const typename ParserClass::parser_data_type &)> Callback
OptionInfo(StringRef name, DataType v, StringRef helpStr)
OptionValue< DataType > V
bool parse(Option &O, StringRef ArgName, StringRef Arg, boolOrDefault &Val)
void printOptionDiff(const Option &O, boolOrDefault V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
enum ValueExpected getValueExpectedFlagDefault() const
enum ValueExpected getValueExpectedFlagDefault() const
void printOptionDiff(const Option &O, bool V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, bool &Val)
StringRef getValueName() const override
bool parse(Option &, StringRef, StringRef Arg, char &Value)
void printOptionDiff(const Option &O, char V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
void printOptionDiff(const Option &O, double V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
bool parse(Option &O, StringRef ArgName, StringRef Arg, double &Val)
bool parse(Option &O, StringRef ArgName, StringRef Arg, float &Val)
StringRef getValueName() const override
void printOptionDiff(const Option &O, float V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
void printOptionDiff(const Option &O, int V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, int &Val)
StringRef getValueName() const override
bool parse(Option &O, StringRef ArgName, StringRef Arg, long &Val)
void printOptionDiff(const Option &O, long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, long long &Val)
StringRef getValueName() const override
void printOptionDiff(const Option &O, long long V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
void printOptionDiff(const Option &O, StringRef V, const OptVal &Default, size_t GlobalWidth) const
bool parse(Option &, StringRef, StringRef Arg, std::string &Value)
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned &Val)
void printOptionDiff(const Option &O, unsigned V, OptVal Default, size_t GlobalWidth) const
StringRef getValueName() const override
StringRef getValueName() const override
void printOptionDiff(const Option &O, unsigned long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long &Val)
StringRef getValueName() const override
void printOptionDiff(const Option &O, unsigned long long V, OptVal Default, size_t GlobalWidth) const
bool parse(Option &O, StringRef ArgName, StringRef Arg, unsigned long long &Val)
DataType parser_data_type
SmallVector< OptionInfo, 8 > Values
void removeLiteralOption(StringRef Name)
Remove the specified option.
StringRef getDescription(unsigned N) const override
void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr)
Add an entry to the mapping table.
const GenericOptionValue & getOptionValue(unsigned N) const override
StringRef getOption(unsigned N) const override
bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V)
unsigned getNumOptions() const override
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
The virtual file system interface.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
std::function< void(raw_ostream &)> VersionPrinterTy
void(*)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) TokenizerCallback
String tokenization function type.
void PrintVersionMessage()
Utility function for printing version number.
bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv)
A convenience helper which supports the typical use case of expansion function call.
bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, SmallVectorImpl< const char * > &NewArgv)
A convenience helper which concatenates the options specified by the environment variable EnvVar and ...
void TokenizeWindowsCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a string of Windows command line arguments, which may contain quotes and escaped quotes.
list_initializer< Ty > list_init(ArrayRef< Ty > Vals)
OptionCategory & getGeneralCategory()
void ResetAllOptionOccurrences()
Reset all command line options to a state that looks as if they have never appeared on the command li...
void SetVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Override the default (LLV...
void tokenizeConfigFile(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes content of configuration file.
StringMap< Option * > & getRegisteredOptions(SubCommand &Sub=SubCommand::getTopLevel())
Use this to get a StringMap to all registered named options (e.g.
void ResetCommandLineParser()
Reset the command line parser back to its initial state.
bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
ManagedStatic< SubCommand > TopLevelSubCommand
iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > getRegisteredSubcommands()
Use this to get all registered SubCommands from the provided parser.
void apply(Opt *O, const Mod &M, const Mods &... Ms)
void AddLiteralOption(Option &O, StringRef Name)
Adds a new option for parsing and provides the option it refers to.
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
void TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver, SmallVectorImpl< StringRef > &NewArgv)
Tokenizes a Windows command line while attempting to avoid copies.
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
void printBuildConfig(raw_ostream &OS)
Prints the compiler build configuration.
bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i)
Parses Arg into the option handler Handler.
initializer< Ty > init(const Ty &Val)
ManagedStatic< SubCommand > AllSubCommands
ArrayRef< StringRef > getCompilerBuildConfig()
An array of optional enabled settings in the LLVM build configuration, which may be of interest to co...
LocationClass< Ty > location(Ty &L)
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > callback(F CB)
void HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub=SubCommand::getTopLevel())
Mark all options not part of this category as cl::ReallyHidden.
void AddExtraVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Add an extra printer to u...
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...
void TokenizeWindowsCommandLineFull(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a Windows full command line, including command name at the start.
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 an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
@ Mod
The access may modify the value stored in memory.
@ Default
The result values are uniform if and only if all operands are uniform.
Implement std::hash so that hash_code can be used in STL containers.
Description of the encoding of one expression Op.
GenericOptionValue()=default
GenericOptionValue(const GenericOptionValue &)=default
GenericOptionValue & operator=(const GenericOptionValue &)=default
~GenericOptionValue()=default
virtual bool compare(const GenericOptionValue &V) const =0
void print(const Option &O, const parser< DT > &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
void print(const Option &O, const parser< ParserDT > &P, const ValDT &, const OptionValue< ValDT > &, size_t GlobalWidth)
~OptionValueBase()=default
OptionValueBase & operator=(const OptionValueBase &)=default
OptionValueBase(const OptionValueBase &)=default
OptionValueBase()=default
bool compare(const DataType &) const
const DataType & getValue() const
~OptionValueBase()=default
bool compare(const GenericOptionValue &) const override
OptionValue< DataType > WrapperType
void setValue(const DT &)
OptionValue< cl::boolOrDefault > & operator=(const cl::boolOrDefault &V)
OptionValue(const cl::boolOrDefault &V)
OptionValue< std::string > & operator=(const std::string &V)
OptionValue(const std::string &V)
OptionValue(const DataType &V)
OptionValue< DataType > & operator=(const DT &V)
void apply(alias &A) const
static void opt(MiscFlags MF, Option &O)
static void opt(NumOccurrencesFlag N, Option &O)
static void opt(OptionHidden OH, Option &O)
static void opt(StringRef Str, Opt &O)
static void opt(ValueExpected VE, Option &O)
static void opt(StringRef Str, Opt &O)
static void opt(StringRef Str, Opt &O)
static void opt(const Mod &M, Opt &O)
OptionCategory & Category
cb(std::function< R(Ty)> CB)
void apply(Option &O) const
std::tuple_element_t< 0, std::tuple< Args... > > arg_type
initializer(const Ty &Val)
list_initializer(ArrayRef< Ty > Vals)
void apply(list< D, S, P > &L) const
void apply(Option &O) const
value_desc(StringRef Str)