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();
62 void PathMappingList::Append(llvm::StringRef path, llvm::StringRef replacement,
66 m_pairs.emplace_back(pair(NormalizePath(path), NormalizePath(replacement)));
83 bool PathMappingList::AppendUnique(llvm::StringRef path,
85 auto normalized_path = NormalizePath(path);
93 Append(path, replacement, notify);
97 void PathMappingList::Insert(llvm::StringRef path, llvm::StringRef replacement,
106 m_pairs.emplace(insert_iter, pair(NormalizePath(path),
112 bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef replacement,
118 m_pairs[index] = pair(NormalizePath(path), NormalizePath(replacement));
176 bool PathMappingList::RemapPath(ConstString path,
178 if (std::optional<FileSpec> remapped = RemapPath(path.GetStringRef())) {
185 /// Append components to path, applying style.
186 static void AppendPathComponents(FileSpec &path, llvm::StringRef components,
187 llvm::sys::path::Style style) {
188 auto component = llvm::sys::path::begin(components, style);
189 auto e = llvm::sys::path::end(components);
191 llvm::sys::path::is_separator(*component->data(), style))
194 path.AppendPathComponent(*component);
208 llvm::StringRef path = mapping_path;
209 if (!path.consume_front(prefix)) {
211 // only thing in the relative path so we need to work around "."
215 // We need to figure out if the "path" argument is relative. If it is,
219 FileSpec(path).IsRelative() ? eLazyBoolYes : eLazyBoolNo;
226 llvm::sys::path::Style::native);
227 AppendPathComponents(remapped, path, orig_style);
236 std::string path = file.GetPath();
237 llvm::StringRef path_ref(path);
245 llvm::sys::path::Style::native);
255 // We must normalize the orig_spec again using the host's path style,
257 // if they use different path styles.
265 bool PathMappingList::Replace(llvm::StringRef path, llvm::StringRef new_path,
268 uint32_t idx = FindIndexForPath(path);
279 bool PathMappingList::Remove(ConstString path, bool notify) {
281 iterator pos = FindIteratorForPath(path);
293 PathMappingList::FindIteratorForPath(ConstString path) const {
300 if (pos->first == path)
307 PathMappingList::FindIteratorForPath(ConstString path) {
314 if (pos->first == path)
320 bool PathMappingList::GetPathsAtIndex(uint32_t idx, ConstString &path,
324 path = m_pairs[idx].first;
332 const ConstString path = ConstString(NormalizePath(orig_path));
339 if (pos->first == path)