LLVM API Documentation

Public Member Functions
llvm::StringRefMemoryObject Class Reference

StringRefMemoryObject - Simple StringRef-backed MemoryObject. More...

#include <StringRefMemoryObject.h>

Inheritance diagram for llvm::StringRefMemoryObject:
Inheritance graph
[legend]
Collaboration diagram for llvm::StringRefMemoryObject:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StringRefMemoryObject (StringRef Bytes, uint64_t Base=0)
uint64_t getBase () const override
uint64_t getExtent () const override
int readByte (uint64_t Addr, uint8_t *Byte) const override
int readBytes (uint64_t Addr, uint64_t Size, uint8_t *Buf) const override

Detailed Description

StringRefMemoryObject - Simple StringRef-backed MemoryObject.

Definition at line 25 of file StringRefMemoryObject.h.


Constructor & Destructor Documentation

llvm::StringRefMemoryObject::StringRefMemoryObject ( StringRef  Bytes,
uint64_t  Base = 0 
) [inline]

Definition at line 29 of file StringRefMemoryObject.h.


Member Function Documentation

uint64_t llvm::StringRefMemoryObject::getBase ( ) const [inline, override, virtual]

getBase - Returns the lowest valid address in the region.

Returns:
- The lowest valid address.

Implements llvm::MemoryObject.

Definition at line 32 of file StringRefMemoryObject.h.

uint64_t llvm::StringRefMemoryObject::getExtent ( ) const [inline, override, virtual]

getExtent - Returns the size of the region in bytes. (The region is contiguous, so the highest valid address of the region is getBase() + getExtent() - 1).

Returns:
- The size of the region.

Implements llvm::MemoryObject.

Definition at line 33 of file StringRefMemoryObject.h.

References llvm::StringRef::size().

Referenced by readByte(), and readBytes().

int StringRefMemoryObject::readByte ( uint64_t  address,
uint8_t *  ptr 
) const [override, virtual]

readByte - Tries to read a single byte from the region.

Parameters:
address- The address of the byte, in the same space as getBase().
ptr- A pointer to a byte to be filled in. Must be non-NULL.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

Implements llvm::MemoryObject.

Definition at line 14 of file StringRefMemoryObject.cpp.

References getExtent().

int StringRefMemoryObject::readBytes ( uint64_t  address,
uint64_t  size,
uint8_t *  buf 
) const [override, virtual]

readBytes - Tries to read a contiguous range of bytes from the region, up to the end of the region. You should override this function if there is a quicker way than going back and forth with individual bytes.

Parameters:
address- The address of the first byte, in the same space as getBase().
size- The number of bytes to copy.
buf- A pointer to a buffer to be filled in. Must be non-NULL and large enough to hold size bytes.
Returns:
- 0 if successful; -1 if not. Failure may be due to a bounds violation or an implementation-specific error.

Reimplemented from llvm::MemoryObject.

Definition at line 21 of file StringRefMemoryObject.cpp.

References llvm::StringRef::data(), getExtent(), and llvm::LibFunc::memcpy.


The documentation for this class was generated from the following files: