class Option

Declaration

class Option { /* full declaration omitted */ };

Description

Option - Abstract representation for a single form of driver argument. An Option class represents a form of option that the driver takes, for example how many arguments the option has and how they can be provided. Individual option instances store additional information about what group the option is a member of (if any), if the option is an alias, and a number of flags. At runtime the driver parses the command line into concrete Arg instances, each of which corresponds to a particular Option instance.

Declared at: llvm/include/llvm/Option/Option.h:51

Member Variables

protected const OptTable::Info* Info
protected const llvm::opt::OptTable* Owner

Method Overview

  • public Option(const OptTable::Info * Info, const llvm::opt::OptTable * Owner)
  • public std::unique_ptr<Arg> accept(const llvm::opt::ArgList & Args, llvm::StringRef CurArg, bool GroupedShortOption, unsigned int & Index) const
  • private std::unique_ptr<Arg> acceptInternal(const llvm::opt::ArgList & Args, llvm::StringRef CurArg, unsigned int & Index) const
  • public void dump() const
  • public const llvm::opt::Option getAlias() const
  • public const char * getAliasArgs() const
  • public const llvm::opt::Option getGroup() const
  • public llvm::StringRef getHelpText() const
  • public unsigned int getID() const
  • public llvm::opt::Option::OptionClass getKind() const
  • public llvm::StringRef getMetaVar() const
  • public llvm::StringRef getName() const
  • public unsigned int getNumArgs() const
  • public llvm::StringRef getPrefix() const
  • public std::string getPrefixedName() const
  • public llvm::StringRef getRenderName() const
  • public llvm::opt::Option::RenderStyleKind getRenderStyle() const
  • public const llvm::opt::Option getUnaliasedOption() const
  • public bool hasFlag(unsigned int Val) const
  • public bool hasNoOptAsInput() const
  • public bool isValid() const
  • public bool matches(llvm::opt::OptSpecifier ID) const
  • public void print(llvm::raw_ostream & O) const

Methods

Option(const OptTable::Info* Info,
       const llvm::opt::OptTable* Owner)

Declared at: llvm/include/llvm/Option/Option.h:81

Parameters

const OptTable::Info* Info
const llvm::opt::OptTable* Owner

std::unique_ptr<Arg> accept(
    const llvm::opt::ArgList& Args,
    llvm::StringRef CurArg,
    bool GroupedShortOption,
    unsigned int& Index) const

Description

Potentially accept the current argument, returning a new Arg instance, or 0 if the option does not accept this argument (or the argument is missing values). If the option accepts the current argument, accept() sets Index to the position where argument parsing should resume (even if the argument is missing values). \p CurArg The argument to be matched. It may be shorter than the underlying storage to represent a Joined argument.\p GroupedShortOption If true, we are handling the fallback case of parsing a prefix of the current argument as a short option.

Declared at: llvm/include/llvm/Option/Option.h:220

Parameters

const llvm::opt::ArgList& Args
llvm::StringRef CurArg
bool GroupedShortOption
unsigned int& Index

std::unique_ptr<Arg> acceptInternal(
    const llvm::opt::ArgList& Args,
    llvm::StringRef CurArg,
    unsigned int& Index) const

Declared at: llvm/include/llvm/Option/Option.h:224

Parameters

const llvm::opt::ArgList& Args
llvm::StringRef CurArg
unsigned int& Index

void dump() const

Declared at: llvm/include/llvm/Option/Option.h:229

const llvm::opt::Option getAlias() const

Declared at: llvm/include/llvm/Option/Option.h:109

const char* getAliasArgs() const

Description

Get the alias arguments as a \ 0 separated list. E.g. ["foo", "bar"] would be returned as "foo\0bar\0".

Declared at: llvm/include/llvm/Option/Option.h:117

const llvm::opt::Option getGroup() const

Declared at: llvm/include/llvm/Option/Option.h:103

llvm::StringRef getHelpText() const

Description

Get the help text for this option.

Declared at: llvm/include/llvm/Option/Option.h:139

unsigned int getID() const

Declared at: llvm/include/llvm/Option/Option.h:87

llvm::opt::Option::OptionClass getKind() const

Declared at: llvm/include/llvm/Option/Option.h:92

llvm::StringRef getMetaVar() const

Description

Get the meta-variable list for this option.

Declared at: llvm/include/llvm/Option/Option.h:145

llvm::StringRef getName() const

Description

Get the name of this option without any prefix.

Declared at: llvm/include/llvm/Option/Option.h:98

unsigned int getNumArgs() const

Declared at: llvm/include/llvm/Option/Option.h:150

llvm::StringRef getPrefix() const

Description

Get the default prefix for this option.

Declared at: llvm/include/llvm/Option/Option.h:126

std::string getPrefixedName() const

Description

Get the name of this option with the default prefix.

Declared at: llvm/include/llvm/Option/Option.h:132

llvm::StringRef getRenderName() const

Description

getRenderName - Return the name to use when rendering this option.

Declared at: llvm/include/llvm/Option/Option.h:196

llvm::opt::Option::RenderStyleKind
getRenderStyle() const

Declared at: llvm/include/llvm/Option/Option.h:154

const llvm::opt::Option getUnaliasedOption() const

Description

getUnaliasedOption - Return the final option this option aliases (itself, if the option has no alias).

Declared at: llvm/include/llvm/Option/Option.h:188

bool hasFlag(unsigned int Val) const

Description

Test if this option has the flag \a Val.

Declared at: llvm/include/llvm/Option/Option.h:182

Parameters

unsigned int Val

bool hasNoOptAsInput() const

Declared at: llvm/include/llvm/Option/Option.h:152

bool isValid() const

Declared at: llvm/include/llvm/Option/Option.h:83

bool matches(llvm::opt::OptSpecifier ID) const

Description

matches - Predicate for whether this option is part of the given option (which may be a group). Note that matches against options which are an alias should never be done -- aliases do not participate in matching and so such a query will always be false.

Declared at: llvm/include/llvm/Option/Option.h:206

Parameters

llvm::opt::OptSpecifier ID

void print(llvm::raw_ostream& O) const

Declared at: llvm/include/llvm/Option/Option.h:228

Parameters

llvm::raw_ostream& O