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

A file collection class. More...

#include "lldb/Utility/FileSpecList.h"

Public Types

typedef std::vector< FileSpeccollection
 
typedef collection::const_iterator const_iterator
 

Public Member Functions

 FileSpecList ()
 Default constructor.
 
 FileSpecList (const FileSpecList &rhs)=default
 Copy constructor.
 
 FileSpecList (FileSpecList &&rhs)=default
 Move constructor.
 
 FileSpecList (std::vector< FileSpec > &&rhs)
 Initialize this object from a vector of FileSpecs.
 
 ~FileSpecList ()
 Destructor.
 
FileSpecListoperator= (const FileSpecList &rhs)=default
 Assignment operator.
 
FileSpecListoperator= (FileSpecList &&rhs)=default
 Move-assignment operator.
 
void Append (const FileSpec &file)
 Append a FileSpec object to the list.
 
bool AppendIfUnique (const FileSpec &file)
 Append a FileSpec object if unique.
 
template<class... Args>
void EmplaceBack (Args &&...args)
 Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.
 
void Clear ()
 Clears the file list.
 
void Dump (Stream *s, const char *separator_cstr="\n") const
 Dumps the file list to the supplied stream pointer "s".
 
size_t FindFileIndex (size_t idx, const FileSpec &file, bool full) const
 Find a file index.
 
size_t FindCompatibleIndex (size_t idx, const FileSpec &file) const
 Find a compatible file index.
 
const FileSpecGetFileSpecAtIndex (size_t idx) const
 Get file at index.
 
const FileSpecGetFileSpecPointerAtIndex (size_t idx) const
 Get file specification pointer at index.
 
size_t MemorySize () const
 Get the memory cost of this object.
 
bool IsEmpty () const
 
size_t GetSize () const
 Get the number of files in the file list.
 
bool Insert (size_t idx, const FileSpec &file)
 
bool Replace (size_t idx, const FileSpec &file)
 
bool Remove (size_t idx)
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

static size_t GetFilesMatchingPartialPath (const char *path, bool dir_okay, FileSpecList &matches)
 

Protected Attributes

collection m_files
 A collection of FileSpec objects.
 

Detailed Description

A file collection class.

A class that contains a mutable list of FileSpec objects.

Definition at line 24 of file FileSpecList.h.

Member Typedef Documentation

◆ collection

Definition at line 26 of file FileSpecList.h.

◆ const_iterator

typedef collection::const_iterator lldb_private::FileSpecList::const_iterator

Definition at line 27 of file FileSpecList.h.

Constructor & Destructor Documentation

◆ FileSpecList() [1/4]

FileSpecList::FileSpecList ( )

Default constructor.

Initialize this object with an empty file list.

Definition at line 18 of file FileSpecList.cpp.

Referenced by MemorySize().

◆ FileSpecList() [2/4]

lldb_private::FileSpecList::FileSpecList ( const FileSpecList rhs)
default

Copy constructor.

◆ FileSpecList() [3/4]

lldb_private::FileSpecList::FileSpecList ( FileSpecList &&  rhs)
default

Move constructor.

◆ FileSpecList() [4/4]

lldb_private::FileSpecList::FileSpecList ( std::vector< FileSpec > &&  rhs)
inline

Initialize this object from a vector of FileSpecs.

Definition at line 41 of file FileSpecList.h.

◆ ~FileSpecList()

FileSpecList::~FileSpecList ( )
default

Destructor.

Member Function Documentation

◆ Append()

void FileSpecList::Append ( const FileSpec file)

◆ AppendIfUnique()

bool FileSpecList::AppendIfUnique ( const FileSpec file)

Append a FileSpec object if unique.

Appends file to the end of the file list if it doesn't already exist in the file list.

Parameters
[in]fileA new file to append to this file list.
Returns
true if the file was appended, false otherwise.

Definition at line 31 of file FileSpecList.cpp.

References end(), and m_files.

Referenced by ObjectFileELF::GetDependentModules(), ObjectFileMachO::GetDependentModules(), ObjectFilePECOFF::GetDependentModules(), GetModuleConfig(), lldb_private::Symbols::LocateExecutableSymbolFile(), SymbolFilePDB::ParseSupportFiles(), ObjectFileMachO::ParseSymtab(), CommandObjectBreakpointSet::CommandOptions::SetOptionValue(), and CommandObjectThreadJump::CommandOptions::SetOptionValue().

◆ begin()

const_iterator lldb_private::FileSpecList::begin ( ) const
inline

Definition at line 219 of file FileSpecList.h.

References m_files.

◆ Clear()

void FileSpecList::Clear ( )

◆ Dump()

void FileSpecList::Dump ( Stream s,
const char *  separator_cstr = "\n" 
) const

Dumps the file list to the supplied stream pointer "s".

Parameters
[in]sThe stream that will be used to dump the object description.

Definition at line 44 of file FileSpecList.cpp.

References lldb_private::Stream::AsRawOstream(), end(), m_files, and lldb_private::Stream::PutCString().

◆ EmplaceBack()

template<class... Args>
void lldb_private::FileSpecList::EmplaceBack ( Args &&...  args)
inline

Inserts a new FileSpec into the FileSpecList constructed in-place with the given arguments.

Parameters
[in]argsArguments to create the FileSpec

Definition at line 85 of file FileSpecList.h.

References m_files.

Referenced by lldb_private::ItaniumABILanguageRuntime::CreateExceptionSearchFilter(), lldb_private::SearchFilterByModuleListAndCU::CreateFromStructuredData(), and lldb_private::PlatformDarwin::SetThreadCreationBreakpoint().

◆ end()

const_iterator lldb_private::FileSpecList::end ( ) const
inline

Definition at line 220 of file FileSpecList.h.

References m_files.

Referenced by AppendIfUnique(), Dump(), and MemorySize().

◆ FindCompatibleIndex()

size_t FileSpecList::FindCompatibleIndex ( size_t  idx,
const FileSpec file 
) const

Find a compatible file index.

Find the index of a compatible file in the file spec list that matches file starting idx entries into the file spec list. A file is considered compatible if:

  • The file matches exactly (only filename if file has no directory)
  • If file is relative and any file in the list has this same suffix
  • If any file in the list is relative and the relative path is a suffix of file

This is used to implement better matching for setting breakpoints in source files where an IDE might specify a full path when setting the breakpoint and debug info contains relative paths, if a user specifies a relative path when setting a breakpoint.

Parameters
[in]idxAn index into the file list.
[in]fileThe file specification to search for.
Returns
The index of the file that matches file if it is found, else UINT32_MAX is returned.

Definition at line 82 of file FileSpecList.cpp.

References lldb_private::FileSpec::Equal(), lldb_private::FileSpec::FileEquals(), lldb_private::FileSpec::GetDirectory(), lldb_private::ConstString::GetStringRef(), lldb_private::FileSpec::IsCaseSensitive(), lldb_private::ConstString::IsEmpty(), lldb_private::FileSpec::IsRelative(), m_files, and UINT32_MAX.

Referenced by FindFileIndexes().

◆ FindFileIndex()

size_t FileSpecList::FindFileIndex ( size_t  idx,
const FileSpec file,
bool  full 
) const

Find a file index.

Find the index of the file in the file spec list that matches file starting idx entries into the file spec list.

Parameters
[in]idxAn index into the file list.
[in]fileThe file specification to search for.
[in]fullShould FileSpec::Equal be called with "full" true or false.
Returns
The index of the file that matches file if it is found, else UINT32_MAX is returned.

Definition at line 58 of file FileSpecList.cpp.

References lldb_private::FileSpec::Equal(), lldb_private::ConstString::Equals(), lldb_private::FileSpec::GetDirectory(), lldb_private::FileSpec::GetFilename(), lldb_private::FileSpec::IsCaseSensitive(), lldb_private::ConstString::IsEmpty(), m_files, and UINT32_MAX.

Referenced by lldb_private::SearchFilterByModuleListAndCU::AddressPasses(), lldb_private::SearchFilterByModuleListAndCU::CompUnitPasses(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), lldb::SBCompileUnit::FindSupportFileIndex(), lldb_private::SearchFilterByModuleList::ModulePasses(), lldb_private::SearchFilterByModuleList::Search(), lldb_private::SearchFilterByModuleListAndCU::Search(), and lldb_private::FileLineResolver::SearchCallback().

◆ GetFilesMatchingPartialPath()

size_t FileSpecList::GetFilesMatchingPartialPath ( const char *  path,
bool  dir_okay,
FileSpecList matches 
)
static

Definition at line 166 of file FileSpecList.cpp.

◆ GetFileSpecAtIndex()

const FileSpec & FileSpecList::GetFileSpecAtIndex ( size_t  idx) const

Get file at index.

Gets a file from the file list. If idx is not a valid index, an empty FileSpec object will be returned. The file objects that are returned can be tested using FileSpec::operator void*().

Parameters
[in]idxAn index into the file list.
Returns
A copy of the FileSpec object at index idx. If idx is out of range, then an empty FileSpec object will be returned.

Definition at line 136 of file FileSpecList.cpp.

References m_files.

Referenced by lldb_private::LineTable::ConvertEntryAtIndexToLineEntry(), lldb_private::ClangModulesDeclVendor::Create(), CommandObjectTargetVariable::DoExecute(), CommandObjectThreadJump::DoExecute(), CommandObjectBreakpointSet::DoExecute(), CommandObjectSourceInfo::DumpFileLinesInCompUnit(), lldb_private::OptionValueFileSpecList::DumpValue(), lldb_private::PlatformDarwin::FindBundleBinaryInExecSearchPaths(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), lldb_private::SearchFilterByModuleList::GetDescription(), lldb_private::SearchFilterByModuleListAndCU::GetDescription(), SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), SymbolFileDWARF::GetFile(), lldb_private::DebugMacroEntry::GetFileSpec(), lldb_private::ModuleList::GetSharedModule(), lldb_private::PlatformDarwin::GetSharedModule(), lldb::SBCompileUnit::GetSupportFileAtIndex(), lldb_private::Module::LoadScriptingResourceInTarget(), lldb_private::Symbols::LocateExecutableSymbolFile(), SymbolFileDWARF::ParseBlocksRecursive(), SymbolFileDWARF::ParseCompileUnit(), lldb_private::npdb::SymbolFileNativePDB::ParseInlineSite(), ObjectFileMachO::ParseSymtab(), lldb_private::Symbol::ResolveReExportedSymbolInModuleSpec(), lldb_private::SearchFilter::SerializeFileSpecList(), and lldb_private::Target::SetExecutableModule().

◆ GetFileSpecPointerAtIndex()

const FileSpec * FileSpecList::GetFileSpecPointerAtIndex ( size_t  idx) const

Get file specification pointer at index.

Gets a file from the file list. The file objects that are returned can be tested using FileSpec::operator void*().

Parameters
[in]idxAn index into the file list.
Returns
A pointer to a contained FileSpec object at index idx. If idx is out of range, then an NULL is returned.

Definition at line 143 of file FileSpecList.cpp.

References m_files.

Referenced by CommandObjectBreakpointSet::DoExecute().

◆ GetSize()

size_t FileSpecList::GetSize ( ) const

Get the number of files in the file list.

Returns
The number of files in the file spec list.

Definition at line 164 of file FileSpecList.cpp.

References m_files.

Referenced by lldb_private::SearchFilterByModuleListAndCU::AddressPasses(), lldb_private::ClangModulesDeclVendor::Create(), lldb_private::Target::CreateScriptedBreakpoint(), lldb_private::TargetList::CreateTargetInternal(), CommandObjectTargetVariable::DoExecute(), CommandObjectThreadJump::DoExecute(), CommandObjectBreakpointSet::DoExecute(), lldb_private::OptionValueFileSpecList::DumpValue(), lldb_private::PlatformDarwin::FindBundleBinaryInExecSearchPaths(), lldb_private::ThreadPlanStepInRange::FrameMatchesAvoidCriteria(), ObjectFilePECOFF::GetDependentModules(), lldb_private::SearchFilterByModuleList::GetDescription(), lldb_private::SearchFilterByModuleListAndCU::GetDescription(), SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), GetModuleConfig(), lldb::SBCompileUnit::GetNumSupportFiles(), lldb_private::Target::GetSearchFilterForModuleAndCUList(), lldb_private::Target::GetSearchFilterForModuleList(), lldb_private::ModuleList::GetSharedModule(), lldb_private::PlatformDarwin::GetSharedModule(), lldb_private::CompileUnit::GetSupportFiles(), lldb_private::Module::LoadScriptingResourceInTarget(), lldb_private::Symbols::LocateExecutableSymbolFile(), lldb_private::SearchFilterByModuleList::ModulePasses(), SymbolFileDWARF::ParseCompileUnit(), ObjectFileMachO::ParseSymtab(), lldb_private::Symbol::ResolveReExportedSymbolInModuleSpec(), lldb_private::SearchFilterByModuleListAndCU::Search(), lldb_private::SearchFilter::SerializeFileSpecList(), lldb_private::Target::SetExecutableModule(), CommandObjectThreadJump::CommandOptions::SetOptionValue(), and lldb_private::OptionValueFileSpecList::SetValueFromString().

◆ Insert()

bool lldb_private::FileSpecList::Insert ( size_t  idx,
const FileSpec file 
)
inline

Definition at line 189 of file FileSpecList.h.

References m_files.

Referenced by lldb_private::OptionValueFileSpecList::SetValueFromString().

◆ IsEmpty()

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

Definition at line 181 of file FileSpecList.h.

References m_files.

◆ MemorySize()

size_t FileSpecList::MemorySize ( ) const

Get the memory cost of this object.

Return the size in bytes that this object takes in memory. This returns the size in bytes of this object, not any shared string values it may refer to.

Returns
The number of bytes that this object occupies in memory.

Definition at line 153 of file FileSpecList.cpp.

References end(), FileSpecList(), and m_files.

◆ operator=() [1/2]

FileSpecList & lldb_private::FileSpecList::operator= ( const FileSpecList rhs)
default

Assignment operator.

Replace the file list in this object with the file list from rhs.

Parameters
[in]rhsA file list object to copy.
Returns
A const reference to this object.

◆ operator=() [2/2]

FileSpecList & lldb_private::FileSpecList::operator= ( FileSpecList &&  rhs)
default

Move-assignment operator.

◆ Remove()

bool lldb_private::FileSpecList::Remove ( size_t  idx)
inline

Definition at line 208 of file FileSpecList.h.

References m_files.

Referenced by lldb_private::OptionValueFileSpecList::SetValueFromString().

◆ Replace()

bool lldb_private::FileSpecList::Replace ( size_t  idx,
const FileSpec file 
)
inline

Definition at line 200 of file FileSpecList.h.

References m_files.

Referenced by lldb_private::OptionValueFileSpecList::SetValueFromString().

Member Data Documentation

◆ m_files

collection lldb_private::FileSpecList::m_files
protected

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