diff options
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Path.cpp | 40 | ||||
-rw-r--r-- | lib/Support/Unix/Path.inc | 4 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 5 |
3 files changed, 0 insertions, 49 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index 2e8223b6a1..b873b9ab4a 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -91,46 +91,6 @@ bool Path::hasMagicNumber(StringRef Magic) const { return false; } -static StringRef getDirnameCharSep(StringRef path, const char *Sep) { - assert(Sep[0] != '\0' && Sep[1] == '\0' && - "Sep must be a 1-character string literal."); - if (path.empty()) - return "."; - - // If the path is all slashes, return a single slash. - // Otherwise, remove all trailing slashes. - - signed pos = static_cast<signed>(path.size()) - 1; - - while (pos >= 0 && path[pos] == Sep[0]) - --pos; - - if (pos < 0) - return path[0] == Sep[0] ? Sep : "."; - - // Any slashes left? - signed i = 0; - - while (i < pos && path[i] != Sep[0]) - ++i; - - if (i == pos) // No slashes? Return "." - return "."; - - // There is at least one slash left. Remove all trailing non-slashes. - while (pos >= 0 && path[pos] != Sep[0]) - --pos; - - // Remove any trailing slashes. - while (pos >= 0 && path[pos] == Sep[0]) - --pos; - - if (pos < 0) - return path[0] == Sep[0] ? Sep : "."; - - return path.substr(0, pos+1); -} - // Include the truly platform-specific parts of this class. #if defined(LLVM_ON_UNIX) #include "Unix/Path.inc" diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index a442b7f7ea..f154bf62d0 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -319,10 +319,6 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { } -StringRef Path::getDirname() const { - return getDirnameCharSep(path, "/"); -} - StringRef Path::getSuffix() const { // Find the last slash diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index 2b75e737ba..413aa94bd6 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -251,11 +251,6 @@ Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { // FIXME: the above set of functions don't map to Windows very well. - -StringRef Path::getDirname() const { - return getDirnameCharSep(path, "/"); -} - StringRef Path::getSuffix() const { // Find the last slash |