Go to the documentation of this file.
19 #ifndef LLVM_SUPPORT_COMMANDLINE_H
20 #define LLVM_SUPPORT_COMMANDLINE_H
39 #include <initializer_list>
41 #include <type_traits>
73 const char *EnvVar =
nullptr,
74 bool LongOptionsUseDoubleDash =
false);
186 void registerCategory();
191 : Name(Name), Description(Description) {
215 : Name(Name), Description(Description) {
222 explicit operator bool()
const;
249 virtual bool handleOccurrence(
unsigned pos,
StringRef ArgName,
252 virtual enum ValueExpected getValueExpectedFlagDefault()
const {
257 virtual void anchor();
333 : NumOccurrences(0), Occurrences(OccurrencesFlag),
Value(0),
335 FullyInitialized(
false), Position(0), AdditionalVals(0) {
372 size_t FirstLineIndentedBy);
380 size_t FirstLineIndentedBy);
387 bool MultiArg =
false);
429 template <
class Opt>
void apply(Opt &
O)
const {
O.setInitialValue(
Init); }
444 template <
class Opt>
void apply(Opt &
O)
const {
O.setLocation(
O,
Loc); }
466 template <
class Opt>
void apply(Opt &
O)
const {
O.addSubCommand(
Sub); }
471 template <
typename R,
typename Ty>
struct cb {
476 template <
typename Opt>
void apply(Opt &
O)
const {
O.setCallback(
CB); }
480 template <
typename F>
483 template <
typename R,
typename C,
typename...
Args>
487 static_assert(
sizeof...(
Args) == 1,
"callback function must have one and only one parameter");
488 static_assert(std::is_same<result_type, void>::value,
489 "callback return type must be void");
490 static_assert(std::is_lvalue_reference<arg_type>::value &&
491 std::is_const<std::remove_reference_t<arg_type>>::value,
492 "callback arg_type must be a const lvalue reference");
496 template <
typename F>
518 virtual void anchor();
525 template <
class DataType,
bool isClass>
537 bool compare(
const DataType & )
const {
return false; }
563 assert(Valid &&
"invalid option value");
572 bool compare(
const DataType &V)
const {
return Valid && (
Value != V); }
584 template <
class DataType>
596 template <
class DataType>
627 void anchor()
override;
644 void anchor()
override;
658 #define clEnumVal(ENUMVAL, DESC) \
659 llvm::cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
660 #define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
661 llvm::cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
676 template <
class Opt>
void apply(Opt &
O)
const {
677 for (
const auto &
Value : Values)
740 size_t GlobalWidth)
const;
746 template <
class AnyOptionValue>
748 const AnyOptionValue &Default,
749 size_t GlobalWidth)
const {
839 return O.error(
"Cannot find option named '" + ArgVal +
"'!");
847 OptionInfo
X(
Name,
static_cast<DataType
>(V), HelpStr);
913 extern template class basic_parser<bool>;
932 size_t GlobalWidth)
const;
935 void anchor()
override;
940 extern template class basic_parser<boolOrDefault>;
957 size_t GlobalWidth)
const;
960 void anchor()
override;
965 extern template class basic_parser<int>;
978 size_t GlobalWidth)
const;
981 void anchor()
override;
986 extern template class basic_parser<long>;
999 size_t GlobalWidth)
const;
1002 void anchor()
override;
1007 extern template class basic_parser<long long>;
1020 size_t GlobalWidth)
const;
1023 void anchor()
override;
1028 extern template class basic_parser<unsigned>;
1041 size_t GlobalWidth)
const;
1044 void anchor()
override;
1049 extern template class basic_parser<unsigned long>;
1063 size_t GlobalWidth)
const;
1066 void anchor()
override;
1071 extern template class basic_parser<unsigned long long>;
1080 unsigned long long &Val);
1086 size_t GlobalWidth)
const;
1089 void anchor()
override;
1094 extern template class basic_parser<double>;
1107 size_t GlobalWidth)
const;
1110 void anchor()
override;
1115 extern template class basic_parser<float>;
1128 size_t GlobalWidth)
const;
1131 void anchor()
override;
1136 extern template class basic_parser<std::string>;
1152 size_t GlobalWidth)
const;
1155 void anchor()
override;
1160 extern template class basic_parser<char>;
1176 size_t GlobalWidth)
const;
1179 void anchor()
override;
1187 template <
class ParserClass,
class DT>
1191 P.printOptionDiff(
O, OV, Default, GlobalWidth);
1199 P.printOptionNoValue(
O, GlobalWidth);
1208 P.printOptionDiff(
O, V, Default, GlobalWidth);
1214 template <
class ParserClass,
class ValDT>
1221 printer.
print(
O,
static_cast<const ParserClass &
>(
P), V, Default,
1232 template <
class Opt>
static void opt(
const Mod &M, Opt &
O) {
M.apply(
O); }
1254 O.setNumOccurrencesFlag(
N);
1273 "cl::Grouping can only apply to single charater Options.");
1279 template <
class Opt,
class Mod,
class... Mods>
1280 void apply(Opt *
O,
const Mod &M,
const Mods &... Ms) {
1285 template <
class Opt,
class Mod>
void apply(Opt *
O,
const Mod &M) {
1294 template <
class DataType,
bool ExternalStorage,
bool isClass>
1296 DataType *Location =
nullptr;
1299 void check_location()
const {
1300 assert(Location &&
"cl::location(...) not specified for a command "
1301 "line option with external storage, "
1302 "or cl::init specified before cl::location()!!");
1310 return O.error(
"cl::location(x) specified more than once!");
1316 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1341 template <
class DataType>
1346 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1347 DataType::operator=(V);
1371 template <
class T>
void setValue(
const T &V,
bool initial =
false) {
1390 template <
class DataType,
bool ExternalStorage =
false,
1391 class ParserClass = parser<DataType>>
1394 std::is_class<DataType>::value> {
1397 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1399 typename ParserClass::parser_data_type Val =
1400 typename ParserClass::parser_data_type();
1401 if (Parser.parse(*
this, ArgName,
Arg, Val))
1409 enum ValueExpected getValueExpectedFlagDefault()
const override {
1410 return Parser.getValueExpectedFlagDefault();
1414 return Parser.getExtraOptionNames(OptionNames);
1418 size_t getOptionWidth()
const override {
1419 return Parser.getOptionWidth(*
this);
1422 void printOptionInfo(
size_t GlobalWidth)
const override {
1423 Parser.printOptionInfo(*
this, GlobalWidth);
1426 void printOptionValue(
size_t GlobalWidth,
bool Force)
const override {
1428 cl::printOptionDiff<ParserClass>(*
this, Parser, this->
getValue(),
1434 class = std::enable_if_t<std::is_assignable<T &, T>::value>>
1435 void setDefaultImpl() {
1444 class = std::enable_if_t<!std::is_assignable<T &, T>::value>>
1445 void setDefaultImpl(...) {}
1447 void setDefault()
override { setDefaultImpl<DataType>(); }
1451 Parser.initialize();
1456 opt(
const opt &) =
delete;
1470 template <
class... Mods>
1471 explicit opt(
const Mods &... Ms)
1478 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1483 [](
const typename ParserClass::parser_data_type &) {};
1486 extern template class opt<unsigned>;
1487 extern template class opt<int>;
1488 extern template class opt<std::string>;
1489 extern template class opt<char>;
1490 extern template class opt<bool>;
1507 return O.error(
"cl::location(x) specified more than once!");
1513 assert(Location !=
nullptr &&
1514 "cl::location(...) not specified for a command "
1515 "line option with external storage!");
1516 Location->push_back(V);
1529 std::vector<DataType> Storage;
1532 using iterator =
typename std::vector<DataType>::iterator;
1542 using size_type =
typename std::vector<DataType>::size_type;
1546 bool empty()
const {
return Storage.empty(); }
1548 void push_back(
const DataType &value) { Storage.push_back(value); }
1549 void push_back(DataType &&value) { Storage.push_back(value); }
1551 using reference =
typename std::vector<DataType>::reference;
1563 return Storage.erase(first,
last);
1568 return Storage.erase(first,
last);
1572 return Storage.insert(pos, value);
1575 return Storage.insert(pos, value);
1579 return Storage.insert(pos, value);
1582 return Storage.insert(pos, value);
1588 operator std::vector<DataType> &() {
return Storage; }
1591 const std::vector<DataType> *
operator&()
const {
return &Storage; }
1593 template <
class T>
void addValue(
const T &V) { Storage.push_back(V); }
1600 class ParserClass = parser<DataType>>
1602 std::vector<unsigned> Positions;
1605 enum ValueExpected getValueExpectedFlagDefault()
const override {
1606 return Parser.getValueExpectedFlagDefault();
1610 return Parser.getExtraOptionNames(OptionNames);
1613 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1615 typename ParserClass::parser_data_type Val =
1616 typename ParserClass::parser_data_type();
1617 if (Parser.parse(*
this, ArgName,
Arg, Val))
1621 Positions.push_back(pos);
1627 size_t getOptionWidth()
const override {
1628 return Parser.getOptionWidth(*
this);
1631 void printOptionInfo(
size_t GlobalWidth)
const override {
1632 Parser.printOptionInfo(*
this, GlobalWidth);
1636 void printOptionValue(
size_t ,
bool )
const override {
1639 void setDefault()
override {
1646 Parser.initialize();
1657 assert(optnum < this->
size() &&
"Invalid option index");
1658 return Positions[optnum];
1663 template <
class... Mods>
1671 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1676 [](
const typename ParserClass::parser_data_type &) {};
1684 template <
typename D,
typename S,
typename P>
1696 unsigned *Location =
nullptr;
1698 template <
class T>
static unsigned Bit(
const T &V) {
1699 unsigned BitPos =
static_cast<unsigned>(V);
1700 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1701 "enum exceeds width of bit vector!");
1710 return O.error(
"cl::location(x) specified more than once!");
1716 assert(Location !=
nullptr &&
1717 "cl::location(...) not specified for a command "
1718 "line option with external storage!");
1719 *Location |= Bit(V);
1729 template <
class T>
bool isSet(
const T &V) {
1730 return (*Location & Bit(V)) != 0;
1740 template <
class T>
static unsigned Bit(
const T &V) {
1741 unsigned BitPos =
static_cast<unsigned>(V);
1742 assert(BitPos <
sizeof(
unsigned) * CHAR_BIT &&
1743 "enum exceeds width of bit vector!");
1754 template <
class T>
bool isSet(
const T &V) {
return (
Bits & Bit(V)) != 0; }
1760 template <
class DataType,
class Storage = bool,
1761 class ParserClass = parser<DataType>>
1763 std::vector<unsigned> Positions;
1766 enum ValueExpected getValueExpectedFlagDefault()
const override {
1767 return Parser.getValueExpectedFlagDefault();
1771 return Parser.getExtraOptionNames(OptionNames);
1774 bool handleOccurrence(
unsigned pos,
StringRef ArgName,
1776 typename ParserClass::parser_data_type Val =
1777 typename ParserClass::parser_data_type();
1778 if (Parser.parse(*
this, ArgName,
Arg, Val))
1782 Positions.push_back(pos);
1788 size_t getOptionWidth()
const override {
1789 return Parser.getOptionWidth(*
this);
1792 void printOptionInfo(
size_t GlobalWidth)
const override {
1793 Parser.printOptionInfo(*
this, GlobalWidth);
1797 void printOptionValue(
size_t ,
bool )
const override {
1804 Parser.initialize();
1815 assert(optnum < this->
size() &&
"Invalid option index");
1816 return Positions[optnum];
1819 template <
class... Mods>
1827 std::function<
void(
const typename ParserClass::parser_data_type &)> CB) {
1832 [](
const typename ParserClass::parser_data_type &) {};
1842 bool handleOccurrence(
unsigned pos,
StringRef ,
1844 return AliasFor->handleOccurrence(pos, AliasFor->
ArgStr,
Arg);
1848 bool MultiArg =
false)
override {
1853 size_t getOptionWidth()
const override;
1854 void printOptionInfo(
size_t GlobalWidth)
const override;
1857 void printOptionValue(
size_t ,
bool )
const override {
1860 void setDefault()
override { AliasFor->
setDefault(); }
1862 ValueExpected getValueExpectedFlagDefault()
const override {
1868 error(
"cl::alias must have argument name specified!");
1870 error(
"cl::alias must have an cl::aliasopt(option) specified!");
1872 error(
"cl::alias must not have cl::sub(), aliased option's cl::sub() will be used!");
1885 error(
"cl::alias must only have one cl::aliasopt(...) specified!");
1889 template <
class... Mods>
1997 bool MarkEOLs =
false);
2015 bool MarkEOLs =
false);
2039 bool MarkEOLs =
false);
2058 bool MarkEOLs =
false);
2098 bool RelativeNames,
bool ExpandBasePath,
2107 bool RelativeNames =
false,
bool ExpandBasePath =
false,
2156 #endif // LLVM_SUPPORT_COMMANDLINE_H
bool readConfigFile(StringRef CfgFileName, StringSaver &Saver, SmallVectorImpl< const char * > &Argv)
Reads command line options from the given configuration file.
void getExtraOptionNames(SmallVectorImpl< StringRef > &)
unsigned getPosition() const
void AddExtraVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Add an extra printer to u...
const OptionValue< DataType > & getDefault() const
bool parse(Option &O, StringRef ArgName, StringRef Arg, DataType &V)
virtual const GenericOptionValue & getOptionValue(unsigned N) const =0
This is an optimization pass for GlobalISel generic memory operations.
iterator erase(iterator first, iterator last)
void print(const Option &O, const parser< DT > &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
StringRef getDescription(unsigned N) const override
StringMap< Option * > OptionsMap
list(const list &)=delete
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
SmallVector< OptionCategory *, 1 > Categories
unsigned getNumOptions() const override
DataType & operator=(const T &Val)
enum ValueExpected getValueExpectedFlagDefault() const
DataType operator->() const
void apply(Option &O) const
OptionCategory & Category
alias(const Mods &... Ms)
typename std::vector< DataType >::reference reference
virtual bool addOccurrence(unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false)
SmallVector< Option *, 4 > PositionalOpts
OptionInfo(StringRef name, DataType v, StringRef helpStr)
LocationClass< Ty > location(Ty &L)
std::vector< DataType > * operator&()
enum OptionHidden getOptionHiddenFlag() const
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
void printOptionNoValue(const Option &O, size_t GlobalWidth) const
void addValue(const T &V)
StringMap< Option * > & getRegisteredOptions(SubCommand &Sub= *TopLevelSubCommand)
Use this to get a StringMap to all registered named options (e.g.
static void opt(StringRef Str, Opt &O)
list & operator=(const list &)=delete
typename std::vector< DataType >::const_iterator const_iterator
ParserClass & getParser()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
iterator insert(const_iterator pos, DataType &&value)
void PrintVersionMessage()
Utility function for printing version number.
void ResetAllOptionOccurrences()
Reset all command line options to a state that looks as if they have never appeared on the command li...
bool error(const Twine &Message, StringRef ArgName=StringRef(), raw_ostream &Errs=llvm::errs())
OptionValue< DataType > WrapperType
typename std::vector< DataType >::size_type size_type
iterator erase(iterator pos)
void ResetCommandLineParser()
Reset the command line parser back to its initial state.
virtual void printOptionInfo(size_t GlobalWidth) const =0
SubCommand(StringRef Name, StringRef Description="")
void printOptionDiff(const Option &O, const generic_parser_base &P, const DT &V, const OptionValue< DT > &Default, size_t GlobalWidth)
cb(std::function< R(Ty)> CB)
bool compare(const GenericOptionValue &V) const override
void addValue(const T &V)
basic_parser_impl(Option &)
PassInfo class - An instance of this class exists for every pass known by the system,...
void setMiscFlag(enum MiscFlags M)
void push_back(DataType &&value)
virtual unsigned getNumOptions() const =0
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
bool expandResponseFiles(int Argc, const char *const *Argv, const char *EnvVar, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv)
A convenience helper which concatenates the options specified by the environment variable EnvVar and ...
void apply(Option &O) const
void unregisterSubCommand()
raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
GenericOptionValue()=default
std::function< void(raw_ostream &)> VersionPrinterTy
StringRef getValueName() const override
unsigned getPosition(unsigned optnum) const
std::tuple_element_t< 0, std::tuple< Args... > > arg_type
const DataType & getValue() const
static void printEnumValHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
iterator erase(const_iterator pos)
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.
OptionValue< cl::boolOrDefault > & operator=(const cl::boolOrDefault &V)
virtual void printOptionInfo(const Option &O, size_t GlobalWidth) const
void setValueExpectedFlag(enum ValueExpected Val)
GenericOptionInfo(StringRef name, StringRef helpStr)
const GenericOptionValue & getOptionValue(unsigned N) const override
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
OptionValue< DataType > & operator=(const DT &V)
void setValue(const DT &)
~GenericOptionValue()=default
void apply(Opt *O, const Mod &M, const Mods &... Ms)
~OptionValueCopy()=default
unsigned findOption(StringRef Name)
void removeLiteralOption(StringRef Name)
Remove the specified option.
const_iterator end() const
bool compare(const DataType &V) const
OptionValueCopy & operator=(const OptionValueCopy &)=default
virtual void getExtraOptionNames(SmallVectorImpl< StringRef > &)
bool compare(const DataType &) const
bits & operator=(const bits &)=delete
StringRef getValueName() const override
(vector float) vec_cmpeq(*A, *B) C
unsigned getMiscFlags() const
void setFormattingFlag(enum FormattingFlags V)
enum FormattingFlags getFormattingFlag() const
bool parse(Option &, StringRef, StringRef Arg, char &Value)
bool ParseCommandLineOptions(int argc, const char *const *argv, StringRef Overview="", raw_ostream *Errs=nullptr, const char *EnvVar=nullptr, bool LongOptionsUseDoubleDash=false)
opt & operator=(const opt &)=delete
ManagedStatic - This transparently changes the behavior of global statics to be lazily constructed on...
bool isConsumeAfter() const
virtual StringRef getOption(unsigned N) const =0
StringRef getValueName() const override
std::function< void(const typename ParserClass::parser_data_type &)> Callback
void getExtraOptionNames(SmallVectorImpl< StringRef > &OptionNames)
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.
void registerSubCommand()
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
This class implements an extremely fast bulk output stream that can only output to a stream.
unsigned getNumAdditionalVals() const
int getNumOccurrences() const
void addValue(const T &V)
void HideUnrelatedOptions(cl::OptionCategory &Category, SubCommand &Sub= *TopLevelSubCommand)
Mark all options not part of this category as cl::ReallyHidden.
const_iterator begin() const
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int c
ManagedStatic< SubCommand > AllSubCommands
void setValueStr(StringRef S)
StringRef getDescription() const
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
StringRef getValueName() const override
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
bool setLocation(Option &O, StorageClass &L)
Value(Type *Ty, unsigned scid)
void setDescription(StringRef S)
bool setLocation(Option &O, DataType &L)
reference operator[](size_type pos)
bool compare(const GenericOptionValue &) const override
StringRef getDescription() const
void printOptionDiff(const Option &O, const AnyOptionValue &V, const AnyOptionValue &Default, size_t GlobalWidth) const
ParserClass & getParser()
static void opt(const Mod &M, Opt &O)
SmallVector< Option *, 4 > SinkOpts
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
enum ValueExpected getValueExpectedFlag() const
StringRef getValueName() const override
void setInitialValue(const DataType &V)
bool parse(Option &, StringRef, StringRef Arg, std::string &Value)
OptionValue(const std::string &V)
const DataType & getValue() const
void print(const Option &O, const parser< ParserDT > &P, const ValDT &, const OptionValue< ValDT > &, size_t GlobalWidth)
OptionValue< std::string > & operator=(const std::string &V)
std::function< void(const typename ParserClass::parser_data_type &)> Callback
StringRef getValueName() const override
void setNumAdditionalVals(unsigned n)
StringRef getValueName() const override
void SetVersionPrinter(VersionPrinterTy func)
===------------------------------------------------------------------—===// Override the default (LLV...
initializer< Ty > init(const Ty &Val)
bool ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, SmallVectorImpl< const char * > &Argv, bool MarkEOLs, bool RelativeNames, bool ExpandBasePath, llvm::Optional< llvm::StringRef > CurrentDir, llvm::vfs::FileSystem &FS)
Expand response files on a command line recursively using the given StringSaver and tokenization stra...
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.
virtual ~basic_parser_impl()=default
bool ProvidePositionalOption(Option *Handler, StringRef Arg, int i)
Parses Arg into the option handler Handler.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void addLiteralOption(StringRef Name, const DT &V, StringRef HelpStr)
Add an entry to the mapping table.
int compare(DigitsT LDigits, int16_t LScale, DigitsT RDigits, int16_t RScale)
Compare two scaled numbers.
void tokenizeConfigFile(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes content of configuration file.
virtual void setDefault()=0
print Print MemDeps of function
unsigned getPosition(unsigned optnum) const
void setArgStr(StringRef S)
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...
const DataType & getValue() const
void printGenericOptionDiff(const Option &O, const GenericOptionValue &V, const GenericOptionValue &Default, size_t GlobalWidth) const
~OptionValueBase()=default
virtual StringRef getValueName() const
bool setLocation(Option &O, unsigned &L)
StringRef getOption(unsigned N) const override
Saves strings in the provided stable storage and returns a StringRef with a stable character pointer.
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 TokenizeWindowsCommandLineNoCopy(StringRef Source, StringSaver &Saver, SmallVectorImpl< StringRef > &NewArgv)
Tokenizes a Windows command line while attempting to avoid copies.
iterator insert(iterator pos, const DataType &value)
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Analysis the ScalarEvolution expression for r is this
iterator insert(iterator pos, DataType &&value)
http eax xorl edx cl sete al setne dl sall cl
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
iterator erase(const_iterator first, const_iterator last)
virtual ~Option()=default
void(*)(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs) TokenizerCallback
String tokenization function type.
static llvm::Error parse(DataExtractor &Data, uint64_t BaseAddr, LineEntryCallback const &Callback)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
static void opt(StringRef Str, Opt &O)
void TokenizeGNUCommandLine(StringRef Source, StringSaver &Saver, SmallVectorImpl< const char * > &NewArgv, bool MarkEOLs=false)
Tokenizes a command line that can contain escapes and quotes.
OptionValue< DataType > V
OptionCategory(StringRef const Name, StringRef const Description="")
StringRef getValueName() const override
virtual size_t getOptionWidth() const =0
value_desc(StringRef Str)
virtual StringRef getDescription(unsigned N) const =0
OptionValue(const cl::boolOrDefault &V)
SmallPtrSet< SubCommand *, 1 > Subs
void setValue(const T &V, bool initial=false)
virtual void printOptionValue(size_t GlobalWidth, bool Force) const =0
void setValue(const DataType &V)
initializer(const Ty &Val)
OptionValue< DataType > Default
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
const OptionValue< DataType > & getDefault() const
ParserClass & getParser()
bool isInAllSubCommands() const
The virtual file system interface.
void AddLiteralOption(Option &O, StringRef Name)
Adds a new option for parsing and provides the option it refers to.
void setCallback(std::function< void(const typename ParserClass::parser_data_type &)> CB)
bool isPositional() const
virtual ~generic_parser_base()=default
size_t getOptionWidth(const Option &O) const
void setAliasFor(Option &O)
StringRef getName() const
GenericOptionValue & operator=(const GenericOptionValue &)=default
SmallVector< OptionInfo, 8 > Values
void apply(list< D, S, P > &L) const
static void printHelpStr(StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
static void opt(StringRef Str, Opt &O)
void setNumOccurrencesFlag(enum NumOccurrencesFlag Val)
void setNumAdditionalVals(unsigned n)
void printOptionName(const Option &O, size_t GlobalWidth) const
const DataType & getValue() const
DataType getValue() const
typename std::vector< DataType >::iterator iterator
void addSubCommand(SubCommand &S)
void setPosition(unsigned pos)
void apply(alias &A) const
static void opt(OptionHidden OH, Option &O)
StringRef getValueName() const override
OptionValueCopy()=default
StringRef getValueName() const override
StringRef getValueName() const override
enum NumOccurrencesFlag getNumOccurrencesFlag() const
const_reference front() const
generic_parser_base(Option &O)
virtual size_t getOptionWidth(const Option &O) const
A range adaptor for a pair of iterators.
ManagedStatic< SubCommand > TopLevelSubCommand
iterator insert(const_iterator pos, const DataType &value)
static void opt(ValueExpected VE, Option &O)
const std::vector< DataType > * operator&() const
void addCategory(OptionCategory &C)
cb< typename detail::callback_traits< F >::result_type, typename detail::callback_traits< F >::arg_type > callback(F CB)
Option(enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
virtual bool compare(const GenericOptionValue &V) const =0
enum ValueExpected getValueExpectedFlagDefault() const
bool isDefaultOption() const
const_reference operator[](size_type pos) const
ValuesClass(std::initializer_list< OptionEnumValue > Options)
The same transformation can work with an even modulo with the addition of a and shrink the compare RHS by the same amount Unless the target supports that transformation probably isn t worthwhile The transformation can also easily be made to work with non zero equality for n
void addValue(const T &V)
static void opt(NumOccurrencesFlag N, Option &O)
void removeArgument()
Unregisters this option from the CommandLine system.
OptionCategory & getGeneralCategory()
OptionValue(const DataType &V)
alias & operator=(const alias &)=delete
void push_back(const DataType &value)
const OptionValue< DataType > & getDefault() const
void printOptionInfo(const Option &O, size_t GlobalWidth) const
std::function< void(const typename ParserClass::parser_data_type &)> Callback
LLVM Value Representation.
bits(const bits &)=delete
bool error(const Twine &Message, raw_ostream &Errs)
typename std::vector< DataType >::const_reference const_reference
iterator_range< typename SmallPtrSet< SubCommand *, 4 >::iterator > getRegisteredSubcommands()
Use this to get all registered SubCommands from the provided parser.
static void opt(MiscFlags MF, Option &O)
StringRef getName() const
void setValue(const T &V, bool initial=false)
OptionValue< DataType > Default
void setValue(const T &V, bool initial=false)
StringRef getValueName() const override
void setHiddenFlag(enum OptionHidden Val)