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 241 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 reference to an object to the mapping for the given index.

Definition at line 260 of file ReproducerInstrumentation.h.

References AddObjectForIndexImpl().

◆ AddObjectForIndex() [2/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 252 of file ReproducerInstrumentation.h.

References AddObjectForIndexImpl().

Referenced by lldb_private::repro::Deserializer::HandleReplayResult().

◆ AddObjectForIndexImpl()

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

Helper method that does the actual insertion.

Definition at line 26 of file ReproducerInstrumentation.cpp.

References m_mapping.

Referenced by AddObjectForIndex().

◆ GetAllObjects()

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

Get all objects sorted by their index.

Definition at line 31 of file ReproducerInstrumentation.cpp.

References m_mapping.

Referenced by lldb_private::repro::Deserializer::GetAllObjects().

◆ 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 245 of file ReproducerInstrumentation.h.

References GetObjectForIndexImpl().

◆ 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 22 of file ReproducerInstrumentation.cpp.

References m_mapping.

Referenced by GetObjectForIndex().

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 279 of file ReproducerInstrumentation.h.

Referenced by AddObjectForIndexImpl(), GetAllObjects(), and GetObjectForIndexImpl().


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