LLVM 24.0.0git
llvm::cl::LibraryOptions Class Referenceabstract

The options of a library that declares them in TableGen rather than as cl::opt (see llvm/Option/LibraryOptions.h). More...

#include "llvm/Support/CommandLine.h"

Inheritance diagram for llvm::cl::LibraryOptions:
[legend]

Public Member Functions

virtual void forEachOption (function_ref< void(StringRef Spelling, StringRef MetaVar, StringRef Help)> Fn) const =0
 Calls Fn with the spelling of each option without its prefix (e.g.
virtual Error parse (void *Opts, ArrayRef< const char * > Args, unsigned &Consumed, BumpPtrAllocator &Alloc)=0
 Parses the option spelled by Args[0], which may take Args[1] as its value, into Opts, which is global() or a context's values, and sets Consumed to the number of arguments it spans.
virtual void * global ()=0
 Returns the values that ParseCommandLineOptions sets.
virtual const void * getDefault () const =0
 Returns the default values.
virtual void * copyDefault (BumpPtrAllocator &Alloc) const =0
 Returns a copy of getDefault() allocated from Alloc.
virtual void reset ()=0
 Restores the default values.
bool isPerContext () const
 Whether every reader of the options goes through a context's LibraryOptionsContext, so that they need not be set in global().

Protected Member Functions

 LibraryOptions (bool PerContext=false)
 ~LibraryOptions ()=default

Detailed Description

The options of a library that declares them in TableGen rather than as cl::opt (see llvm/Option/LibraryOptions.h).

ParseCommandLineOptions hands every argument naming one of them to parse(). This lets libraries move off cl::opt while tools still parse argv with cl::, and goes away once tools parse argv without cl::.

Definition at line 2180 of file CommandLine.h.

Constructor & Destructor Documentation

◆ LibraryOptions()

llvm::cl::LibraryOptions::LibraryOptions ( bool PerContext = false)
inlineexplicitprotected

◆ ~LibraryOptions()

llvm::cl::LibraryOptions::~LibraryOptions ( )
protecteddefault

Member Function Documentation

◆ copyDefault()

virtual void * llvm::cl::LibraryOptions::copyDefault ( BumpPtrAllocator & Alloc) const
pure virtual

Returns a copy of getDefault() allocated from Alloc.

Implemented in llvm::opt::LibraryOptionsParser.

References llvm::Alloc.

◆ forEachOption()

virtual void llvm::cl::LibraryOptions::forEachOption ( function_ref< void(StringRef Spelling, StringRef MetaVar, StringRef Help)> Fn) const
pure virtual

Calls Fn with the spelling of each option without its prefix (e.g.

"x" or "x="), its metavariable, and its help text. Only -help-hidden lists the options.

References Help().

◆ getDefault()

virtual const void * llvm::cl::LibraryOptions::getDefault ( ) const
pure virtual

Returns the default values.

Implemented in llvm::opt::LibraryOptionsParser.

◆ global()

virtual void * llvm::cl::LibraryOptions::global ( )
pure virtual

Returns the values that ParseCommandLineOptions sets.

Implemented in llvm::opt::LibraryOptionsParser.

◆ isPerContext()

bool llvm::cl::LibraryOptions::isPerContext ( ) const
inline

Whether every reader of the options goes through a context's LibraryOptionsContext, so that they need not be set in global().

Definition at line 2210 of file CommandLine.h.

◆ parse()

virtual Error llvm::cl::LibraryOptions::parse ( void * Opts,
ArrayRef< const char * > Args,
unsigned & Consumed,
BumpPtrAllocator & Alloc )
pure virtual

Parses the option spelled by Args[0], which may take Args[1] as its value, into Opts, which is global() or a context's values, and sets Consumed to the number of arguments it spans.

The strings in Args and the memory from Alloc remain valid as long as Opts is used.

Implemented in llvm::opt::LibraryOptionsParser.

References llvm::Alloc.

◆ reset()

virtual void llvm::cl::LibraryOptions::reset ( )
pure virtual

Restores the default values.

Implemented in llvm::opt::LibraryOptionsParser.


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