Home | History | Annotate | Download | only in Support

Lines Matching refs:style

37   using llvm::sys::path::Style;
39 inline Style real_style(Style style) {
41 return (style == Style::posix) ? Style::posix : Style::windows;
43 return (style == Style::windows) ? Style::windows : Style::posix;
47 inline const char *separators(Style style) {
48 if (real_style(style) == Style::windows)
53 inline char preferred_separator(Style style) {
54 if (real_style(style) == Style::windows)
59 StringRef find_first_component(StringRef path, Style style) {
69 if (real_style(style) == Style::windows) {
77 if ((path.size() > 2) && is_separator(path[0], style) &&
78 path[0] == path[1] && !is_separator(path[2], style)) {
80 size_t end = path.find_first_of(separators(style), 2);
85 if (is_separator(path[0], style))
89 size_t end = path.find_first_of(separators(style));
95 size_t filename_pos(StringRef str, Style style) {
96 if (str.size() > 0 && is_separator(str[str.size() - 1], style))
99 size_t pos = str.find_last_of(separators(style), str.size() - 1);
101 if (real_style(style) == Style::windows) {
106 if (pos == StringRef::npos || (pos == 1 && is_separator(str[0], style)))
114 size_t root_dir_start(StringRef str, Style style) {
116 if (real_style(style) == Style::windows) {
117 if (str.size() > 2 && str[1] == ':' && is_separator(str[2], style))
122 if (str.size() > 3 && is_separator(str[0], style) && str[0] == str[1] &&
123 !is_separator(str[2], style)) {
124 return str.find_first_of(separators(style), 2);
128 if (str.size() > 0 && is_separator(str[0], style))
137 size_t parent_path_end(StringRef path, Style style) {
138 size_t end_pos = filename_pos(path, style);
141 path.size() > 0 && is_separator(path[end_pos], style);
144 size_t root_dir_pos = root_dir_start(path, style);
147 is_separator(path[end_pos - 1], style))
224 const_iterator begin(StringRef path, Style style) {
227 i.Component = find_first_component(path, style);
229 i.S = style;
262 (real_style(S) == Style::windows && Component.endswith(":"))) {
295 reverse_iterator rbegin(StringRef Path, Style style) {
299 I.S = style;
346 StringRef root_path(StringRef path, Style style) {
347 const_iterator b = begin(path, style), pos = b, e = end(path);
350 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
351 bool has_drive = (real_style(style) == Style::windows) && b->endswith(":");
354 if ((++pos != e) && is_separator((*pos)[0], style)) {
362 // POSIX style root directory.
363 if (is_separator((*b)[0], style)) {
371 StringRef root_name(StringRef path, Style style) {
372 const_iterator b = begin(path, style), e = end(path);
375 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
376 bool has_drive = (real_style(style) == Style::windows) && b->endswith(":");
388 StringRef root_directory(StringRef path, Style style) {
389 const_iterator b = begin(path, style), pos = b, e = end(path);
392 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
393 bool has_drive = (real_style(style) == Style::windows) && b->endswith(":");
397 (++pos != e) && is_separator((*pos)[0], style)) {
401 // POSIX style root directory.
402 if (!has_net && is_separator((*b)[0], style)) {
411 StringRef relative_path(StringRef path, Style style) {
412 StringRef root = root_path(path, style);
416 void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
431 !path.empty() && is_separator(path[path.size() - 1], style);
434 size_t loc = component.find_first_not_of(separators(style));
443 !component.empty() && is_separator(component[0], style);
445 !(path.empty() || has_root_name(component, style))) {
447 path.push_back(preferred_separator(style));
456 append(path, Style::native, a, b, c, d);
460 const_iterator end, Style style) {
462 path::append(path, style, *begin);
465 StringRef parent_path(StringRef path, Style style) {
466 size_t end_pos = parent_path_end(path, style);
472 void remove_filename(SmallVectorImpl<char> &path, Style style) {
473 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style);
479 Style style) {
486 if (pos != StringRef::npos && pos >= filename_pos(p, style))
498 Style style = Style::native) {
500 if (real_style(style) == Style::windows) {
504 bool SepPath = is_separator(Path[I], style);
505 bool SepPrefix = is_separator(Prefix[I], style);
517 StringRef NewPrefix, Style style) {
522 if (!starts_with(OrigPath, OldPrefix, style))
538 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) {
545 native(result, style);
548 void native(SmallVectorImpl<char> &Path, Style style) {
551 if (real_style(styleStyle::windows) {
553 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) {
566 std::string convert_to_slash(StringRef path, Style style) {
567 if (real_style(style) != Style::windows)
575 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); }
577 StringRef stem(StringRef path, Style style) {
578 StringRef fname = filename(path, style);
588 StringRef extension(StringRef path, Style style) {
589 StringRef fname = filename(path, style);
599 bool is_separator(char value, Style style) {
602 if (real_style(style) == Style::windows)
607 StringRef get_separator(Style style) {
608 if (real_style(style) == Style::windows)
613 bool has_root_name(const Twine &path, Style style) {
617 return !root_name(p, style).empty();
620 bool has_root_directory(const Twine &path, Style style) {
624 return !root_directory(p, style).empty();
627 bool has_root_path(const Twine &path, Style style) {
631 return !root_path(p, style).empty();
634 bool has_relative_path(const Twine &path, Style style) {
638 return !relative_path(p, style).empty();
641 bool has_filename(const Twine &path, Style style) {
645 return !filename(p, style).empty();
648 bool has_parent_path(const Twine &path, Style style) {
652 return !parent_path(p, style).empty();
655 bool has_stem(const Twine &path, Style style) {
659 return !stem(p, style).empty();
662 bool has_extension(const Twine &path, Style style) {
666 return !extension(p, style).empty();
669 bool is_absolute(const Twine &path, Style style) {
673 bool rootDir = has_root_directory(p, style);
675 (real_style(style) != Style::windows) || has_root_name(p, style);
680 bool is_absolute_gnu(const Twine &path, Style style) {
686 if (!p.empty() && is_separator(p.front(), style))
689 if (real_style(style) == Style::windows) {
698 bool is_relative(const Twine &path, Style style) {
699 return !is_absolute(path, style);
702 StringRef remove_leading_dotslash(StringRef Path, Style style) {
704 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) {
706 while (Path.size() > 0 && is_separator(Path[0], style))
715 Style style) {
716 style = real_style(style);
722 StringRef root = path::root_path(remaining, style);
730 size_t next_slash = remaining.find_first_of(separators(style));
738 needs_change |= remaining.front() != preferred_separator(style);
770 buffer += preferred_separator(style);
842 assert(P.find_first_of(separators(Style::native)) == StringRef::npos &&
909 if ((rootName || real_style(Style::native) != Style::windows) &&