LLVM  3.7.0
Public Member Functions | List of all members
llvm::opt::Arg Class Reference

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 OptiongetOption () const
 
StringRef getSpelling () const
 
unsigned getIndex () const
 
const ArggetBaseArg () const
 Return the base argument which generated this arg. More...
 
void setBaseArg (const Arg *BaseArg)
 
bool getOwnsValues () const
 
void setOwnsValues (bool Value) const
 
bool isClaimed () const
 
void claim () const
 Set the Arg claimed bit. More...
 
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
 
void render (const ArgList &Args, ArgStringList &Output) const
 Append the argument onto the given array as strings. More...
 
void renderAsInput (const ArgList &Args, ArgStringList &Output) const
 Append the argument, render as an input, onto the given array as strings. More...
 
void dump () const
 
std::string getAsString (const ArgList &Args) const
 Return a formatted version of the argument and its values, for debugging and diagnostics. More...
 

Detailed Description

A concrete instance of a particular driver option.

The Arg class encodes just enough information to be able to derive the argument values efficiently.

Definition at line 31 of file Arg.h.

Constructor & Destructor Documentation

Arg::Arg ( const Option  Opt,
StringRef  Spelling,
unsigned  Index,
const Arg BaseArg = nullptr 
)

Definition at line 20 of file Arg.cpp.

Arg::Arg ( const Option  Opt,
StringRef  Spelling,
unsigned  Index,
const char *  Value0,
const Arg BaseArg = nullptr 
)
Arg::Arg ( const Option  Opt,
StringRef  Spelling,
unsigned  Index,
const char *  Value0,
const char *  Value1,
const Arg BaseArg = nullptr 
)
Arg::~Arg ( )

Definition at line 39 of file Arg.cpp.

References llvm::SmallVectorTemplateCommon< T, typename >::size().

Member Function Documentation

void llvm::opt::Arg::claim ( ) const
inline
bool llvm::opt::Arg::containsValue ( StringRef  Value) const
inline

Definition at line 99 of file Arg.h.

References getNumValues().

void Arg::dump ( ) const
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 63 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

Definition at line 72 of file Arg.h.

Referenced by render().

unsigned llvm::opt::Arg::getNumValues ( ) const
inline

Definition at line 91 of file Arg.h.

References llvm::SmallVectorTemplateCommon< T, typename >::size().

Referenced by containsValue(), and render().

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

Definition at line 83 of file Arg.h.

StringRef llvm::opt::Arg::getSpelling ( ) const
inline

Definition at line 71 of file Arg.h.

Referenced by render().

const char* llvm::opt::Arg::getValue ( unsigned  N = 0) const
inline

Definition at line 92 of file Arg.h.

References N.

Referenced by llvm::opt::ArgList::AddAllArgsTranslated(), and render().

SmallVectorImpl<const char *>& llvm::opt::Arg::getValues ( )
inline

Definition at line 96 of file Arg.h.

Referenced by llvm::opt::Option::accept(), and llvm::opt::ArgList::AddAllArgValues().

const SmallVectorImpl<const char *>& llvm::opt::Arg::getValues ( ) const
inline

Definition at line 97 of file Arg.h.

bool llvm::opt::Arg::isClaimed ( ) const
inline

Definition at line 86 of file Arg.h.

References getBaseArg().

void Arg::render ( const ArgList Args,
ArgStringList Output 
) const
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 79 of file Arg.cpp.

References llvm::SmallVectorImpl< T >::append(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), getOption(), and render().

void llvm::opt::Arg::setBaseArg ( const Arg BaseArg)
inline

Definition at line 81 of file Arg.h.

void llvm::opt::Arg::setOwnsValues ( bool  Value) const
inline

Definition at line 84 of file Arg.h.

Referenced by llvm::opt::Option::accept().


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