49 [&](
const std::shared_ptr<SupportFile> &support_file) {
50 return support_file->GetSpecOnly() == file_spec;
63 collection::const_iterator pos,
end =
m_files.end();
64 for (pos =
m_files.begin(); pos !=
end; ++pos) {
66 if (separator_cstr && ((pos + 1) !=
end))
77 bool full,
size_t num_files,
78 std::function<
const FileSpec &(
size_t)> get_ith) {
83 for (
size_t idx = start_idx; idx < num_files; ++idx) {
85 if (compare_filename_only) {
102 return ::FindFileIndex(
103 start_idx, file_spec, full,
m_files.size(),
104 [&](
size_t idx) ->
const FileSpec & { return m_files[idx]; });
110 return ::FindFileIndex(start_idx, file_spec, full,
m_files.size(),
111 [&](
size_t idx) ->
const FileSpec & {
112 return m_files[idx]->GetSpecOnly();
124 const bool file_spec_relative = file_spec.
IsRelative();
132 return IsCompatibleResult::kNoMatch;
138 return IsCompatibleResult::kBothDirectoryAndFileMatch;
139 }
else if (curr_file.
IsRelative() || file_spec_relative) {
141 if (curr_file_dir.empty())
143 return IsCompatibleResult::kBothDirectoryAndFileMatch;
151 auto is_suffix = [](llvm::StringRef a, llvm::StringRef b,
152 bool case_sensitive) ->
bool {
153 if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b))
154 return a.empty() || a.ends_with(
"/");
157 const bool case_sensitive =
159 if (is_suffix(curr_file_dir, file_spec_dir, case_sensitive) ||
160 is_suffix(file_spec_dir, curr_file_dir, case_sensitive))
161 return IsCompatibleResult::kBothDirectoryAndFileMatch;
163 return IsCompatibleResult::kOnlyFileMatch;
167 size_t start_idx,
const FileSpec &file_spec,
169 const size_t num_files =
m_files.size();
170 if (start_idx >= num_files)
173 for (
size_t idx = start_idx; idx < num_files; ++idx) {
177 if (result == IsCompatibleResult::kBothDirectoryAndFileMatch)
180 if (realpath_prefixes && result == IsCompatibleResult::kOnlyFileMatch) {
181 if (std::optional<FileSpec> resolved_curr_file =
184 IsCompatibleResult::kBothDirectoryAndFileMatch) {
189 "Realpath'ed support file %s is compatible to input file",
190 resolved_curr_file->GetPath().c_str());
207 return g_empty_file_spec;
212 return m_files[idx]->Materialize();
214 return g_empty_file_spec;
217std::shared_ptr<SupportFile>
230 collection::const_iterator pos,
end =
m_files.end();
231 for (pos =
m_files.begin(); pos !=
end; ++pos) {
232 mem_size += pos->MemorySize();
IsCompatibleResult IsCompatible(const FileSpec &curr_file, const FileSpec &file_spec)
static size_t FindFileIndex(size_t start_idx, const FileSpec &file_spec, bool full, size_t num_files, std::function< const FileSpec &(size_t)> get_ith)
@ kBothDirectoryAndFileMatch
#define LLDB_LOGF(log,...)
static bool Equals(ConstString lhs, ConstString rhs, const bool case_sensitive=true)
Equal to operator.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const_iterator end() const
const FileSpec & GetFileSpecAtIndex(size_t idx) const
Get file at index.
void Clear()
Clears the file list.
FileSpecList()
Default constructor.
void Append(const FileSpec &file)
Append a FileSpec object to the list.
size_t GetSize() const
Get the number of files in the file list.
size_t FindFileIndex(size_t idx, const FileSpec &file, bool full) const
Find a file index.
size_t MemorySize() const
Get the memory cost of this object.
bool AppendIfUnique(const FileSpec &file)
Append a FileSpec object if unique.
void Dump(Stream *s, const char *separator_cstr="\n") const
Dumps the file list to the supplied stream pointer "s".
~FileSpecList()
Destructor.
collection m_files
A collection of FileSpec objects.
static bool Equal(const FileSpec &a, const FileSpec &b, bool full)
bool IsRelative() const
Returns true if the filespec represents a relative path.
bool FileEquals(const FileSpec &other) const
const ConstString & GetFilename() const
Filename string const get accessor.
const ConstString & GetDirectory() const
Directory string const get accessor.
bool IsCaseSensitive() const
Case sensitivity of path.
std::optional< FileSpec > ResolveSymlinks(const FileSpec &file_spec)
void IncreaseSourceRealpathCompatibleCount()
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
const FileSpec & GetFileSpecAtIndex(size_t idx) const
void Append(const FileSpec &file)
size_t FindCompatibleIndex(size_t idx, const FileSpec &file, RealpathPrefixes *realpath_prefixes=nullptr) const
Find a compatible file index.
collection m_files
A collection of FileSpec objects.
bool AppendIfUnique(const FileSpec &file)
size_t FindFileIndex(size_t idx, const FileSpec &file, bool full) const
lldb::SupportFileSP GetSupportFileAtIndex(size_t idx) const
const_iterator end() const
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.