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
 
llvm::Optional< FileSpecRemapPath (llvm::StringRef path, bool only_if_exists=false) 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
 
llvm::Optional< FileSpecFindFile (const FileSpec &orig_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 = nullptr
 
void * m_callback_baton = nullptr
 
uint32_t m_mod_id = 0
 

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 113 of file PathMappingList.h.

◆ const_iterator

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

Definition at line 115 of file PathMappingList.h.

◆ iterator

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

Definition at line 114 of file PathMappingList.h.

◆ pair

Definition at line 112 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 42 of file PathMappingList.cpp.

◆ PathMappingList() [3/3]

PathMappingList::PathMappingList ( const PathMappingList rhs)

Definition at line 46 of file PathMappingList.cpp.

◆ ~PathMappingList()

PathMappingList::~PathMappingList ( )
default

Member Function Documentation

◆ Append() [1/2]

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

Definition at line 70 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ Append() [2/2]

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

◆ Clear()

void PathMappingList::Clear ( bool  notify)

◆ Dump()

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

◆ FindFile()

llvm::Optional< FileSpec > PathMappingList::FindFile ( const FileSpec orig_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.
Returns
The newly remapped filespec that is guaranteed to exist.

Definition at line 220 of file PathMappingList.cpp.

References lldb_private::FileSpec::GetPath(), and RemapPath().

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

◆ FindIndexForPath()

uint32_t PathMappingList::FindIndexForPath ( ConstString  path) const

Definition at line 288 of file PathMappingList.cpp.

References m_pairs, and UINT32_MAX.

Referenced by Replace().

◆ FindIteratorForPath() [1/2]

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

Definition at line 266 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 253 of file PathMappingList.cpp.

References m_pairs.

◆ GetModificationID()

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

Definition at line 109 of file PathMappingList.h.

References m_mod_id.

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

◆ GetPathsAtIndex()

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

◆ 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 50 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ RemapPath() [1/3]

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

◆ RemapPath() [2/3]

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

◆ RemapPath() [3/3]

llvm::Optional< FileSpec > PathMappingList::RemapPath ( llvm::StringRef  path,
bool  only_if_exists = false 
) 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.
[in]only_if_existsIf true, besides matching path with the remapping rules, this tries to check with the filesystem that the remapped file exists. If no valid file is found, None is returned. This might be expensive, specially on a network.

If false, then the existence of the returned remapping is not checked.

Returns
The remapped filespec that may or may not exist on disk.

Definition at line 168 of file PathMappingList.cpp.

References AppendPathComponents(), lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolNo, lldb_private::eLazyBoolYes, lldb_private::FileSpec::GuessPathStyle(), lldb_private::FileSystem::Instance(), lldb_private::FileSpec::IsRelative(), and m_pairs.

◆ Remove() [1/2]

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

Definition at line 240 of file PathMappingList.cpp.

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

◆ Remove() [2/2]

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

Definition at line 108 of file PathMappingList.cpp.

References m_callback, m_callback_baton, m_mod_id, and m_pairs.

◆ Replace() [1/2]

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

◆ Replace() [2/2]

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

Definition at line 96 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 = nullptr
protected

Definition at line 122 of file PathMappingList.h.

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

◆ m_callback_baton

void* lldb_private::PathMappingList::m_callback_baton = nullptr
protected

Definition at line 123 of file PathMappingList.h.

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

◆ m_mod_id

uint32_t lldb_private::PathMappingList::m_mod_id = 0
protected

Definition at line 124 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: