llvm::getBaseObjectSize

Like getObjectSize(), but only for base objects.

Synopsis

Declared in <llvm/Analysis/MemoryBuiltins.h>

std::optional<TypeSize>
getBaseObjectSize(
    Value const* Ptr,
    DataLayout const& DL,
    TargetLibraryInfo const* TLI,
    ObjectSizeOpts Opts = {});

Description

Returns the size of base objects (like allocas, global variables and allocator calls) and std::nullopt otherwise. Requires ExactSizeFromOffset mode.

Return Value

The base object size, or std::nullopt if Ptr is not a base object.

Parameters

NameDescription
PtrPointer that may refer to a base object.
DLData layout used for type and pointer sizing.
TLITarget library info used to identify allocation functions.
OptsOptions controlling how object size is evaluated.