LLVM 22.0.0git
|
A concrete instance of a particular driver option. More...
#include "llvm/Option/Arg.h"
Public Member Functions | |
LLVM_ABI | Arg (const Option Opt, StringRef Spelling, unsigned Index, const Arg *BaseArg=nullptr) |
LLVM_ABI | Arg (const Option Opt, StringRef Spelling, unsigned Index, const char *Value0, const Arg *BaseArg=nullptr) |
LLVM_ABI | Arg (const Option Opt, StringRef Spelling, unsigned Index, const char *Value0, const char *Value1, const Arg *BaseArg=nullptr) |
Arg (const Arg &)=delete | |
Arg & | operator= (const Arg &)=delete |
LLVM_ABI | ~Arg () |
const Option & | getOption () const |
StringRef | getSpelling () const |
Returns the used prefix and name of the option: For --foo=bar , returns --foo= . | |
unsigned | getIndex () const |
const Arg & | getBaseArg () const |
Return the base argument which generated this arg. | |
Arg & | getBaseArg () |
void | setBaseArg (const Arg *BaseArg) |
const Arg * | getAlias () const |
Args are converted to their unaliased form. | |
void | setAlias (std::unique_ptr< Arg > Alias) |
bool | getOwnsValues () const |
void | setOwnsValues (bool Value) const |
bool | isClaimed () const |
void | claim () const |
bool | isIgnoredTargetSpecific () const |
void | ignoreTargetSpecific () |
unsigned | getNumValues () const |
const char * | getValue (unsigned N=0) const |
SmallVectorImpl< const char * > & | getValues () |
const SmallVectorImpl< const char * > & | getValues () const |
bool | containsValue (StringRef Value) const |
LLVM_ABI void | render (const ArgList &Args, ArgStringList &Output) const |
Append the argument onto the given array as strings. | |
LLVM_ABI void | renderAsInput (const ArgList &Args, ArgStringList &Output) const |
Append the argument, render as an input, onto the given array as strings. | |
LLVM_ABI void | print (raw_ostream &O) const |
LLVM_ABI void | dump () const |
LLVM_ABI std::string | getAsString (const ArgList &Args) const |
Return a formatted version of the argument and its values, for diagnostics. | |
A concrete instance of a particular driver option.
The Arg class encodes just enough information to be able to derive the argument values efficiently.
Arg::Arg | ( | const Option | Opt, |
StringRef | Spelling, | ||
unsigned | Index, | ||
const char * | Value0, | ||
const Arg * | BaseArg = nullptr |
||
) |
Definition at line 26 of file Arg.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
Arg::Arg | ( | const Option | Opt, |
StringRef | Spelling, | ||
unsigned | Index, | ||
const char * | Value0, | ||
const char * | Value1, | ||
const Arg * | BaseArg = nullptr |
||
) |
Definition at line 33 of file Arg.cpp.
References llvm::SmallVectorTemplateBase< T, bool >::push_back().
|
inline |
Definition at line 116 of file Arg.h.
References getBaseArg().
Referenced by llvm::opt::ArgList::AddAllArgs(), llvm::opt::ArgList::AddAllArgsExcept(), llvm::opt::ArgList::AddAllArgsTranslated(), llvm::opt::ArgList::AddAllArgValues(), llvm::opt::ArgList::ClaimAllArgs(), and llvm::opt::ArgList::getLastArg().
Definition at line 134 of file Arg.h.
References llvm::is_contained().
LLVM_DUMP_METHOD void Arg::dump | ( | ) | const |
Definition at line 64 of file Arg.cpp.
References llvm::dbgs(), and print().
Return a formatted version of the argument and its values, for diagnostics.
Since this is for diagnostics, if this Arg was produced through an alias, this returns the string representation of the alias that the user wrote.
Definition at line 67 of file Arg.cpp.
References llvm::interleaved(), OS, and render().
Referenced by llvm::dlltoolDriverMain(), and llvm::libDriverMain().
Return the base argument which generated this arg.
This is either the argument itself or the argument it was derived from during tool chain specific argument translation.
Definition at line 101 of file Arg.h.
Referenced by claim(), ignoreTargetSpecific(), isClaimed(), and isIgnoredTargetSpecific().
|
inline |
|
inline |
Definition at line 125 of file Arg.h.
References llvm::SmallVectorBase< Size_T >::size().
Definition at line 85 of file Arg.h.
Referenced by llvm::opt::ArgList::AddAllArgsExcept(), render(), and renderAsInput().
|
inline |
Definition at line 112 of file Arg.h.
Referenced by llvm::opt::Option::accept().
|
inline |
Returns the used prefix and name of the option: For --foo=bar
, returns --foo=
.
This is often the wrong function to call:
getValue()
to get bar
.getAsString()
to get a string suitable for printing an Arg in a diagnostic. Definition at line 93 of file Arg.h.
Referenced by render().
Definition at line 127 of file Arg.h.
References N.
Referenced by llvm::opt::ArgList::AddAllArgsTranslated(), llvm::dlltoolDriverMain(), doList(), getSearchPaths(), llvm::libDriverMain(), and render().
|
inline |
Definition at line 131 of file Arg.h.
Referenced by llvm::opt::Option::accept(), llvm::opt::ArgList::AddAllArgValues(), and render().
|
inline |
|
inline |
Definition at line 121 of file Arg.h.
References getBaseArg().
|
inline |
Definition at line 115 of file Arg.h.
References getBaseArg().
Referenced by llvm::opt::ArgList::ClaimAllArgs().
|
inline |
Definition at line 118 of file Arg.h.
References getBaseArg().
void Arg::print | ( | raw_ostream & | O | ) | const |
Definition at line 48 of file Arg.cpp.
References llvm::opt::Option::print(), and llvm::SmallVectorBase< Size_T >::size().
Referenced by dump().
void Arg::render | ( | const ArgList & | Args, |
ArgStringList & | Output | ||
) | const |
Append the argument onto the given array as strings.
Definition at line 89 of file Arg.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getIndex(), getOption(), getSpelling(), getValue(), getValues(), llvm::interleaved(), OS, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::opt::Option::RenderCommaJoinedStyle, llvm::opt::Option::RenderJoinedStyle, llvm::opt::Option::RenderSeparateStyle, and llvm::opt::Option::RenderValuesStyle.
Referenced by llvm::opt::ArgList::AddAllArgs(), llvm::opt::ArgList::AddAllArgsExcept(), getAsString(), and renderAsInput().
void Arg::renderAsInput | ( | const ArgList & | Args, |
ArgStringList & | Output | ||
) | const |
Append the argument, render as an input, onto the given array as strings.
The distinction is that some options only render their values when rendered as a input (e.g., Xlinker).
Definition at line 80 of file Arg.cpp.
References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getOption(), and render().
|
inline |
|
inline |
Definition at line 113 of file Arg.h.
Referenced by llvm::opt::Option::accept().