Lines Matching refs:path
37 using llvm::sys::path::is_separator;
38 using llvm::sys::path::Style;
60 StringRef find_first_component(StringRef path, Style style) { in find_first_component() argument
67 if (path.empty()) in find_first_component()
68 return path; in find_first_component()
72 if (path.size() >= 2 && in find_first_component()
73 std::isalpha(static_cast<unsigned char>(path[0])) && path[1] == ':') in find_first_component()
74 return path.substr(0, 2); in find_first_component()
78 if ((path.size() > 2) && is_separator(path[0], style) && in find_first_component()
79 path[0] == path[1] && !is_separator(path[2], style)) { in find_first_component()
81 size_t end = path.find_first_of(separators(style), 2); in find_first_component()
82 return path.substr(0, end); in find_first_component()
86 if (is_separator(path[0], style)) in find_first_component()
87 return path.substr(0, 1); in find_first_component()
90 size_t end = path.find_first_of(separators(style)); in find_first_component()
91 return path.substr(0, end); in find_first_component()
138 size_t parent_path_end(StringRef path, Style style) { in parent_path_end() argument
139 size_t end_pos = filename_pos(path, style); in parent_path_end()
142 path.size() > 0 && is_separator(path[end_pos], style); in parent_path_end()
145 size_t root_dir_pos = root_dir_start(path, style); in parent_path_end()
148 is_separator(path[end_pos - 1], style)) in parent_path_end()
178 if (!sys::path::is_absolute(Twine(ModelStorage))) { in createUniqueEntity()
180 sys::path::system_temp_directory(true, TDir); in createUniqueEntity()
181 sys::path::append(TDir, Twine(ModelStorage)); in createUniqueEntity()
248 namespace path { namespace
250 const_iterator begin(StringRef path, Style style) { in begin() argument
252 i.Path = path; in begin()
253 i.Component = find_first_component(path, style); in begin()
259 const_iterator end(StringRef path) { in end() argument
261 i.Path = path; in end()
262 i.Position = path.size(); in end()
371 StringRef root_path(StringRef path, Style style) { in root_path() argument
372 const_iterator b = begin(path, style), pos = b, e = end(path); in root_path()
381 return path.substr(0, b->size() + pos->size()); in root_path()
397 StringRef root_name(StringRef path, Style style) { in root_name() argument
398 const_iterator b = begin(path, style), e = end(path); in root_name()
414 StringRef root_directory(StringRef path, Style style) { in root_directory() argument
415 const_iterator b = begin(path, style), pos = b, e = end(path); in root_directory()
437 StringRef relative_path(StringRef path, Style style) { in relative_path() argument
438 StringRef root = root_path(path, style); in relative_path()
439 return path.substr(root.size()); in relative_path()
442 void append(SmallVectorImpl<char> &path, Style style, const Twine &a, in append() argument
457 !path.empty() && is_separator(path[path.size() - 1], style); in append()
464 path.append(c.begin(), c.end()); in append()
471 !(path.empty() || has_root_name(component, style))) { in append()
473 path.push_back(preferred_separator(style)); in append()
476 path.append(component.begin(), component.end()); in append()
480 void append(SmallVectorImpl<char> &path, const Twine &a, const Twine &b, in append() argument
482 append(path, Style::native, a, b, c, d); in append()
485 void append(SmallVectorImpl<char> &path, const_iterator begin, in append() argument
488 path::append(path, style, *begin); in append()
491 StringRef parent_path(StringRef path, Style style) { in parent_path() argument
492 size_t end_pos = parent_path_end(path, style); in parent_path()
496 return path.substr(0, end_pos); in parent_path()
499 void remove_filename(SmallVectorImpl<char> &path, Style style) { in remove_filename() argument
500 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style); in remove_filename()
502 path.set_size(end_pos); in remove_filename()
505 void replace_extension(SmallVectorImpl<char> &path, const Twine &extension, in replace_extension() argument
507 StringRef p(path.begin(), path.size()); in replace_extension()
514 path.set_size(pos); in replace_extension()
518 path.push_back('.'); in replace_extension()
521 path.append(ext.begin(), ext.end()); in replace_extension()
542 path::append(NewPath, style, NewPrefix); in replace_path_prefix()
543 path::append(NewPath, style, RelPath); in replace_path_prefix()
547 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) { in native() argument
548 assert((!path.isSingleStringRef() || in native()
549 path.getSingleStringRef().data() != result.data()) && in native()
553 path.toVector(result); in native()
581 std::string convert_to_slash(StringRef path, Style style) { in convert_to_slash() argument
583 return path; in convert_to_slash()
585 std::string s = path.str(); in convert_to_slash()
590 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); } in filename() argument
592 StringRef stem(StringRef path, Style style) { in stem() argument
593 StringRef fname = filename(path, style); in stem()
605 StringRef extension(StringRef path, Style style) { in extension() argument
606 StringRef fname = filename(path, style); in extension()
632 bool has_root_name(const Twine &path, Style style) { in has_root_name() argument
634 StringRef p = path.toStringRef(path_storage); in has_root_name()
639 bool has_root_directory(const Twine &path, Style style) { in has_root_directory() argument
641 StringRef p = path.toStringRef(path_storage); in has_root_directory()
646 bool has_root_path(const Twine &path, Style style) { in has_root_path() argument
648 StringRef p = path.toStringRef(path_storage); in has_root_path()
653 bool has_relative_path(const Twine &path, Style style) { in has_relative_path() argument
655 StringRef p = path.toStringRef(path_storage); in has_relative_path()
660 bool has_filename(const Twine &path, Style style) { in has_filename() argument
662 StringRef p = path.toStringRef(path_storage); in has_filename()
667 bool has_parent_path(const Twine &path, Style style) { in has_parent_path() argument
669 StringRef p = path.toStringRef(path_storage); in has_parent_path()
674 bool has_stem(const Twine &path, Style style) { in has_stem() argument
676 StringRef p = path.toStringRef(path_storage); in has_stem()
681 bool has_extension(const Twine &path, Style style) { in has_extension() argument
683 StringRef p = path.toStringRef(path_storage); in has_extension()
688 bool is_absolute(const Twine &path, Style style) { in is_absolute() argument
690 StringRef p = path.toStringRef(path_storage); in is_absolute()
699 bool is_relative(const Twine &path, Style style) { in is_relative() argument
700 return !is_absolute(path, style); in is_relative()
713 static SmallString<256> remove_dots(StringRef path, bool remove_dot_dot, in remove_dots() argument
718 StringRef rel = path::relative_path(path, style); in remove_dots()
720 llvm::make_range(path::begin(rel, style), path::end(rel))) { in remove_dots()
729 if (path::is_absolute(path, style)) in remove_dots()
735 SmallString<256> buffer = path::root_path(path, style); in remove_dots()
737 path::append(buffer, style, C); in remove_dots()
741 bool remove_dots(SmallVectorImpl<char> &path, bool remove_dot_dot, in remove_dots() argument
743 StringRef p(path.data(), path.size()); in remove_dots()
746 if (result == path) in remove_dots()
749 path.swap(result); in remove_dots()
853 SmallVectorImpl<char> &path) { in make_absolute() argument
854 StringRef p(path.data(), path.size()); in make_absolute()
856 bool rootDirectory = path::has_root_directory(p); in make_absolute()
858 (real_style(Style::native) != Style::windows) || path::has_root_name(p); in make_absolute()
871 path::append(current_dir, p); in make_absolute()
873 path.swap(current_dir); in make_absolute()
878 StringRef cdrn = path::root_name(current_dir); in make_absolute()
880 path::append(curDirRootName, p); in make_absolute()
882 path.swap(curDirRootName); in make_absolute()
887 StringRef pRootName = path::root_name(p); in make_absolute()
888 StringRef bRootDirectory = path::root_directory(current_dir); in make_absolute()
889 StringRef bRelativePath = path::relative_path(current_dir); in make_absolute()
890 StringRef pRelativePath = path::relative_path(p); in make_absolute()
893 path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath); in make_absolute()
894 path.swap(res); in make_absolute()
902 std::error_code make_absolute(SmallVectorImpl<char> &path) { in make_absolute() argument
903 if (path::is_absolute(path)) in make_absolute()
910 make_absolute(current_dir, path); in make_absolute()
928 StringRef Parent = path::parent_path(P); in create_directories()
1041 std::error_code is_directory(const Twine &path, bool &result) { in is_directory() argument
1043 if (std::error_code ec = status(path, st)) in is_directory()
1053 std::error_code is_regular_file(const Twine &path, bool &result) { in is_regular_file() argument
1055 if (std::error_code ec = status(path, st)) in is_regular_file()
1065 std::error_code is_symlink_file(const Twine &path, bool &result) { in is_symlink_file() argument
1067 if (std::error_code ec = status(path, st, false)) in is_symlink_file()
1089 SmallString<128> PathStr = path::parent_path(Path); in replace_filename()
1090 path::append(PathStr, Filename); in replace_filename()