llvm::LazyAtomicPointer::loadOrGenerate

Get the current value, or call Generator to generate a value. Guarantees that only one thread's Generator will run.

Synopsis

Declared in <llvm/ADT/LazyAtomicPointer.h>

T&
loadOrGenerate(function_ref<T*()> Generator);

Return Value

Reference to the stored (or newly generated) value.

Parameters

NameDescription
GeneratorCallable that produces a non-null pointer when the stored value is null.

Preconditions

  • Generator doesn't return nullptr.