LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
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]

Public Member Functions

 StringRefMemoryObject (StringRef Bytes, uint64_t Base=0)
 
uint64_t getBase () const LLVM_OVERRIDE
 
uint64_t getExtent () const LLVM_OVERRIDE
 
int readByte (uint64_t Addr, uint8_t *Byte) const LLVM_OVERRIDE
 
int readBytes (uint64_t Addr, uint64_t Size, uint8_t *Buf) const LLVM_OVERRIDE
 
- Public Member Functions inherited from llvm::MemoryObject
virtual ~MemoryObject ()
 Destructor - Override as necessary. More...
 

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
inlinevirtual

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
inlinevirtual

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
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
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::Intrinsic::memcpy.


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