Lines Matching defs:path
25 // We must normalize our path pairs that we store because if we don't then
28 // We would store a path pairs of "." and "/tmp" as raw strings. If the debug
29 // info contains "./foo/bar.c", the path will get normalized to "foo/bar.c".
30 // When PathMappingList::RemapPath() is called, it expects the path to start
31 // with the raw path pair, which doesn't work anymore because the paths have
33 // nomalized path pairs to ensure things match up.
34 std::string NormalizePath(llvm::StringRef path) {
35 // If we use "path" to construct a FileSpec, it will normalize the path for
37 return FileSpec(path).GetPath();
63 void PathMappingList::AppendNoLock(llvm::StringRef path,
66 m_pairs.emplace_back(pair(NormalizePath(path), NormalizePath(replacement)));
81 void PathMappingList::Append(llvm::StringRef path, llvm::StringRef replacement,
85 AppendNoLock(path, replacement);
104 bool PathMappingList::AppendUnique(llvm::StringRef path,
106 auto normalized_path = NormalizePath(path);
115 AppendNoLock(path, replacement);
121 void PathMappingList::Insert(llvm::StringRef path, llvm::StringRef replacement,
132 pair(NormalizePath(path), NormalizePath(replacement)));
137 bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef replacement,
144 m_pairs[index] = pair(NormalizePath(path), NormalizePath(replacement));
204 bool PathMappingList::RemapPath(ConstString path,
206 if (std::optional<FileSpec> remapped = RemapPath(path.GetStringRef())) {
213 /// Append components to path, applying style.
214 static void AppendPathComponents(FileSpec &path, llvm::StringRef components,
215 llvm::sys::path::Style style) {
216 auto component = llvm::sys::path::begin(components, style);
217 auto e = llvm::sys::path::end(components);
219 llvm::sys::path::is_separator(*component->data(), style))
222 path.AppendPathComponent(*component);
236 llvm::StringRef path = mapping_path;
237 if (!path.consume_front(prefix)) {
239 // only thing in the relative path so we need to work around "."
243 // We need to figure out if the "path" argument is relative. If it is,
247 FileSpec(path).IsRelative() ? eLazyBoolYes : eLazyBoolNo;
254 llvm::sys::path::Style::native);
255 AppendPathComponents(remapped, path, orig_style);
264 std::string path = file.GetPath();
265 llvm::StringRef path_ref(path);
273 llvm::sys::path::Style::native);
283 // We must normalize the orig_spec again using the host's path style,
285 // if they use different path styles.
293 bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef new_path,
297 uint32_t idx = FindIndexForPathNoLock(path);
307 bool PathMappingList::Remove(ConstString path, bool notify) {
310 iterator pos = FindIteratorForPath(path);
322 PathMappingList::FindIteratorForPath(ConstString path) const {
329 if (pos->first == path)
336 PathMappingList::FindIteratorForPath(ConstString path) {
343 if (pos->first == path)
349 bool PathMappingList::GetPathsAtIndex(uint32_t idx, ConstString &path,
353 path = m_pairs[idx].first;
362 const ConstString path = ConstString(NormalizePath(orig_path));
368 if (pos->first == path)