LLVM API Documentation
A concrete instance of a particular driver option. More...
#include <Arg.h>
Public Member Functions | |
Arg (const Option Opt, StringRef Spelling, unsigned Index, const Arg *BaseArg=nullptr) | |
Arg (const Option Opt, StringRef Spelling, unsigned Index, const char *Value0, const Arg *BaseArg=nullptr) | |
Arg (const Option Opt, StringRef Spelling, unsigned Index, const char *Value0, const char *Value1, const Arg *BaseArg=nullptr) | |
~Arg () | |
const Option & | getOption () const |
StringRef | getSpelling () const |
unsigned | getIndex () const |
const Arg & | getBaseArg () const |
Return the base argument which generated this arg. | |
void | setBaseArg (const Arg *_BaseArg) |
bool | getOwnsValues () const |
void | setOwnsValues (bool Value) const |
bool | isClaimed () const |
void | claim () const |
Set the Arg claimed bit. | |
unsigned | getNumValues () const |
const char * | getValue (unsigned N=0) const |
SmallVectorImpl< const char * > & | getValues () |
bool | containsValue (StringRef Value) const |
void | render (const ArgList &Args, ArgStringList &Output) const |
Append the argument onto the given array as strings. | |
void | renderAsInput (const ArgList &Args, ArgStringList &Output) const |
Append the argument, render as an input, onto the given array as strings. | |
void | dump () const |
std::string | getAsString (const ArgList &Args) const |
Return a formatted version of the argument and its values, for debugging and 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 25 of file Arg.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Arg::Arg | ( | const Option | Opt, |
StringRef | Spelling, | ||
unsigned | Index, | ||
const char * | Value0, | ||
const char * | Value1, | ||
const Arg * | BaseArg = nullptr |
||
) |
Definition at line 32 of file Arg.cpp.
References llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
Arg::~Arg | ( | ) |
Definition at line 40 of file Arg.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::size().
void llvm::opt::Arg::claim | ( | ) | const [inline] |
Set the Arg claimed bit.
Definition at line 91 of file Arg.h.
References getBaseArg().
Referenced by llvm::opt::ArgList::AddAllArgs(), llvm::opt::ArgList::AddAllArgsTranslated(), llvm::opt::ArgList::AddAllArgValues(), llvm::opt::ArgList::ClaimAllArgs(), and llvm::opt::ArgList::getLastArg().
bool llvm::opt::Arg::containsValue | ( | StringRef | Value | ) | const [inline] |
Definition at line 102 of file Arg.h.
References getNumValues().
void Arg::dump | ( | ) | const |
Definition at line 47 of file Arg.cpp.
References llvm::opt::Option::dump(), llvm::errs(), and llvm::SmallVectorTemplateCommon< T, typename >::size().
std::string Arg::getAsString | ( | const ArgList & | Args | ) | const |
Return a formatted version of the argument and its values, for debugging and diagnostics.
Definition at line 64 of file Arg.cpp.
References llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), render(), and llvm::raw_svector_ostream::str().
const Arg& llvm::opt::Arg::getBaseArg | ( | ) | const [inline] |
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 78 of file Arg.h.
Referenced by claim(), and isClaimed().
unsigned llvm::opt::Arg::getIndex | ( | ) | const [inline] |
unsigned llvm::opt::Arg::getNumValues | ( | ) | const [inline] |
Definition at line 93 of file Arg.h.
References llvm::SmallVectorTemplateCommon< T, typename >::size().
Referenced by llvm::opt::ArgList::AddAllArgValues(), containsValue(), render(), and renderAsInput().
const Option& llvm::opt::Arg::getOption | ( | ) | const [inline] |
Definition at line 70 of file Arg.h.
Referenced by llvm::opt::ArgList::eraseArg(), render(), and renderAsInput().
bool llvm::opt::Arg::getOwnsValues | ( | ) | const [inline] |
StringRef llvm::opt::Arg::getSpelling | ( | ) | const [inline] |
const char* llvm::opt::Arg::getValue | ( | unsigned | N = 0 | ) | const [inline] |
Definition at line 94 of file Arg.h.
References N.
Referenced by llvm::opt::ArgList::AddAllArgsTranslated(), llvm::opt::ArgList::AddAllArgValues(), render(), and renderAsInput().
SmallVectorImpl<const char*>& llvm::opt::Arg::getValues | ( | ) | [inline] |
Definition at line 98 of file Arg.h.
Referenced by llvm::opt::Option::accept().
bool llvm::opt::Arg::isClaimed | ( | ) | const [inline] |
Definition at line 88 of file Arg.h.
References getBaseArg().
void Arg::render | ( | const ArgList & | Args, |
ArgStringList & | Output | ||
) | const |
Append the argument onto the given array as strings.
Definition at line 90 of file Arg.cpp.
References getIndex(), getNumValues(), getOption(), llvm::opt::ArgList::GetOrMakeJoinedArgString(), getSpelling(), getValue(), llvm::opt::ArgList::MakeArgString(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::opt::Option::RenderCommaJoinedStyle, llvm::opt::Option::RenderJoinedStyle, llvm::opt::Option::RenderSeparateStyle, llvm::opt::Option::RenderValuesStyle, and llvm::raw_svector_ostream::str().
Referenced by llvm::opt::ArgList::AddAllArgs(), 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 getNumValues(), getOption(), getValue(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), and render().
void llvm::opt::Arg::setBaseArg | ( | const Arg * | _BaseArg | ) | [inline] |
void llvm::opt::Arg::setOwnsValues | ( | bool | Value | ) | const [inline] |
Definition at line 86 of file Arg.h.
Referenced by llvm::opt::Option::accept().