Return the size of the requested allocation.
Declared in <llvm/Analysis/MemoryBuiltins.h>
std::optional<APInt>
getAllocSize(
CallBase const* CB,
TargetLibraryInfo const* TLI,
function_ref<Value const*(Value const*)> Mapper = [](const Value *V) {
return V;
});
With a trivial mapper, this is similar to calling getObjectSize(..., Exact), but without looking through calls that return their argument. A mapper function can be used to replace one Value* (operand to the allocation) with another. This is useful when doing abstract interpretation.
The requested allocation size, or std::nullopt if unknown.
| Name | Description |
|---|---|
| CB | Call to an allocation function. |
| TLI | Target library info used to identify allocation functions. |
| Mapper | Optional mapper that rewrites allocation operands. |