LLVM  6.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
llvm::OptionRegistry Class Reference

Singleton class used to register debug options. More...

#include "llvm/Support/Options.h"

Public Member Functions

 ~OptionRegistry ()
 
 OptionRegistry ()
 
template<typename ValT , typename Base , ValTBase::* Mem>
ValT get () const
 Returns the value of the option. More...
 

Static Public Member Functions

static OptionRegistryinstance ()
 Returns a reference to the singleton instance. More...
 
template<typename ValT , typename Base , ValTBase::* Mem>
static void registerOption (StringRef ArgStr, StringRef Desc, const ValT &InitValue)
 Registers an option with the OptionRegistry singleton. More...
 

Detailed Description

Singleton class used to register debug options.

The OptionRegistry is responsible for managing lifetimes of the options and provides interfaces for option registration and reading values from options. This object is a singleton, only one instance should ever exist so that all options are registered in the same place.

Definition at line 65 of file Options.h.

Constructor & Destructor Documentation

◆ ~OptionRegistry()

OptionRegistry::~OptionRegistry ( )

Definition at line 20 of file Options.cpp.

References IT.

◆ OptionRegistry()

llvm::OptionRegistry::OptionRegistry ( )
inline

Definition at line 80 of file Options.h.

Member Function Documentation

◆ get()

template<typename ValT , typename Base , ValTBase::* Mem>
ValT llvm::OptionRegistry::get ( ) const
inline

Returns the value of the option.

Template Parameters
ValTtype of the option's data
Baseclass used to key the option
Memmember of Base used for keying the option

Reads option values based on the key generated by the template parameters. Keying for get() is the same as keying for registerOption.

Definition at line 111 of file Options.h.

References assert(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find().

◆ instance()

OptionRegistry & OptionRegistry::instance ( )
static

Returns a reference to the singleton instance.

Definition at line 33 of file Options.cpp.

References OR.

Referenced by llvm::LLVMContext::getOption().

◆ registerOption()

template<typename ValT , typename Base , ValTBase::* Mem>
static void llvm::OptionRegistry::registerOption ( StringRef  ArgStr,
StringRef  Desc,
const ValT InitValue 
)
inlinestatic

Registers an option with the OptionRegistry singleton.

Template Parameters
ValTtype of the option's data
Baseclass used to key the option
Memmember of Base used for keying the option

Options are keyed off the template parameters to generate unique static characters. The template parameters are (1) the type of the data the option stores (ValT), the class that will read the option (Base), and the member that the class will store the data into (Mem).

Definition at line 96 of file Options.h.

References llvm::cl::Hidden, and llvm::cl::init().


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