clang API Documentation

Classes | Public Member Functions | Protected Member Functions
clang::driver::OptTable Class Reference

#include <OptTable.h>

List of all members.

Classes

struct  Info
 Info - Entry for a single option instance in the option data table. More...

Public Member Functions

 ~OptTable ()
unsigned getNumOptions () const
 getNumOptions - Return the total number of option classes.
const OptiongetOption (OptSpecifier Opt) const
const char * getOptionName (OptSpecifier id) const
 getOptionName - Lookup the name of the given option.
unsigned getOptionKind (OptSpecifier id) const
 getOptionKind - Get the kind of the given option.
unsigned getOptionGroupID (OptSpecifier id) const
 getOptionGroupID - Get the group id for the given option.
bool isOptionHelpHidden (OptSpecifier id) const
const char * getOptionHelpText (OptSpecifier id) const
 getOptionHelpText - Get the help text to use to describe this option.
const char * getOptionMetaVar (OptSpecifier id) const
ArgParseOneArg (const ArgList &Args, unsigned &Index) const
InputArgListParseArgs (const char *const *ArgBegin, const char *const *ArgEnd, unsigned &MissingArgIndex, unsigned &MissingArgCount) const
void PrintHelp (raw_ostream &OS, const char *Name, const char *Title, bool ShowHidden=false) const

Protected Member Functions

 OptTable (const Info *_OptionInfos, unsigned _NumOptionInfos)

Detailed Description

OptTable - Provide access to the Option info table.

The OptTable class provides a layer of indirection which allows Option instance to be created lazily. In the common case, only a few options will be needed at runtime; the OptTable class maintains enough information to parse command lines without instantiating Options, while letting other parts of the driver still use Option instances where convenient.

Definition at line 44 of file OptTable.h.


Constructor & Destructor Documentation

OptTable::OptTable ( const Info _OptionInfos,
unsigned  _NumOptionInfos 
) [protected]
OptTable::~OptTable ( )

Definition at line 126 of file OptTable.cpp.

References getNumOptions().


Member Function Documentation

unsigned clang::driver::OptTable::getNumOptions ( ) const [inline]

getNumOptions - Return the total number of option classes.

Definition at line 91 of file OptTable.h.

Referenced by OptTable(), ParseOneArg(), PrintHelp(), and ~OptTable().

const Option* clang::driver::OptTable::getOption ( OptSpecifier  Opt) const [inline]

getOption - Get the given

  • id's Option instance, lazily creating it if necessary.
Returns:
The option, or null for the INVALID option id.

Definition at line 97 of file OptTable.h.

References clang::driver::OptSpecifier::getID().

Referenced by OptTable(), and ParseOneArg().

unsigned clang::driver::OptTable::getOptionGroupID ( OptSpecifier  id) const [inline]

getOptionGroupID - Get the group id for the given option.

Definition at line 120 of file OptTable.h.

References getInfo().

Referenced by getOptionHelpGroup().

const char* clang::driver::OptTable::getOptionHelpText ( OptSpecifier  id) const [inline]

getOptionHelpText - Get the help text to use to describe this option.

Definition at line 131 of file OptTable.h.

References getInfo().

Referenced by getOptionHelpGroup(), and PrintHelp().

unsigned clang::driver::OptTable::getOptionKind ( OptSpecifier  id) const [inline]

getOptionKind - Get the kind of the given option.

Definition at line 115 of file OptTable.h.

References getInfo().

Referenced by getOptionHelpName(), and PrintHelp().

const char* clang::driver::OptTable::getOptionMetaVar ( OptSpecifier  id) const [inline]

getOptionMetaVar - Get the meta-variable name to use when describing this options values in the help text.

Definition at line 137 of file OptTable.h.

References getInfo().

Referenced by getOptionHelpName().

const char* clang::driver::OptTable::getOptionName ( OptSpecifier  id) const [inline]

getOptionName - Lookup the name of the given option.

Definition at line 110 of file OptTable.h.

References getInfo(), and TypeInfo::Name.

Referenced by getOptionHelpName().

bool clang::driver::OptTable::isOptionHelpHidden ( OptSpecifier  id) const [inline]

isOptionHelpHidden - Should the help for the given option be hidden by default.

Definition at line 126 of file OptTable.h.

References TypeInfo::Flags, getInfo(), and clang::driver::options::HelpHidden.

Referenced by PrintHelp().

InputArgList * OptTable::ParseArgs ( const char *const *  ArgBegin,
const char *const *  ArgEnd,
unsigned &  MissingArgIndex,
unsigned &  MissingArgCount 
) const

ParseArgs - Parse an list of arguments into an InputArgList.

The resulting InputArgList will reference the strings in [ArgBegin, ArgEnd), and their lifetime should extend past that of the returned InputArgList.

The only error that can occur in this routine is if an argument is missing values; in this case

  • MissingArgCount will be non-zero.
Parameters:
ArgBegin- The beginning of the argument vector.
ArgEnd- The end of the argument vector.
MissingArgIndex- On error, the index of the option which could not be parsed.
MissingArgCount- On error, the number of missing options.
Returns:
- An InputArgList; on error this will contain all the options which could be parsed.

Definition at line 230 of file OptTable.cpp.

References clang::driver::ArgList::append(), Args, clang::driver::InputArgList::getArgString(), Index, and ParseOneArg().

Referenced by clang::driver::Driver::ParseArgStrings().

Arg * OptTable::ParseOneArg ( const ArgList Args,
unsigned &  Index 
) const

ParseOneArg - Parse a single argument; returning the new argument and updating Index.

Parameters:
[in][out]Index - The current parsing position in the argument string list; on return this will be the index of the next argument string to parse.
Returns:
- The parsed argument, or 0 if the argument is missing values (in which case Index still points at the conceptual next argument string to parse).

Definition at line 188 of file OptTable.cpp.

References Arg, clang::driver::ArgList::getArgString(), getNumOptions(), getOption(), Index, and clang::driver::OptTable::Info::Name.

Referenced by clang::driver::Driver::BuildInputs(), and ParseArgs().

void OptTable::PrintHelp ( raw_ostream &  OS,
const char *  Name,
const char *  Title,
bool  ShowHidden = false 
) const

PrintHelp - Render the help text for an option table.

Parameters:
OS- The stream to write the help text to.
Name- The name to use in the usage line.
Title- The title to use in the usage line.
ShowHidden- Whether help-hidden arguments should be shown.

Definition at line 346 of file OptTable.cpp.

References getNumOptions(), getOptionHelpGroup(), getOptionHelpName(), getOptionHelpText(), getOptionKind(), clang::driver::Option::GroupClass, isOptionHelpHidden(), and PrintHelpOptionList().

Referenced by clang::driver::Driver::PrintHelp().


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