Compute the size of the object pointed by Ptr.

Synopsis

Declared in <llvm/Analysis/MemoryBuiltins.h>

bool
getObjectSize(
    Value const* Ptr,
    uint64_t& Size,
    DataLayout const& DL,
    TargetLibraryInfo const* TLI,
    ObjectSizeOpts Opts = {});

Description

Returns true and the object size in Size if successful, and false otherwise. In this context, by object we mean the region of memory starting at Ptr to the end of the underlying object pointed to by Ptr.

WARNING: The object size returned is the allocation size. This does not imply dereferenceability at site of use since the object may be freeed in between.

Return Value

True on success with Size filled; false otherwise.

Parameters

Name

Description

Ptr

Pointer to the object whose size is requested.

Size

On success, receives the computed object size in bytes.

DL

Data layout used for type and pointer sizing.

TLI

Target library info used to identify allocation functions.

Opts

Options controlling how object size is evaluated.

Created with MrDocs