diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/Support/Path.cpp | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/Path.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/Support/Path.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/contrib/libs/llvm12/lib/Support/Path.cpp b/contrib/libs/llvm12/lib/Support/Path.cpp index ef223ae5ac..4319bd23a8 100644 --- a/contrib/libs/llvm12/lib/Support/Path.cpp +++ b/contrib/libs/llvm12/lib/Support/Path.cpp @@ -355,8 +355,8 @@ StringRef root_path(StringRef path, Style style) { // {C:/,//net/}, so get the first two components. return path.substr(0, b->size() + pos->size()); } - // just {C:,//net}, return the first component. - return *b; + // just {C:,//net}, return the first component. + return *b; } // POSIX style root directory. @@ -466,7 +466,7 @@ StringRef parent_path(StringRef path, Style style) { size_t end_pos = parent_path_end(path, style); if (end_pos == StringRef::npos) return StringRef(); - return path.substr(0, end_pos); + return path.substr(0, end_pos); } void remove_filename(SmallVectorImpl<char> &path, Style style) { @@ -579,10 +579,10 @@ StringRef stem(StringRef path, Style style) { size_t pos = fname.find_last_of('.'); if (pos == StringRef::npos) return fname; - if ((fname.size() == 1 && fname == ".") || - (fname.size() == 2 && fname == "..")) - return fname; - return fname.substr(0, pos); + if ((fname.size() == 1 && fname == ".") || + (fname.size() == 2 && fname == "..")) + return fname; + return fname.substr(0, pos); } StringRef extension(StringRef path, Style style) { @@ -590,10 +590,10 @@ StringRef extension(StringRef path, Style style) { size_t pos = fname.find_last_of('.'); if (pos == StringRef::npos) return StringRef(); - if ((fname.size() == 1 && fname == ".") || - (fname.size() == 2 && fname == "..")) - return StringRef(); - return fname.substr(pos); + if ((fname.size() == 1 && fname == ".") || + (fname.size() == 2 && fname == "..")) + return StringRef(); + return fname.substr(pos); } bool is_separator(char value, Style style) { @@ -677,24 +677,24 @@ bool is_absolute(const Twine &path, Style style) { return rootDir && rootName; } -bool is_absolute_gnu(const Twine &path, Style style) { - SmallString<128> path_storage; - StringRef p = path.toStringRef(path_storage); - - // Handle '/' which is absolute for both Windows and POSIX systems. - // Handle '\\' on Windows. - if (!p.empty() && is_separator(p.front(), style)) - return true; - - if (real_style(style) == Style::windows) { - // Handle drive letter pattern (a character followed by ':') on Windows. - if (p.size() >= 2 && (p[0] && p[1] == ':')) - return true; - } - - return false; -} - +bool is_absolute_gnu(const Twine &path, Style style) { + SmallString<128> path_storage; + StringRef p = path.toStringRef(path_storage); + + // Handle '/' which is absolute for both Windows and POSIX systems. + // Handle '\\' on Windows. + if (!p.empty() && is_separator(p.front(), style)) + return true; + + if (real_style(style) == Style::windows) { + // Handle drive letter pattern (a character followed by ':') on Windows. + if (p.size() >= 2 && (p[0] && p[1] == ':')) + return true; + } + + return false; +} + bool is_relative(const Twine &path, Style style) { return !is_absolute(path, style); } @@ -1293,7 +1293,7 @@ Expected<TempFile> TempFile::create(const Twine &Model, unsigned Mode) { #endif return std::move(Ret); } -} // namespace fs +} // namespace fs -} // namespace sys -} // namespace llvm +} // namespace sys +} // namespace llvm |