Lines Matching refs:Path
1 //===-- Path.cpp - Implement OS Path Concept ------------------------------===//
9 // This file implements the operating system Path API.
13 #include "llvm/Support/Path.h"
228 i.Path = path;
237 i.Path = path;
243 assert(Position < Path.size() && "Tried to increment past end!");
249 if (Position == Path.size()) {
260 if (is_separator(Path[Position], S)) {
265 Component = Path.substr(Position, 1);
270 while (Position != Path.size() && is_separator(Path[Position], S)) {
275 if (Position == Path.size() && Component != "/") {
283 size_t end_pos = Path.find_first_of(separators(S), Position);
284 Component = Path.slice(Position, end_pos);
290 return Path.begin() == RHS.Path.begin() && Position == RHS.Position;
297 reverse_iterator rbegin(StringRef Path, Style style) {
299 I.Path = Path;
300 I.Position = Path.size();
306 reverse_iterator rend(StringRef Path) {
308 I.Path = Path;
309 I.Component = Path.substr(0, 0);
315 size_t root_dir_pos = root_dir_start(Path, S);
320 is_separator(Path[end_pos - 1], S))
324 if (Position == Path.size() && !Path.empty() &&
325 is_separator(Path.back(), S) &&
333 size_t start_pos = filename_pos(Path.substr(0, end_pos), S);
334 Component = Path.slice(start_pos, end_pos);
340 return Path.begin() == RHS.Path.begin() && Component == RHS.Component &&
499 static bool starts_with(StringRef Path, StringRef Prefix,
503 if (Path.size() < Prefix.size())
506 bool SepPath = is_separator(Path[I], style);
510 if (!SepPath && toLower(Path[I]) != toLower(Prefix[I]))
515 return Path.starts_with(Prefix);
518 bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
523 StringRef OrigPath(Path.begin(), Path.size());
529 llvm::copy(NewPrefix, Path.begin());
536 Path.swap(NewPath);
550 void native(SmallVectorImpl<char> &Path, Style style) {
551 if (Path.empty())
554 for (char &Ch : Path)
557 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) {
560 PathHome.append(Path.begin() + 1, Path.end());
561 Path = PathHome;
564 std::replace(Path.begin(), Path.end(), '\\', '/');
703 StringRef remove_leading_dotslash(StringRef Path, Style style) {
705 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) {
706 Path = Path.substr(2);
707 while (Path.size() > 0 && is_separator(Path[0], style))
708 Path = Path.substr(1);
710 return Path;
787 std::error_code getUniqueID(const Twine Path, UniqueID &Result) {
789 std::error_code EC = status(Path, Status);
967 std::error_code create_directories(const Twine &Path, bool IgnoreExisting,
970 StringRef P = Path.toStringRef(PathStorage);
1067 ErrorOr<MD5::MD5Result> md5_contents(const Twine &Path) {
1069 if (auto EC = openFileForRead(Path, FD, OF_None))
1085 file_type get_file_type(const Twine &Path, bool Follow) {
1087 if (status(Path, st, Follow))
1134 std::error_code is_other(const Twine &Path, bool &Result) {
1136 if (std::error_code EC = status(Path, FileStatus))
1144 SmallString<128> PathStr = path::parent_path(Path);
1146 this->Path = std::string(PathStr);
1151 ErrorOr<perms> getPermissions(const Twine &Path) {
1153 if (std::error_code EC = status(Path, Status))
1199 #include "Unix/Path.inc"
1202 #include "Windows/Path.inc"