diff options
| author | Zhanyong Wan <wan@google.com> | 2011-02-11 21:24:40 +0000 |
|---|---|---|
| committer | Zhanyong Wan <wan@google.com> | 2011-02-11 21:24:40 +0000 |
| commit | 606bb1a2dce55989c1dc607ed995516d0b48934f (patch) | |
| tree | c820c994206fc3badd4468f45fc4038c76d3d177 /llvm/lib/Support/PathV2.cpp | |
| parent | c6ca7bb67a6b67583c545f37a59b8735780263e2 (diff) | |
| download | llvm-606bb1a2dce55989c1dc607ed995516d0b48934f.zip llvm-606bb1a2dce55989c1dc607ed995516d0b48934f.tar.gz llvm-606bb1a2dce55989c1dc607ed995516d0b48934f.tar.bz2 | |
Adds llvm::sys::path::is_separator() to test whether a char is a path separator
on the host OS. Reviewed by dgregor.
llvm-svn: 125406
Diffstat (limited to 'llvm/lib/Support/PathV2.cpp')
| -rw-r--r-- | llvm/lib/Support/PathV2.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/llvm/lib/Support/PathV2.cpp b/llvm/lib/Support/PathV2.cpp index 3463876..9f9dea2 100644 --- a/llvm/lib/Support/PathV2.cpp +++ b/llvm/lib/Support/PathV2.cpp @@ -20,16 +20,7 @@ namespace { using llvm::StringRef; - - bool is_separator(const char value) { - switch(value) { -#ifdef LLVM_ON_WIN32 - case '\\': // fall through -#endif - case '/': return true; - default: return false; - } - } + using llvm::sys::path::is_separator; #ifdef LLVM_ON_WIN32 const StringRef separators = "\\/"; @@ -154,7 +145,7 @@ namespace { return end_pos; } -} +} // end unnamed namespace namespace llvm { namespace sys { @@ -483,6 +474,16 @@ const StringRef extension(StringRef path) { return fname.substr(pos); } +bool is_separator(char value) { + switch(value) { +#ifdef LLVM_ON_WIN32 + case '\\': // fall through +#endif + case '/': return true; + default: return false; + } +} + bool has_root_name(const Twine &path) { SmallString<128> path_storage; StringRef p = path.toStringRef(path_storage); @@ -737,7 +738,7 @@ error_code remove_all_r(StringRef path, file_type ft, uint32_t &count) { return success; } -} +} // end unnamed namespace error_code remove_all(const Twine &path, uint32_t &num_removed) { SmallString<128> path_storage; |
