Lines Matching refs:path
37 using llvm::sys::path::is_separator;
38 using llvm::sys::path::Style;
61 StringRef find_first_component(StringRef path, Style style) { in find_first_component() argument
68 if (path.empty()) in find_first_component()
69 return path; in find_first_component()
73 if (path.size() >= 2 && in find_first_component()
74 std::isalpha(static_cast<unsigned char>(path[0])) && path[1] == ':') in find_first_component()
75 return path.substr(0, 2); in find_first_component()
79 if ((path.size() > 2) && is_separator(path[0], style) && in find_first_component()
80 path[0] == path[1] && !is_separator(path[2], style)) { in find_first_component()
82 size_t end = path.find_first_of(separators(style), 2); in find_first_component()
83 return path.substr(0, end); in find_first_component()
87 if (is_separator(path[0], style)) in find_first_component()
88 return path.substr(0, 1); in find_first_component()
91 size_t end = path.find_first_of(separators(style)); in find_first_component()
92 return path.substr(0, end); in find_first_component()
139 size_t parent_path_end(StringRef path, Style style) { in parent_path_end() argument
140 size_t end_pos = filename_pos(path, style); in parent_path_end()
143 path.size() > 0 && is_separator(path[end_pos], style); in parent_path_end()
146 size_t root_dir_pos = root_dir_start(path, style); in parent_path_end()
149 is_separator(path[end_pos - 1], style)) in parent_path_end()
224 namespace path { namespace
226 const_iterator begin(StringRef path, Style style) { in begin() argument
228 i.Path = path; in begin()
229 i.Component = find_first_component(path, style); in begin()
235 const_iterator end(StringRef path) { in end() argument
237 i.Path = path; in end()
238 i.Position = path.size(); in end()
348 StringRef root_path(StringRef path, Style style) { in root_path() argument
349 const_iterator b = begin(path, style), pos = b, e = end(path); in root_path()
358 return path.substr(0, b->size() + pos->size()); in root_path()
373 StringRef root_name(StringRef path, Style style) { in root_name() argument
374 const_iterator b = begin(path, style), e = end(path); in root_name()
390 StringRef root_directory(StringRef path, Style style) { in root_directory() argument
391 const_iterator b = begin(path, style), pos = b, e = end(path); in root_directory()
413 StringRef relative_path(StringRef path, Style style) { in relative_path() argument
414 StringRef root = root_path(path, style); in relative_path()
415 return path.substr(root.size()); in relative_path()
418 void append(SmallVectorImpl<char> &path, Style style, const Twine &a, in append() argument
433 !path.empty() && is_separator(path[path.size() - 1], style); in append()
440 path.append(c.begin(), c.end()); in append()
447 !(path.empty() || has_root_name(component, style))) { in append()
449 path.push_back(preferred_separator(style)); in append()
452 path.append(component.begin(), component.end()); in append()
456 void append(SmallVectorImpl<char> &path, const Twine &a, const Twine &b, in append() argument
458 append(path, Style::native, a, b, c, d); in append()
461 void append(SmallVectorImpl<char> &path, const_iterator begin, in append() argument
464 path::append(path, style, *begin); in append()
467 StringRef parent_path(StringRef path, Style style) { in parent_path() argument
468 size_t end_pos = parent_path_end(path, style); in parent_path()
471 return path.substr(0, end_pos); in parent_path()
474 void remove_filename(SmallVectorImpl<char> &path, Style style) { in remove_filename() argument
475 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style); in remove_filename()
477 path.truncate(end_pos); in remove_filename()
480 void replace_extension(SmallVectorImpl<char> &path, const Twine &extension, in replace_extension() argument
482 StringRef p(path.begin(), path.size()); in replace_extension()
489 path.truncate(pos); in replace_extension()
493 path.push_back('.'); in replace_extension()
496 path.append(ext.begin(), ext.end()); in replace_extension()
540 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) { in native() argument
541 assert((!path.isSingleStringRef() || in native()
542 path.getSingleStringRef().data() != result.data()) && in native()
546 path.toVector(result); in native()
568 std::string convert_to_slash(StringRef path, Style style) { in convert_to_slash() argument
570 return std::string(path); in convert_to_slash()
572 std::string s = path.str(); in convert_to_slash()
577 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); } in filename() argument
579 StringRef stem(StringRef path, Style style) { in stem() argument
580 StringRef fname = filename(path, style); in stem()
590 StringRef extension(StringRef path, Style style) { in extension() argument
591 StringRef fname = filename(path, style); in extension()
615 bool has_root_name(const Twine &path, Style style) { in has_root_name() argument
617 StringRef p = path.toStringRef(path_storage); in has_root_name()
622 bool has_root_directory(const Twine &path, Style style) { in has_root_directory() argument
624 StringRef p = path.toStringRef(path_storage); in has_root_directory()
629 bool has_root_path(const Twine &path, Style style) { in has_root_path() argument
631 StringRef p = path.toStringRef(path_storage); in has_root_path()
636 bool has_relative_path(const Twine &path, Style style) { in has_relative_path() argument
638 StringRef p = path.toStringRef(path_storage); in has_relative_path()
643 bool has_filename(const Twine &path, Style style) { in has_filename() argument
645 StringRef p = path.toStringRef(path_storage); in has_filename()
650 bool has_parent_path(const Twine &path, Style style) { in has_parent_path() argument
652 StringRef p = path.toStringRef(path_storage); in has_parent_path()
657 bool has_stem(const Twine &path, Style style) { in has_stem() argument
659 StringRef p = path.toStringRef(path_storage); in has_stem()
664 bool has_extension(const Twine &path, Style style) { in has_extension() argument
666 StringRef p = path.toStringRef(path_storage); in has_extension()
671 bool is_absolute(const Twine &path, Style style) { in is_absolute() argument
673 StringRef p = path.toStringRef(path_storage); in is_absolute()
681 bool is_absolute_gnu(const Twine &path, Style style) { in is_absolute_gnu() argument
683 StringRef p = path.toStringRef(path_storage); in is_absolute_gnu()
699 bool is_relative(const Twine &path, Style style) { in is_relative() argument
700 return !is_absolute(path, style); in is_relative()
723 StringRef root = path::root_path(remaining, style); in remove_dots()
803 if (!sys::path::is_absolute(Twine(ModelStorage))) { in createUniquePath()
805 sys::path::system_temp_directory(true, TDir); in createUniquePath()
806 sys::path::append(TDir, Twine(ModelStorage)); in createUniquePath()
907 SmallVectorImpl<char> &path) { in make_absolute() argument
908 StringRef p(path.data(), path.size()); in make_absolute()
910 bool rootDirectory = path::has_root_directory(p); in make_absolute()
911 bool rootName = path::has_root_name(p); in make_absolute()
924 path::append(current_dir, p); in make_absolute()
926 path.swap(current_dir); in make_absolute()
931 StringRef cdrn = path::root_name(current_dir); in make_absolute()
933 path::append(curDirRootName, p); in make_absolute()
935 path.swap(curDirRootName); in make_absolute()
940 StringRef pRootName = path::root_name(p); in make_absolute()
941 StringRef bRootDirectory = path::root_directory(current_dir); in make_absolute()
942 StringRef bRelativePath = path::relative_path(current_dir); in make_absolute()
943 StringRef pRelativePath = path::relative_path(p); in make_absolute()
946 path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath); in make_absolute()
947 path.swap(res); in make_absolute()
955 std::error_code make_absolute(SmallVectorImpl<char> &path) { in make_absolute() argument
956 if (path::is_absolute(path)) in make_absolute()
963 make_absolute(current_dir, path); in make_absolute()
981 StringRef Parent = path::parent_path(P); in create_directories()
1096 std::error_code is_directory(const Twine &path, bool &result) { in is_directory() argument
1098 if (std::error_code ec = status(path, st)) in is_directory()
1108 std::error_code is_regular_file(const Twine &path, bool &result) { in is_regular_file() argument
1110 if (std::error_code ec = status(path, st)) in is_regular_file()
1120 std::error_code is_symlink_file(const Twine &path, bool &result) { in is_symlink_file() argument
1122 if (std::error_code ec = status(path, st, false)) in is_symlink_file()
1144 SmallString<128> PathStr = path::parent_path(Path); in replace_filename()
1145 path::append(PathStr, Filename); in replace_filename()
1213 return sys::path::stem(Argv0).str(); in getMainExecutable()