llvm::getOrCreateSanitizerCtorAndInitFunctions

Creates sanitizer constructor and init functions lazily.

Synopsis

Declared in <llvm/Transforms/Utils/ModuleUtils.h>

std::pair<Function*, FunctionCallee>
getOrCreateSanitizerCtorAndInitFunctions(
    Module& M,
    StringRef CtorName,
    StringRef InitName,
    ArrayRef<Type*> InitArgTypes,
    ArrayRef<Value*> InitArgs,
    function_ref<void(Function*, FunctionCallee)> FunctionsCreatedCallback,
    StringRef VersionCheckName = StringRef(),
    bool Weak = false);

Description

If a constructor and init function already exist, this function returns them. Otherwise it calls createSanitizerCtorAndInitFunctions. The FunctionsCreatedCallback is invoked in that case, passing the new Ctor and Init function.

Return Value

Returns pair of pointers to constructor, and init functions respectively.

Parameters

NameDescription
MModule in which to look up or create the functions.
CtorNameName of the constructor function.
InitNameName of the sanitizer init function.
InitArgTypesArgument types of the init function.
InitArgsArgument values passed to the init function.
FunctionsCreatedCallbackInvoked when new Ctor and Init are created.
VersionCheckNameOptional name of a version-check function to call.
WeakIf true, declare the init function as a weak external symbol.