LLVM: llvm::opt::ArgList Class Reference (original) (raw)

ArgList - Ordered collection of driver arguments. More...

#include "[llvm/Option/ArgList.h](ArgList%5F8h%5Fsource.html)"

Public Types
using arglist_type = SmallVector<Arg *, 16>
using iterator = arg_iterator<arglist_type::iterator>
using const_iterator = arg_iterator<arglist_type::const_iterator>
using reverse_iterator = arg_iterator<arglist_type::reverse_iterator>
using const_reverse_iterator
template<unsigned N>
using filtered_iterator
template<unsigned N>
using filtered_reverse_iterator
Public Member Functions
Arg Access
LLVM_ABI void append (Arg *A)
append - Append A to the arg list.
const arglist_type & getArgs () const
unsigned size () const
template<typename ... OptSpecifiers>
bool hasArgNoClaim (OptSpecifiers ...Ids) const
hasArg - Does the arg list contain any option matching Id.
template<typename ... OptSpecifiers>
bool hasArg (OptSpecifiers ...Ids) const
bool hasMultipleArgs (OptSpecifier Id) const
Return true if the arg list contains multiple arguments matching Id.
template<typename... OptSpecifiers>
LLVM_ATTRIBUTE_NOINLINE Arg * getLastArg (OptSpecifiers... Ids) const
Return the last argument matching Id, or null.
template<typename... OptSpecifiers>
LLVM_ATTRIBUTE_NOINLINE Arg * getLastArgNoClaim (OptSpecifiers... Ids) const
Return the last argument matching Id, or null.
virtual const char * getArgString (unsigned Index) const =0
getArgString - Return the input argument string at Index.
virtual unsigned getNumInputArgStrings () const =0
getNumInputArgStrings - Return the number of original argument strings, which are guaranteed to be the first strings in the argument string list.
LLVM_ABI_FOR_TEST StringRef getSubCommand (ArrayRef< OptTable::SubCommand > AllSubCommands, std::function< void(ArrayRef< StringRef >)> HandleMultipleSubcommands, std::function< void(ArrayRef< StringRef >)> HandleOtherPositionals) const
getSubCommand - Find subcommand from the arguments if the usage is valid.
Arg Iteration
iterator begin ()
iterator end ()
reverse_iterator rbegin ()
reverse_iterator rend ()
const_iterator begin () const
const_iterator end () const
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
template<typename ... OptSpecifiers>
iterator_range< filtered_iterator< sizeof...(OptSpecifiers)> > filtered (OptSpecifiers ...Ids) const
template<typename ... OptSpecifiers>
iterator_range< filtered_reverse_iterator< sizeof...(OptSpecifiers)> > filtered_reverse (OptSpecifiers ...Ids) const
Arg Removal
LLVM_ABI void eraseArg (OptSpecifier Id)
eraseArg - Remove any option matching Id.
Argument Lookup Utilities
LLVM_ABI StringRef getLastArgValue (OptSpecifier Id, StringRef Default="") const
getLastArgValue - Return the value of the last argument, or a default.
LLVM_ABI std::vector< std::string > getAllArgValues (OptSpecifier Id) const
getAllArgValues - Get the values of all instances of the given argument as strings.
Translation Utilities
LLVM_ABI bool hasFlag (OptSpecifier Pos, OptSpecifier Neg, bool Default) const
hasFlag - Given an option Pos and its negative form Neg, return true if the option is present, false if the negation is present, and Default if neither option is given.
LLVM_ABI bool hasFlagNoClaim (OptSpecifier Pos, OptSpecifier Neg, bool Default) const
LLVM_ABI bool hasFlag (OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg, bool Default) const
hasFlag - Given an option Pos, an alias PosAlias and its negative form Neg, return true if the option or its alias is present, false if the negation is present, and Default if none of the options are given.
LLVM_ABI void addOptInFlag (ArgStringList &Output, OptSpecifier Pos, OptSpecifier Neg) const
Given an option Pos and its negative form Neg, render the option if Pos is present.
void addOptOutFlag (ArgStringList &Output, OptSpecifier Pos, OptSpecifier Neg) const
Render the option if Neg is present.
template<typename... OptSpecifiers>
void addLastArg (ArgStringList &Output, OptSpecifiers... Ids) const
Render only the last argument match Id0, if present.
template<typename... OptSpecifiers>
void AddLastArg (ArgStringList &Output, OptSpecifiers... Ids) const
LLVM_ABI void AddAllArgsExcept (ArgStringList &Output, ArrayRef< OptSpecifier > Ids, ArrayRef< OptSpecifier > ExcludeIds) const
AddAllArgsExcept - Render all arguments matching any of the given ids and not matching any of the excluded ids.
LLVM_ABI void addAllArgs (ArgStringList &Output, ArrayRef< OptSpecifier > Ids) const
Render all arguments matching any of the given ids.
LLVM_ABI void AddAllArgs (ArgStringList &Output, OptSpecifier Id0) const
AddAllArgs - Render all arguments matching the given ids.
LLVM_ABI void AddAllArgValues (ArgStringList &Output, OptSpecifier Id0, OptSpecifier Id1=0U, OptSpecifier Id2=0U) const
AddAllArgValues - Render the argument values of all arguments matching the given ids.
LLVM_ABI void AddAllArgsTranslated (ArgStringList &Output, OptSpecifier Id0, const char *Translation, bool Joined=false) const
AddAllArgsTranslated - Render all the arguments matching the given ids, but forced to separate args and using the provided name instead of the first option value.
LLVM_ABI void ClaimAllArgs (OptSpecifier Id0) const
ClaimAllArgs - Claim all arguments which match the given option id.
template<typename... OptSpecifiers>
void claimAllArgs (OptSpecifiers... Ids) const
LLVM_ABI void ClaimAllArgs () const
ClaimAllArgs - Claim all arguments.
Arg Synthesis
virtual const char * MakeArgStringRef (StringRef Str) const =0
Construct a constant string pointer whose lifetime will match that of the ArgList.
const char * MakeArgString (const Twine &Str) const
LLVM_ABI const char * GetOrMakeJoinedArgString (unsigned Index, StringRef LHS, StringRef RHS) const
Create an arg string for (LHS + RHS), reusing the string at Index if possible.
LLVM_ABI void print (raw_ostream &O) const
LLVM_ABI void dump () const

ArgList - Ordered collection of driver arguments.

The ArgList class manages a list of Arg instances as well as auxiliary data and convenience methods to allow Tools to quickly check for the presence of Arg instances for a particular Option and to iterate over groups of arguments.

Definition at line 118 of file ArgList.h.

arglist_type

const_iterator

const_reverse_iterator

Initial value:

arg_iterator - Iterates through arguments stored inside an ArgList.

Definition at line 124 of file ArgList.h.

filtered_iterator

filtered_reverse_iterator

iterator

reverse_iterator

ArgList() [1/2]

llvm::opt::ArgList::ArgList ( ) protecteddefault

ArgList() [2/2]

llvm::opt::ArgList::ArgList ( ArgList && RHS) inlineprotected
llvm::opt::ArgList::~ArgList ( ) protecteddefault

AddAllArgs()

addAllArgs()

Render all arguments matching any of the given ids.

This is a nicer interface when you don't have a list of Ids to exclude.

Definition at line 135 of file ArgList.cpp.

References AddAllArgsExcept().

AddAllArgsExcept()

AddAllArgsTranslated()

AddAllArgValues()

AddLastArg()

template<typename... OptSpecifiers>

void llvm::opt::ArgList::AddLastArg ( ArgStringList & Output, OptSpecifiers... Ids ) const inline

addLastArg()

template<typename... OptSpecifiers>

void llvm::opt::ArgList::addLastArg ( ArgStringList & Output, OptSpecifiers... Ids ) const inline

addOptInFlag()

addOptOutFlag()

append()

void ArgList::append ( Arg * A )

begin() [1/2]

iterator llvm::opt::ArgList::begin ( ) inline

begin() [2/2]

const_iterator llvm::opt::ArgList::begin ( ) const inline

ClaimAllArgs() [1/2]

void ArgList::ClaimAllArgs ( ) const

ClaimAllArgs() [2/2]

claimAllArgs()

template<typename... OptSpecifiers>

void llvm::opt::ArgList::claimAllArgs ( OptSpecifiers... Ids) const inline

dump()

end() [1/2]

iterator llvm::opt::ArgList::end ( ) inline

end() [2/2]

const_iterator llvm::opt::ArgList::end ( ) const inline

eraseArg()

filtered()

template<typename ... OptSpecifiers>

iterator_range< filtered_iterator< sizeof...(OptSpecifiers)> > llvm::opt::ArgList::filtered ( OptSpecifiers ... Ids) const inline

Definition at line 207 of file ArgList.h.

References B(), E(), llvm::make_range(), Range, and toOptSpecifier().

Referenced by AddAllArgs(), AddAllArgsTranslated(), AddAllArgValues(), ClaimAllArgs(), claimAllArgs(), eraseArg(), getLastArg(), and hasMultipleArgs().

filtered_reverse()

template<typename ... OptSpecifiers>

iterator_range< filtered_reverse_iterator< sizeof...(OptSpecifiers)> > llvm::opt::ArgList::filtered_reverse ( OptSpecifiers ... Ids) const inline

getAllArgValues()

std::vector< std::string > ArgList::getAllArgValues ( OptSpecifier Id ) const

getArgs()

const arglist_type & llvm::opt::ArgList::getArgs ( ) const inline

getArgString()

virtual const char * llvm::opt::ArgList::getArgString ( unsigned Index) const pure virtual

getLastArg()

template<typename... OptSpecifiers>

getLastArgNoClaim()

template<typename... OptSpecifiers>

getLastArgValue()

getNumInputArgStrings()

virtual unsigned llvm::opt::ArgList::getNumInputArgStrings ( ) const pure virtual

GetOrMakeJoinedArgString()

getSubCommand()

getSubCommand - Find subcommand from the arguments if the usage is valid.

Parameters

AllSubCommands - A list of all valid subcommands.
HandleMultipleSubcommands - A callback for the case where multiple subcommands are present in the arguments. It gets a list of all found subcommands.
HandleOtherPositionals - A callback for the case where positional arguments that are not subcommands are present.

Returns

The name of the subcommand found. If no subcommand is found, this returns an empty StringRef. If multiple subcommands are found, the first one is returned.

Definition at line 206 of file ArgList.cpp.

References A(), AllSubCommands, llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::opt::Option::InputClass, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorTemplateCommon< T, typename >::size().

hasArg()

template<typename ... OptSpecifiers>

bool llvm::opt::ArgList::hasArg ( OptSpecifiers ... Ids) const inline

hasArgNoClaim()

template<typename ... OptSpecifiers>

bool llvm::opt::ArgList::hasArgNoClaim ( OptSpecifiers ... Ids) const inline

hasArg - Does the arg list contain any option matching Id.

Claim Whether the argument should be claimed, if it exists.

Definition at line 242 of file ArgList.h.

References getLastArgNoClaim().

hasFlag() [1/2]

hasFlag - Given an option Pos and its negative form Neg, return true if the option is present, false if the negation is present, and Default if neither option is given.

If both the option and its negation are present, the last one wins.

Definition at line 72 of file ArgList.cpp.

References A(), llvm::Default, and getLastArg().

hasFlag() [2/2]

hasFlag - Given an option Pos, an alias PosAlias and its negative form Neg, return true if the option or its alias is present, false if the negation is present, and Default if none of the options are given.

If multiple options are present, the last one wins.

Definition at line 85 of file ArgList.cpp.

References A(), llvm::Default, and getLastArg().

hasFlagNoClaim()

hasMultipleArgs()

Return true if the arg list contains multiple arguments matching Id.

Definition at line 251 of file ArgList.h.

References filtered().

MakeArgString()

MakeArgStringRef()

virtual const char * llvm::opt::ArgList::MakeArgStringRef ( StringRef Str) const pure virtual

operator=()

ArgList & llvm::opt::ArgList::operator= ( ArgList && RHS) inlineprotected

print()

rbegin() [1/2]

reverse_iterator llvm::opt::ArgList::rbegin ( ) inline

rbegin() [2/2]

const_reverse_iterator llvm::opt::ArgList::rbegin ( ) const inline

rend() [1/2]

reverse_iterator llvm::opt::ArgList::rend ( ) inline

rend() [2/2]

const_reverse_iterator llvm::opt::ArgList::rend ( ) const inline

size()

unsigned llvm::opt::ArgList::size ( ) const inline

toOptSpecifier()


The documentation for this class was generated from the following files: