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

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

#include <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 (const char *ArgStr, const char *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 ( )
llvm::OptionRegistry::OptionRegistry ( )
inline

Definition at line 80 of file Options.h.

Member Function Documentation

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 llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find().

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(), and registerOption().

template<typename ValT , typename Base , ValTBase::* Mem>
static void llvm::OptionRegistry::registerOption ( const char *  ArgStr,
const char *  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 memeber that the class will store the data into (Mem).

Definition at line 96 of file Options.h.

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


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