LLVM 24.0.0git
llvm::opt::LibraryOptionsParser Class Referencefinal

Connects options struct T to cl::parseCommandLineOptions and cl::LibraryOptionsContext. More...

#include "llvm/Option/LibraryOptions.h"

Inheritance diagram for llvm::opt::LibraryOptionsParser:
[legend]

Public Member Functions

template<typename T>
 LibraryOptionsParser (std::in_place_type_t< T >)
void forEachOption (function_ref< void(StringRef, StringRef, StringRef)> Fn) const override
Error parse (void *Opts, ArrayRef< const char * > Args, unsigned &Consumed, BumpPtrAllocator &Alloc) override
 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.
void * global () override
 Returns the values that ParseCommandLineOptions sets.
const void * getDefault () const override
 Returns the default values.
void * copyDefault (BumpPtrAllocator &Alloc) const override
 Returns a copy of getDefault() allocated from Alloc.
void reset () override
 Restores the default values.
Public Member Functions inherited from llvm::cl::LibraryOptions
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.
bool isPerContext () const
 Whether every reader of the options goes through a context's LibraryOptionsContext, so that they need not be set in global().

Additional Inherited Members

Protected Member Functions inherited from llvm::cl::LibraryOptions
 LibraryOptions (bool PerContext=false)
 ~LibraryOptions ()=default

Detailed Description

Connects options struct T to cl::parseCommandLineOptions and cl::LibraryOptionsContext.

Definition at line 124 of file LibraryOptions.h.

Constructor & Destructor Documentation

◆ LibraryOptionsParser()

template<typename T>
llvm::opt::LibraryOptionsParser::LibraryOptionsParser ( std::in_place_type_t< T > )
inlineexplicit

Member Function Documentation

◆ copyDefault()

void * llvm::opt::LibraryOptionsParser::copyDefault ( BumpPtrAllocator & Alloc) const
inlineoverridevirtual

Returns a copy of getDefault() allocated from Alloc.

Implements llvm::cl::LibraryOptions.

Definition at line 144 of file LibraryOptions.h.

References llvm::Alloc.

◆ forEachOption()

void LibraryOptionsParser::forEachOption ( function_ref< void(StringRef, StringRef, StringRef)> Fn) const
override

◆ getDefault()

const void * llvm::opt::LibraryOptionsParser::getDefault ( ) const
inlineoverridevirtual

Returns the default values.

Implements llvm::cl::LibraryOptions.

Definition at line 143 of file LibraryOptions.h.

◆ global()

void * llvm::opt::LibraryOptionsParser::global ( )
inlineoverridevirtual

Returns the values that ParseCommandLineOptions sets.

Implements llvm::cl::LibraryOptions.

Definition at line 142 of file LibraryOptions.h.

◆ parse()

Error LibraryOptionsParser::parse ( void * Opts,
ArrayRef< const char * > Args,
unsigned & Consumed,
BumpPtrAllocator & Alloc )
overridevirtual

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.

Implements llvm::cl::LibraryOptions.

Definition at line 38 of file LibraryOptions.cpp.

References A(), llvm::Alloc, llvm::createStringError(), llvm::List, llvm::Error::success(), llvm::Table, and llvm::opt::Option::UnknownClass.

◆ reset()

void llvm::opt::LibraryOptionsParser::reset ( )
inlineoverridevirtual

Restores the default values.

Implements llvm::cl::LibraryOptions.

Definition at line 147 of file LibraryOptions.h.


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