diff options
Diffstat (limited to 'lldb/source/Target/PathMappingList.cpp')
-rw-r--r-- | lldb/source/Target/PathMappingList.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp index 6acd8bfe46d..345bbed3b14 100644 --- a/lldb/source/Target/PathMappingList.cpp +++ b/lldb/source/Target/PathMappingList.cpp @@ -174,6 +174,27 @@ PathMappingList::RemapPath (const ConstString &path, ConstString &new_path) cons } bool +PathMappingList::RemapPath (const char *path, std::string &new_path) const +{ + if (!m_pairs.empty() || path == NULL || path[0] == '\0') + return false; + + const_iterator pos, end = m_pairs.end(); + for (pos = m_pairs.begin(); pos != end; ++pos) + { + const size_t prefix_len = pos->first.GetLength(); + + if (::strncmp (pos->first.GetCString(), path, prefix_len) == 0) + { + new_path = pos->second.GetCString(); + new_path.append(path + prefix_len); + return true; + } + } + return false; +} + +bool PathMappingList::FindFile (const FileSpec &orig_spec, FileSpec &new_spec) const { if (!m_pairs.empty()) |