LLDB  mainline
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lldb_private::repro::IndexToObject Class Reference

Mapping between serialized indices and their corresponding objects. More...

#include <ReproducerInstrumentation.h>

Collaboration diagram for lldb_private::repro::IndexToObject:
Collaboration graph
[legend]

Public Member Functions

template<typename T >
T * GetObjectForIndex (unsigned idx)
 Returns an object as a pointer for the given index or nullptr if not present in the map. More...
 
template<typename T >
T * AddObjectForIndex (unsigned idx, T *object)
 Adds a pointer to an object to the mapping for the given index. More...
 
template<typename T >
T & AddObjectForIndex (unsigned idx, T &object)
 Adds a reference to an object to the mapping for the given index. More...
 
std::vector< void * > GetAllObjects () const
 Get all objects sorted by their index. More...
 

Private Member Functions

void * GetObjectForIndexImpl (unsigned idx)
 Helper method that does the actual lookup. More...
 
void AddObjectForIndexImpl (unsigned idx, void *object)
 Helper method that does the actual insertion. More...
 

Private Attributes

llvm::DenseMap< unsigned, void * > m_mapping
 Keeps a mapping between indices and their corresponding object. More...
 

Detailed Description

Mapping between serialized indices and their corresponding objects.

This class is used during replay to map indices back to in-memory objects.

When objects are constructed, they are added to this mapping using AddObjectForIndex.

When an object is passed to a function, its index is deserialized and AddObjectForIndex returns the corresponding object. If there is no object for the given index, a nullptr is returend. The latter is valid when custom replay code is in place and the actual object is ignored.

Definition at line 233 of file ReproducerInstrumentation.h.

Member Function Documentation

◆ AddObjectForIndex() [1/2]

template<typename T >
T* lldb_private::repro::IndexToObject::AddObjectForIndex ( unsigned  idx,
T *  object 
)
inline

Adds a pointer to an object to the mapping for the given index.

Definition at line 244 of file ReproducerInstrumentation.h.

◆ AddObjectForIndex() [2/2]

template<typename T >
T& lldb_private::repro::IndexToObject::AddObjectForIndex ( unsigned  idx,
T &  object 
)
inline

Adds a reference to an object to the mapping for the given index.

Definition at line 252 of file ReproducerInstrumentation.h.

◆ AddObjectForIndexImpl()

void IndexToObject::AddObjectForIndexImpl ( unsigned  idx,
void *  object 
)
private

Helper method that does the actual insertion.

Definition at line 22 of file ReproducerInstrumentation.cpp.

References m_mapping.

◆ GetAllObjects()

std::vector< void * > IndexToObject::GetAllObjects ( ) const

Get all objects sorted by their index.

Definition at line 27 of file ReproducerInstrumentation.cpp.

References m_mapping.

◆ GetObjectForIndex()

template<typename T >
T* lldb_private::repro::IndexToObject::GetObjectForIndex ( unsigned  idx)
inline

Returns an object as a pointer for the given index or nullptr if not present in the map.

Definition at line 237 of file ReproducerInstrumentation.h.

◆ GetObjectForIndexImpl()

void * IndexToObject::GetObjectForIndexImpl ( unsigned  idx)
private

Helper method that does the actual lookup.

The void* result is later cast by the caller.

Definition at line 18 of file ReproducerInstrumentation.cpp.

References m_mapping.

Member Data Documentation

◆ m_mapping

llvm::DenseMap<unsigned, void *> lldb_private::repro::IndexToObject::m_mapping
private

Keeps a mapping between indices and their corresponding object.

Definition at line 271 of file ReproducerInstrumentation.h.

Referenced by AddObjectForIndexImpl(), GetAllObjects(), lldb_private::repro::ObjectToIndex::GetIndexForObjectImpl(), and GetObjectForIndexImpl().


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