LLVM 20.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
llvm::cl::Option Class Referenceabstract

#include "llvm/Support/CommandLine.h"

Inheritance diagram for llvm::cl::Option:
Inheritance graph
[legend]

Public Member Functions

enum NumOccurrencesFlag getNumOccurrencesFlag () const
 
enum ValueExpected getValueExpectedFlag () const
 
enum OptionHidden getOptionHiddenFlag () const
 
enum FormattingFlags getFormattingFlag () const
 
unsigned getMiscFlags () const
 
unsigned getPosition () const
 
unsigned getNumAdditionalVals () const
 
bool hasArgStr () const
 
bool isPositional () const
 
bool isSink () const
 
bool isDefaultOption () const
 
bool isConsumeAfter () const
 
void setArgStr (StringRef S)
 
void setDescription (StringRef S)
 
void setValueStr (StringRef S)
 
void setNumOccurrencesFlag (enum NumOccurrencesFlag Val)
 
void setValueExpectedFlag (enum ValueExpected Val)
 
void setHiddenFlag (enum OptionHidden Val)
 
void setFormattingFlag (enum FormattingFlags V)
 
void setMiscFlag (enum MiscFlags M)
 
void setPosition (unsigned pos)
 
void addCategory (OptionCategory &C)
 
void addSubCommand (SubCommand &S)
 
virtual ~Option ()=default
 
void addArgument ()
 
void removeArgument ()
 Unregisters this option from the CommandLine system.
 
virtual size_t getOptionWidth () const =0
 
virtual void printOptionInfo (size_t GlobalWidth) const =0
 
virtual void printOptionValue (size_t GlobalWidth, bool Force) const =0
 
virtual void setDefault ()=0
 
virtual void getExtraOptionNames (SmallVectorImpl< StringRef > &)
 
virtual bool addOccurrence (unsigned pos, StringRef ArgName, StringRef Value, bool MultiArg=false)
 
bool error (const Twine &Message, StringRef ArgName=StringRef(), raw_ostream &Errs=llvm::errs())
 
bool error (const Twine &Message, raw_ostream &Errs)
 
int getNumOccurrences () const
 
void reset ()
 

Static Public Member Functions

static void printHelpStr (StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
 
static void printEnumValHelpStr (StringRef HelpStr, size_t Indent, size_t FirstLineIndentedBy)
 

Public Attributes

StringRef ArgStr
 
StringRef HelpStr
 
StringRef ValueStr
 
SmallVector< OptionCategory *, 1 > Categories
 
SmallPtrSet< SubCommand *, 1 > Subs
 

Protected Member Functions

 Option (enum NumOccurrencesFlag OccurrencesFlag, enum OptionHidden Hidden)
 
void setNumAdditionalVals (unsigned n)
 

Friends

class alias
 

Detailed Description

Definition at line 250 of file CommandLine.h.

Constructor & Destructor Documentation

◆ Option()

llvm::cl::Option::Option ( enum NumOccurrencesFlag  OccurrencesFlag,
enum OptionHidden  Hidden 
)
inlineexplicitprotected

Definition at line 335 of file CommandLine.h.

References Categories, and llvm::cl::getGeneralCategory().

◆ ~Option()

virtual llvm::cl::Option::~Option ( )
virtualdefault

Member Function Documentation

◆ addArgument()

void Option::addArgument ( )

Definition at line 431 of file CommandLine.cpp.

References GlobalParser.

◆ addCategory()

void Option::addCategory ( OptionCategory C)

◆ addOccurrence()

bool Option::addOccurrence ( unsigned  pos,
StringRef  ArgName,
StringRef  Value,
bool  MultiArg = false 
)
virtual

Definition at line 1863 of file CommandLine.cpp.

Referenced by CommaSeparateAndAddOccurrence().

◆ addSubCommand()

void llvm::cl::Option::addSubCommand ( SubCommand S)
inline

Definition at line 332 of file CommandLine.h.

References Subs.

◆ error() [1/2]

bool llvm::cl::Option::error ( const Twine Message,
raw_ostream Errs 
)
inline

Definition at line 395 of file CommandLine.h.

References error.

◆ error() [2/2]

bool Option::error ( const Twine Message,
StringRef  ArgName = StringRef(),
raw_ostream Errs = llvm::errs() 
)

◆ getExtraOptionNames()

virtual void llvm::cl::Option::getExtraOptionNames ( SmallVectorImpl< StringRef > &  )
inlinevirtual

Definition at line 386 of file CommandLine.h.

◆ getFormattingFlag()

enum FormattingFlags llvm::cl::Option::getFormattingFlag ( ) const
inline

Definition at line 301 of file CommandLine.h.

Referenced by HandlePrefixedOrGroupedOption(), isPositional(), and ProvideOption().

◆ getMiscFlags()

unsigned llvm::cl::Option::getMiscFlags ( ) const
inline

Definition at line 305 of file CommandLine.h.

Referenced by CommaSeparateAndAddOccurrence(), isDefaultOption(), and isSink().

◆ getNumAdditionalVals()

unsigned llvm::cl::Option::getNumAdditionalVals ( ) const
inline

Definition at line 307 of file CommandLine.h.

Referenced by ProvideOption().

◆ getNumOccurrences()

int llvm::cl::Option::getNumOccurrences ( ) const
inline

Definition at line 399 of file CommandLine.h.

Referenced by llvm::AMDGPUPassConfig::isPassEnabled().

◆ getNumOccurrencesFlag()

enum NumOccurrencesFlag llvm::cl::Option::getNumOccurrencesFlag ( ) const
inline

Definition at line 289 of file CommandLine.h.

Referenced by isConsumeAfter().

◆ getOptionHiddenFlag()

enum OptionHidden llvm::cl::Option::getOptionHiddenFlag ( ) const
inline

Definition at line 297 of file CommandLine.h.

◆ getOptionWidth()

virtual size_t llvm::cl::Option::getOptionWidth ( ) const
pure virtual

◆ getPosition()

unsigned llvm::cl::Option::getPosition ( ) const
inline

Definition at line 306 of file CommandLine.h.

◆ getValueExpectedFlag()

enum ValueExpected llvm::cl::Option::getValueExpectedFlag ( ) const
inline

Definition at line 293 of file CommandLine.h.

Referenced by HandlePrefixedOrGroupedOption(), and ProvideOption().

◆ hasArgStr()

bool llvm::cl::Option::hasArgStr ( ) const
inline

◆ isConsumeAfter()

bool llvm::cl::Option::isConsumeAfter ( ) const
inline

Definition at line 315 of file CommandLine.h.

References llvm::cl::ConsumeAfter, and getNumOccurrencesFlag().

◆ isDefaultOption()

bool llvm::cl::Option::isDefaultOption ( ) const
inline

Definition at line 313 of file CommandLine.h.

References llvm::cl::DefaultOption, and getMiscFlags().

Referenced by reset().

◆ isPositional()

bool llvm::cl::Option::isPositional ( ) const
inline

Definition at line 311 of file CommandLine.h.

References getFormattingFlag(), and llvm::cl::Positional.

◆ isSink()

bool llvm::cl::Option::isSink ( ) const
inline

Definition at line 312 of file CommandLine.h.

References getMiscFlags(), and llvm::cl::Sink.

◆ printEnumValHelpStr()

void Option::printEnumValHelpStr ( StringRef  HelpStr,
size_t  Indent,
size_t  FirstLineIndentedBy 
)
static

◆ printHelpStr()

void Option::printHelpStr ( StringRef  HelpStr,
size_t  Indent,
size_t  FirstLineIndentedBy 
)
static

◆ printOptionInfo()

virtual void llvm::cl::Option::printOptionInfo ( size_t  GlobalWidth) const
pure virtual

◆ printOptionValue()

virtual void llvm::cl::Option::printOptionValue ( size_t  GlobalWidth,
bool  Force 
) const
pure virtual

◆ removeArgument()

void Option::removeArgument ( )

Unregisters this option from the CommandLine system.

This option must have been the last option registered. For testing purposes only.

Definition at line 436 of file CommandLine.cpp.

References GlobalParser.

Referenced by reset().

◆ reset()

void Option::reset ( )

Definition at line 458 of file CommandLine.cpp.

References isDefaultOption(), removeArgument(), and setDefault().

◆ setArgStr()

void Option::setArgStr ( StringRef  S)

◆ setDefault()

virtual void llvm::cl::Option::setDefault ( )
pure virtual

Referenced by reset().

◆ setDescription()

void llvm::cl::Option::setDescription ( StringRef  S)
inline

Definition at line 323 of file CommandLine.h.

References HelpStr.

◆ setFormattingFlag()

void llvm::cl::Option::setFormattingFlag ( enum FormattingFlags  V)
inline

Definition at line 328 of file CommandLine.h.

◆ setHiddenFlag()

void llvm::cl::Option::setHiddenFlag ( enum OptionHidden  Val)
inline

Definition at line 327 of file CommandLine.h.

◆ setMiscFlag()

void llvm::cl::Option::setMiscFlag ( enum MiscFlags  M)
inline

Definition at line 329 of file CommandLine.h.

Referenced by setArgStr().

◆ setNumAdditionalVals()

void llvm::cl::Option::setNumAdditionalVals ( unsigned  n)
inlineprotected

◆ setNumOccurrencesFlag()

void llvm::cl::Option::setNumOccurrencesFlag ( enum NumOccurrencesFlag  Val)
inline

Definition at line 325 of file CommandLine.h.

◆ setPosition()

void llvm::cl::Option::setPosition ( unsigned  pos)
inline

Definition at line 330 of file CommandLine.h.

◆ setValueExpectedFlag()

void llvm::cl::Option::setValueExpectedFlag ( enum ValueExpected  Val)
inline

Definition at line 326 of file CommandLine.h.

◆ setValueStr()

void llvm::cl::Option::setValueStr ( StringRef  S)
inline

Definition at line 324 of file CommandLine.h.

References ValueStr.

Friends And Related Function Documentation

◆ alias

friend class alias
friend

Definition at line 251 of file CommandLine.h.

Member Data Documentation

◆ ArgStr

StringRef llvm::cl::Option::ArgStr

Definition at line 282 of file CommandLine.h.

Referenced by error(), hasArgStr(), llvm::cl::ProvidePositionalOption(), and setArgStr().

◆ Categories

SmallVector<OptionCategory *, 1> llvm::cl::Option::Categories

Definition at line 286 of file CommandLine.h.

Referenced by addCategory(), and Option().

◆ HelpStr

StringRef llvm::cl::Option::HelpStr

Definition at line 283 of file CommandLine.h.

Referenced by error(), printEnumValHelpStr(), printHelpStr(), and setDescription().

◆ Subs

SmallPtrSet<SubCommand *, 1> llvm::cl::Option::Subs

Definition at line 287 of file CommandLine.h.

Referenced by addSubCommand().

◆ ValueStr

StringRef llvm::cl::Option::ValueStr

Definition at line 284 of file CommandLine.h.

Referenced by setValueStr().


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