LLDB  mainline
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
lldb_private::PathMappingList Class Reference

#include <PathMappingList.h>

Collaboration diagram for lldb_private::PathMappingList:
Collaboration graph
[legend]

Public Types

typedef void(* ChangedCallback) (const PathMappingList &path_list, void *baton)
 

Public Member Functions

 PathMappingList ()
 
 PathMappingList (ChangedCallback callback, void *callback_baton)
 
 PathMappingList (const PathMappingList &rhs)
 
 ~PathMappingList ()
 
const PathMappingListoperator= (const PathMappingList &rhs)
 
void Append (ConstString path, ConstString replacement, bool notify)
 
void Append (const PathMappingList &rhs, bool notify)
 
void Clear (bool notify)
 
void Dump (Stream *s, int pair_index=-1)
 
bool IsEmpty () const
 
size_t GetSize () const
 
bool GetPathsAtIndex (uint32_t idx, ConstString &path, ConstString &new_path) const
 
void Insert (ConstString path, ConstString replacement, uint32_t insert_idx, bool notify)
 
bool Remove (size_t index, bool notify)
 
bool Remove (ConstString path, bool notify)
 
bool Replace (ConstString path, ConstString replacement, bool notify)
 
bool Replace (ConstString path, ConstString replacement, uint32_t index, bool notify)
 
bool RemapPath (ConstString path, ConstString &new_path) const
 
bool RemapPath (llvm::StringRef path, std::string &new_path) const
 Remaps a source file given path into new_path. More...
 
bool RemapPath (const char *, std::string &) const =delete
 
bool ReverseRemapPath (const FileSpec &file, FileSpec &fixed) const
 
bool FindFile (const FileSpec &orig_spec, FileSpec &new_spec) const
 Finds a source file given a file spec using the path remappings. More...
 
uint32_t FindIndexForPath (ConstString path) const
 
uint32_t GetModificationID () const
 

Protected Types

typedef std::pair< ConstString, ConstStringpair
 
typedef std::vector< paircollection
 
typedef collection::iterator iterator
 
typedef collection::const_iterator const_iterator
 

Protected Member Functions

iterator FindIteratorForPath (ConstString path)
 
const_iterator FindIteratorForPath (ConstString path) const
 

Protected Attributes

collection m_pairs
 
ChangedCallback m_callback
 
void * m_callback_baton
 
uint32_t m_mod_id
 

Detailed Description

Definition at line 19 of file PathMappingList.h.

Member Typedef Documentation

◆ ChangedCallback

typedef void(* lldb_private::PathMappingList::ChangedCallback) (const PathMappingList &path_list, void *baton)

Definition at line 21 of file PathMappingList.h.

◆ collection

typedef std::vector<pair> lldb_private::PathMappingList::collection
protected

Definition at line 112 of file PathMappingList.h.

◆ const_iterator

typedef collection::const_iterator lldb_private::PathMappingList::const_iterator
protected

Definition at line 114 of file PathMappingList.h.

◆ iterator

typedef collection::iterator lldb_private::PathMappingList::iterator
protected

Definition at line 113 of file PathMappingList.h.

◆ pair

Definition at line 111 of file PathMappingList.h.

Constructor & Destructor Documentation

◆ PathMappingList() [1/3]

PathMappingList::PathMappingList ( )

Definition at line 40 of file PathMappingList.cpp.

◆ PathMappingList() [2/3]

PathMappingList::PathMappingList ( ChangedCallback  callback,
void *  callback_baton 
)

Definition at line 43 of file PathMappingList.cpp.

◆ PathMappingList() [3/3]

PathMappingList::PathMappingList ( const PathMappingList rhs)

Definition at line 47 of file PathMappingList.cpp.

◆ ~PathMappingList()

PathMappingList::~PathMappingList ( )
default

Referenced by operator=().

Member Function Documentation

◆ Append() [1/2]

void PathMappingList::Append ( ConstString  path,
ConstString  replacement,
bool  notify 
)

◆ Append() [2/2]

void PathMappingList::Append ( const PathMappingList rhs,
bool  notify 
)

Definition at line 71 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ Clear()

void PathMappingList::Clear ( bool  notify)

◆ Dump()

void PathMappingList::Dump ( Stream s,
int  pair_index = -1 
)

◆ FindFile()

bool PathMappingList::FindFile ( const FileSpec orig_spec,
FileSpec new_spec 
) const

Finds a source file given a file spec using the path remappings.

Tries to resolve orig_spec by checking the path remappings. It makes sure the file exists by checking with the file system, so this call can be expensive if the remappings are on a network or are even on the local file system, so use this function sparingly (not in a tight debug info parsing loop).

Parameters
[in]orig_specThe original source file path to try and remap.
[out]new_specThe newly remapped filespec that is guaranteed to exist.
Returns
/b true if orig_spec was successfully located and new_spec is filled in with an existing file spec, false otherwise.

Definition at line 200 of file PathMappingList.cpp.

References lldb_private::FileSpec::AppendPathComponent(), lldb_private::FileSpec::Clear(), lldb_private::FileSpec::GetPath(), lldb_private::FileSystem::Instance(), lldb_private::FileSpec::IsRelative(), m_pairs, and lldb_private::FileSpec::SetFile().

Referenced by lldb_private::SourceManager::File::File(), lldb_private::Module::FindSourceFile(), and GetSize().

◆ FindIndexForPath()

uint32_t PathMappingList::FindIndexForPath ( ConstString  path) const

Definition at line 306 of file PathMappingList.cpp.

References m_pairs, and UINT32_MAX.

Referenced by GetSize(), and Replace().

◆ FindIteratorForPath() [1/2]

PathMappingList::iterator PathMappingList::FindIteratorForPath ( ConstString  path)
protected

Definition at line 284 of file PathMappingList.cpp.

References m_pairs.

Referenced by Remove().

◆ FindIteratorForPath() [2/2]

PathMappingList::const_iterator PathMappingList::FindIteratorForPath ( ConstString  path) const
protected

Definition at line 271 of file PathMappingList.cpp.

References m_pairs.

◆ GetModificationID()

uint32_t lldb_private::PathMappingList::GetModificationID ( ) const
inline

Definition at line 108 of file PathMappingList.h.

References m_mod_id.

Referenced by lldb_private::SourceManager::File::File().

◆ GetPathsAtIndex()

bool PathMappingList::GetPathsAtIndex ( uint32_t  idx,
ConstString path,
ConstString new_path 
) const

Definition at line 296 of file PathMappingList.cpp.

References m_pairs.

Referenced by GetSize().

◆ GetSize()

size_t lldb_private::PathMappingList::GetSize ( ) const
inline

◆ Insert()

void PathMappingList::Insert ( ConstString  path,
ConstString  replacement,
uint32_t  insert_idx,
bool  notify 
)

◆ IsEmpty()

bool lldb_private::PathMappingList::IsEmpty ( ) const
inline

Definition at line 45 of file PathMappingList.h.

References m_pairs.

◆ operator=()

const PathMappingList & PathMappingList::operator= ( const PathMappingList rhs)

Definition at line 51 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, m_pairs, and ~PathMappingList().

◆ RemapPath() [1/3]

bool PathMappingList::RemapPath ( ConstString  path,
ConstString new_path 
) const

◆ RemapPath() [2/3]

bool PathMappingList::RemapPath ( llvm::StringRef  path,
std::string &  new_path 
) const

Remaps a source file given path into new_path.

Remaps path if any source remappings match. This function does NOT stat the file system so it can be used in tight loops where debug info is being parsed.

Parameters
[in]pathThe original source file path to try and remap.
[out]new_pathThe newly remapped filespec that is may or may not exist.
Returns
/b true if path was successfully located and new_path is filled in with a new source path, false otherwise.

Definition at line 157 of file PathMappingList.cpp.

References lldb_private::FileSpec::AppendPathComponent(), lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, lldb_private::FileSpec::IsRelative(), and m_pairs.

◆ RemapPath() [3/3]

bool lldb_private::PathMappingList::RemapPath ( const char *  ,
std::string &   
) const
delete

◆ Remove() [1/2]

bool PathMappingList::Remove ( size_t  index,
bool  notify 
)

Definition at line 109 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

Referenced by GetSize().

◆ Remove() [2/2]

bool PathMappingList::Remove ( ConstString  path,
bool  notify 
)

Definition at line 258 of file PathMappingList.cpp.

References FindIteratorForPath(), m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ Replace() [1/2]

bool PathMappingList::Replace ( ConstString  path,
ConstString  replacement,
bool  notify 
)

Definition at line 245 of file PathMappingList.cpp.

References FindIndexForPath(), m_callback, m_callback_baton, m_mod_id, and m_pairs.

Referenced by GetSize().

◆ Replace() [2/2]

bool PathMappingList::Replace ( ConstString  path,
ConstString  replacement,
uint32_t  index,
bool  notify 
)

Definition at line 97 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ ReverseRemapPath()

bool PathMappingList::ReverseRemapPath ( const FileSpec file,
FileSpec fixed 
) const

Member Data Documentation

◆ m_callback

ChangedCallback lldb_private::PathMappingList::m_callback
protected

Definition at line 121 of file PathMappingList.h.

Referenced by Append(), Clear(), Insert(), operator=(), Remove(), and Replace().

◆ m_callback_baton

void* lldb_private::PathMappingList::m_callback_baton
protected

Definition at line 122 of file PathMappingList.h.

Referenced by Append(), Clear(), Insert(), operator=(), Remove(), and Replace().

◆ m_mod_id

uint32_t lldb_private::PathMappingList::m_mod_id
protected

Definition at line 123 of file PathMappingList.h.

Referenced by Append(), Clear(), GetModificationID(), Insert(), operator=(), Remove(), and Replace().

◆ m_pairs

collection lldb_private::PathMappingList::m_pairs
protected

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