• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/contrib/llvm-project/llvm/lib/Support/

Lines Matching refs: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;
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)) {
363 // POSIX style root directory.
364 if (is_separator((*b)[0], style)) {
372 StringRef root_name(StringRef path, Style style) {
373 const_iterator b = begin(path, style), e = end(path);
376 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
377 bool has_drive = (real_style(style) == Style::windows) && b->endswith(":");
389 StringRef root_directory(StringRef path, Style style) {
390 const_iterator b = begin(path, style), pos = b, e = end(path);
393 b->size() > 2 && is_separator((*b)[0], style) && (*b)[1] == (*b)[0];
394 bool has_drive = (real_style(style) == Style::windows) && b->endswith(":");
398 (++pos != e) && is_separator((*pos)[0], style)) {
402 // POSIX style root directory.
403 if (!has_net && is_separator((*b)[0], style)) {
412 StringRef relative_path(StringRef path, Style style) {
413 StringRef root = root_path(path, style);
417 void append(SmallVectorImpl<char> &path, Style style, const Twine &a,
432 !path.empty() && is_separator(path[path.size() - 1], style);
435 size_t loc = component.find_first_not_of(separators(style));
444 !component.empty() && is_separator(component[0], style);
446 !(path.empty() || has_root_name(component, style))) {
448 path.push_back(preferred_separator(style));
461 const_iterator end, Style style) {
463 path::append(path, style, *begin);
466 StringRef parent_path(StringRef path, Style style) {
467 size_t end_pos = parent_path_end(path, style);
474 void remove_filename(SmallVectorImpl<char> &path, Style style) {
475 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style);
481 Style style) {
488 if (pos != StringRef::npos && pos >= filename_pos(p, style))
501 Style style, bool strict) {
513 OldPrefixDir = parent_path(OldPrefix, style);
521 if (!is_separator(OrigPath[OldPrefixDir.size()], style) && strict)
532 path::append(NewPath, style, NewPrefix);
534 if (!is_separator(RelPath[0], style) || !strict)
535 path::append(NewPath, style, RelPath);
537 path::append(NewPath, style, relative_path(RelPath, style));
545 void native(const Twine &path, SmallVectorImpl<char> &result, Style style) {
552 native(result, style);
555 void native(SmallVectorImpl<char> &Path, Style style) {
558 if (real_style(style) == Style::windows) {
560 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) {
579 std::string convert_to_slash(StringRef path, Style style) {
580 if (real_style(style) != Style::windows)
588 StringRef filename(StringRef path, Style style) { return *rbegin(path, style); }
590 StringRef stem(StringRef path, Style style) {
591 StringRef fname = filename(path, style);
603 StringRef extension(StringRef path, Style style) {
604 StringRef fname = filename(path, style);
616 bool is_separator(char value, Style style) {
619 if (real_style(style) == Style::windows)
624 StringRef get_separator(Style style) {
625 if (real_style(style) == Style::windows)
630 bool has_root_name(const Twine &path, Style style) {
634 return !root_name(p, style).empty();
637 bool has_root_directory(const Twine &path, Style style) {
641 return !root_directory(p, style).empty();
644 bool has_root_path(const Twine &path, Style style) {
648 return !root_path(p, style).empty();
651 bool has_relative_path(const Twine &path, Style style) {
655 return !relative_path(p, style).empty();
658 bool has_filename(const Twine &path, Style style) {
662 return !filename(p, style).empty();
665 bool has_parent_path(const Twine &path, Style style) {
669 return !parent_path(p, style).empty();
672 bool has_stem(const Twine &path, Style style) {
676 return !stem(p, style).empty();
679 bool has_extension(const Twine &path, Style style) {
683 return !extension(p, style).empty();
686 bool is_absolute(const Twine &path, Style style) {
690 bool rootDir = has_root_directory(p, style);
692 (real_style(style) != Style::windows) || has_root_name(p, style);
697 bool is_relative(const Twine &path, Style style) {
698 return !is_absolute(path, style);
701 StringRef remove_leading_dotslash(StringRef Path, Style style) {
703 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) {
705 while (Path.size() > 0 && is_separator(Path[0], style))
712 Style style) {
716 StringRef rel = path::relative_path(path, style);
718 llvm::make_range(path::begin(rel, style), path::end(rel))) {
727 if (path::is_absolute(path, style))
733 SmallString<256> buffer = path::root_path(path, style);
735 path::append(buffer, style, C);
740 Style style) {
743 SmallString<256> result = remove_dots(p, remove_dot_dot, style);