9#ifndef LLDB_TARGET_PATHMAPPINGLIST_H
10#define LLDB_TARGET_PATHMAPPINGLIST_H
13#include "llvm/Support/Error.h"
14#include "llvm/Support/JSON.h"
37 void Append(llvm::StringRef path, llvm::StringRef replacement,
bool notify);
43 bool AppendUnique(llvm::StringRef path, llvm::StringRef replacement,
46 void Clear(
bool notify);
51 llvm::json::Value
ToJSON()
const;
64 std::string &new_path)
const;
66 void Insert(llvm::StringRef path, llvm::StringRef replacement,
67 uint32_t insert_idx,
bool notify);
69 bool Remove(
size_t index,
bool notify);
71 bool Remove(llvm::StringRef path,
bool notify);
73 bool Replace(llvm::StringRef path, llvm::StringRef replacement,
bool notify);
75 bool Replace(llvm::StringRef path, llvm::StringRef replacement,
76 uint32_t index,
bool notify);
77 bool RemapPath(llvm::StringRef path, std::string &new_path)
const;
99 std::optional<FileSpec>
RemapPath(llvm::StringRef path,
100 bool only_if_exists =
false)
const;
101 bool RemapPath(
const char *, std::string &)
const =
delete;
141 typedef std::pair<std::string, std::string>
pair;
146 void AppendNoLock(llvm::StringRef path, llvm::StringRef replacement);
148 void Notify(
bool notify)
const;
bool Remove(size_t index, bool notify)
std::vector< pair > collection
bool RemapPath(const char *, std::string &) const =delete
bool AppendUnique(llvm::StringRef path, llvm::StringRef replacement, bool notify)
Append <path, replacement> pair without duplication.
uint32_t FindIndexForPathNoLock(llvm::StringRef path) const
std::optional< FileSpec > FindFile(const FileSpec &orig_spec) const
Finds a source file given a file spec using the path remappings.
bool Replace(llvm::StringRef path, llvm::StringRef replacement, bool notify)
llvm::json::Value ToJSON() const
bool RemapPath(llvm::StringRef path, std::string &new_path) const
void(* ChangedCallback)(const PathMappingList &path_list, void *baton)
void Insert(llvm::StringRef path, llvm::StringRef replacement, uint32_t insert_idx, bool notify)
uint32_t GetModificationID() const
collection::const_iterator const_iterator
ChangedCallback m_callback
const PathMappingList & operator=(const PathMappingList &rhs)
void AppendNoLock(llvm::StringRef path, llvm::StringRef replacement)
void Append(llvm::StringRef path, llvm::StringRef replacement, bool notify)
iterator FindIteratorForPath(llvm::StringRef path)
std::pair< std::string, std::string > pair
collection::iterator iterator
bool GetPathsAtIndex(uint32_t idx, std::string &path, std::string &new_path) const
uint32_t m_mod_id
Incremented anytime anything is added to or removed from m_pairs.
void Notify(bool notify) const
std::mutex m_callback_mutex
std::optional< llvm::StringRef > ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const
Perform reverse source path remap for input file.
void Dump(Stream *s, int pair_index=-1)
A stream class that can stream formatted output to a file.
A class that represents a running process on the host machine.