LLVM API Documentation

CommandLine.cpp File Reference

#include "llvm/Config/config.h"
#include "llvm/Support/CommandLine.h"
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <iostream>
#include <cstdlib>
#include <cerrno>
#include <cstring>

Include dependency graph for CommandLine.cpp:

Go to the source code of this file.

Functions

static std::vector< const
char * > & 
MoreHelp ()
static std::map< std::string,
Option * > & 
getOpts ()
static OptiongetOption (const std::string &Str)
static std::vector< Option * > & getPositionalOpts ()
static void AddArgument (const char *ArgName, Option *Opt)
static void RemoveArgument (const char *ArgName, Option *Opt)
static bool ProvideOption (Option *Handler, const char *ArgName, const char *Value, int argc, char **argv, int &i)
static bool ProvidePositionalOption (Option *Handler, const std::string &Arg, int i)
static bool isGrouping (const Option *O)
static bool isPrefixedOrGrouping (const Option *O)
static OptiongetOptionPred (std::string Name, unsigned &Length, bool(*Pred)(const Option *))
static bool RequiresValue (const Option *O)
static bool EatsUnboundedNumberOfValues (const Option *O)
static void ParseCStringVector (std::vector< char * > &output, const char *input)
static OptionLookupOption (const char *&Arg, const char *&Value)
static const char * getValueStr (const Option &O, const char *DefaultMsg)
static bool parseDouble (Option &O, const std::string &Arg, double &Value)
HelpPrinter NormalPrinter (false)
HelpPrinter HiddenPrinter (true)

Variables

static const char * ProgramName = "<unknown>"
static const char * ProgramOverview = 0
cl::opt< HelpPrinter, true,
parser< bool > > 
HOp ("help", cl::desc("Display available options (--help-hidden for more)"), cl::location(NormalPrinter), cl::ValueDisallowed)
cl::opt< HelpPrinter, true,
parser< bool > > 
HHOp ("help-hidden", cl::desc("Display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed)
void(*) OverrideVersionPrinter ()=0
VersionPrinter VersionPrinterInstance
cl::opt< VersionPrinter, true,
parser< bool > > 
VersOp ("version", cl::desc("Display the version of this program"), cl::location(VersionPrinterInstance), cl::ValueDisallowed)


Function Documentation

static void AddArgument ( const char *  ArgName,
Option Opt 
) [static]

Definition at line 70 of file CommandLine.cpp.

References getOption(), getOpts(), and ProgramName.

Referenced by llvm::cl::Option::addArgument().

static bool EatsUnboundedNumberOfValues ( const Option O  )  [static]

Definition at line 180 of file CommandLine.cpp.

References llvm::cl::Option::getNumOccurrencesFlag(), llvm::cl::OneOrMore, and llvm::cl::ZeroOrMore.

Referenced by llvm::cl::ParseCommandLineOptions().

static Option* getOption ( const std::string &  Str  )  [static]

Definition at line 60 of file CommandLine.cpp.

References getOpts().

Referenced by AddArgument(), getOptionPred(), and RemoveArgument().

static Option* getOptionPred ( std::string  Name,
unsigned &  Length,
bool(*)(const Option *)  Pred 
) [static]

Definition at line 149 of file CommandLine.cpp.

References getOption(), and Op.

Referenced by llvm::cl::ParseCommandLineOptions().

static std::map<std::string, Option*>& getOpts (  )  [static]

Definition at line 55 of file CommandLine.cpp.

Referenced by AddArgument(), getOption(), LookupOption(), llvm::cl::ParseCommandLineOptions(), and RemoveArgument().

static std::vector<Option*>& getPositionalOpts (  )  [static]

Definition at line 65 of file CommandLine.cpp.

References llvm::cl::Positional.

Referenced by llvm::cl::Option::addArgument(), llvm::cl::ParseCommandLineOptions(), and llvm::cl::Option::removeArgument().

static const char* getValueStr ( const Option O,
const char *  DefaultMsg 
) [static]

Definition at line 683 of file CommandLine.cpp.

References llvm::cl::Option::ValueStr.

Referenced by llvm::cl::basic_parser_impl::getOptionWidth(), and llvm::cl::basic_parser_impl::printOptionInfo().

HelpPrinter @433::HiddenPrinter ( true   )  [static]

static bool isGrouping ( const Option O  )  [inline, static]

Definition at line 136 of file CommandLine.cpp.

References llvm::cl::Option::getFormattingFlag(), and llvm::cl::Grouping.

Referenced by isPrefixedOrGrouping(), and llvm::cl::ParseCommandLineOptions().

static bool isPrefixedOrGrouping ( const Option O  )  [inline, static]

Definition at line 139 of file CommandLine.cpp.

References llvm::cl::Option::getFormattingFlag(), isGrouping(), and llvm::cl::Prefix.

Referenced by llvm::cl::ParseCommandLineOptions().

static Option* LookupOption ( const char *&  Arg,
const char *&  Value 
) [static]

LookupOption - Lookup the option specified by the specified option on the command line. If there is a value specified (after an equal sign) return that as well.

Definition at line 267 of file CommandLine.cpp.

References getOpts().

Referenced by llvm::cl::ParseCommandLineOptions().

static std::vector<const char*>& MoreHelp (  )  [static]

Definition at line 38 of file CommandLine.cpp.

Referenced by llvm::cl::extrahelp::extrahelp(), and llvm::cl::ParseCommandLineOptions().

HelpPrinter @433::NormalPrinter ( false   )  [static]

Referenced by llvm::cl::PrintHelpMessage().

static void ParseCStringVector ( std::vector< char * > &  output,
const char *  input 
) [static]

ParseCStringVector - Break INPUT up wherever one or more whitespace characters are found, and store the resulting tokens in OUTPUT. The tokens stored in OUTPUT are dynamically allocated using strdup (), so it is the caller's responsibility to free () them later.

Definition at line 191 of file CommandLine.cpp.

References strdup.

Referenced by llvm::cl::ParseEnvironmentOptions().

static bool parseDouble ( Option O,
const std::string &  Arg,
double &  Value 
) [static]

Definition at line 783 of file CommandLine.cpp.

References llvm::cl::Option::error().

static bool ProvideOption ( Option Handler,
const char *  ArgName,
const char *  Value,
int  argc,
char **  argv,
int &  i 
) [inline, static]

Definition at line 95 of file CommandLine.cpp.

References llvm::cl::Option::addOccurrence(), llvm::cl::Option::error(), llvm::cl::Option::getValueExpectedFlag(), ProgramName, llvm::cl::ValueDisallowed, llvm::cl::ValueOptional, and llvm::cl::ValueRequired.

Referenced by llvm::cl::ParseCommandLineOptions(), and ProvidePositionalOption().

static bool ProvidePositionalOption ( Option Handler,
const std::string &  Arg,
int  i 
) [static]

Definition at line 128 of file CommandLine.cpp.

References llvm::cl::Option::ArgStr, and ProvideOption().

Referenced by llvm::cl::ParseCommandLineOptions().

static void RemoveArgument ( const char *  ArgName,
Option Opt 
) [static]

Definition at line 83 of file CommandLine.cpp.

References getOption(), and getOpts().

Referenced by llvm::cl::Option::removeArgument().

static bool RequiresValue ( const Option O  )  [static]

Definition at line 175 of file CommandLine.cpp.

References llvm::cl::Option::getNumOccurrencesFlag(), llvm::cl::OneOrMore, and llvm::cl::Required.

Referenced by llvm::cl::ParseCommandLineOptions().


Variable Documentation

const Option* EmptyArg

Definition at line 877 of file CommandLine.cpp.

cl::opt<HelpPrinter, true, parser<bool> > HHOp("help-hidden", cl::desc("Display all available options"), cl::location(HiddenPrinter), cl::Hidden, cl::ValueDisallowed) [static]

cl::opt<HelpPrinter, true, parser<bool> > HOp("help", cl::desc("Display available options (--help-hidden for more)"), cl::location(NormalPrinter), cl::ValueDisallowed) [static]

unsigned MaxArgLen

Definition at line 876 of file CommandLine.cpp.

void(*) OverrideVersionPrinter()=0 [static]

Definition at line 972 of file CommandLine.cpp.

Referenced by llvm::cl::SetVersionPrinter().

const char* ProgramName = "<unknown>" [static]

Definition at line 34 of file CommandLine.cpp.

Referenced by AddArgument(), llvm::cl::Option::error(), llvm::cl::ParseCommandLineOptions(), and ProvideOption().

const char* ProgramOverview = 0 [static]

Definition at line 35 of file CommandLine.cpp.

Referenced by llvm::cl::ParseCommandLineOptions().

const bool ShowHidden

Definition at line 878 of file CommandLine.cpp.

VersionPrinter VersionPrinterInstance [static]

Definition at line 1006 of file CommandLine.cpp.

cl::opt<VersionPrinter, true, parser<bool> > VersOp("version", cl::desc("Display the version of this program"), cl::location(VersionPrinterInstance), cl::ValueDisallowed) [static]