A global registry used in conjunction with static constructors to make pluggable components (like targets or garbage collectors) "just work" when linked with an executable.
More...
template<typename
T, typename... CtorParamTypes>
class llvm::Registry< T, CtorParamTypes >
A global registry used in conjunction with static constructors to make pluggable components (like targets or garbage collectors) "just work" when linked with an executable.
To provide a Registry interface, follow these steps:
- Define your plugin base interface. The interface must have a virtual destructor and the appropriate dllexport/dllimport/visibility annotation.
namespace your_ns {
class YOURLIB_ABI SomethingPluginBase {
virtual ~SomethingPluginBase() = default;
virtual void TheInterface() = 0;
};
}
- Declare an alias to your Registry for convenience.
namespace your_ns {
using YourRegistry = llvm::Registry<SomethingPluginBase>;
}
- Declare the specialization of the Registry with LLVM_DECLARE_REGISTRY in the global namespace. The declaration must be placed before any use of the YourRegistry.
LLVM_DECLARE_REGISTRY(your_ns::YourRegistry)
- In a .cpp file, define the specialization with LLVM_DEFINE_REGISTRY in the global namespace.
LLVM_DEFINE_REGISTRY(your_ns::YourRegistry)
Definition at line 116 of file Registry.h.