LLVM  8.0.1
Classes | Namespaces
Options.h File Reference

This file declares helper objects for defining debug options that can be configured via the command line. More...

#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/CommandLine.h"
Include dependency graph for Options.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  llvm::detail::OptionKey< ValT, Base, Mem >
 
class  llvm::OptionRegistry
 Singleton class used to register debug options. More...
 

Namespaces

 llvm
 This class represents lattice values for constants.
 
 llvm::detail
 Implementation details of the pass manager interfaces.
 

Detailed Description

This file declares helper objects for defining debug options that can be configured via the command line.

The new API currently builds on the cl::opt API, but does not require the use of static globals.

With this API options are registered during initialization. For passes, this happens during pass initialization. Passes with options will call a static registerOptions method during initialization that registers options with the OptionRegistry. An example implementation of registerOptions is:

static void registerOptions() { OptionRegistry::registerOption<bool, Scalarizer, &Scalarizer::ScalarizeLoadStore>( "scalarize-load-store", "Allow the scalarizer pass to scalarize loads and store", false); }

When reading data for options the interface is via the LLVMContext. Option data for passes should be read from the context during doInitialization. An example of reading the above option would be:

ScalarizeLoadStore = M.getContext().getOption<bool, Scalarizer, &Scalarizer::ScalarizeLoadStore>();

Definition in file Options.h.