Remove Path::getDirname.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 11 Jun 2013 19:32:57 +0000 (19:32 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 11 Jun 2013 19:32:57 +0000 (19:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183780 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PathV1.h
lib/Support/Path.cpp
lib/Support/Unix/Path.inc
lib/Support/Windows/Path.inc

index 8c898b7140d7dcdb8fec5894c92029194cd07a51..09ab041b072f9d6f41e9033cd22cd1ebb3dd5c61 100644 (file)
@@ -200,11 +200,6 @@ namespace sys {
       /// @brief Determines if the path name is empty (invalid).
       bool isEmpty() const { return path.empty(); }
 
-      /// This function strips off the suffix of the path beginning with the
-      /// path separator ('/' on Unix, '\' on Windows) and returns the result.
-      LLVM_ATTRIBUTE_DEPRECATED(StringRef getDirname() const,
-        LLVM_PATH_DEPRECATED_MSG(path::parent_path));
-
       /// This function strips off the path and basename(up to and
       /// including the last dot) of the file or directory name and
       /// returns just the suffix. For example /a/foo.bar would cause
index 2e8223b6a17c8c9f558339602094f0fe7ff8b8ff..b873b9ab4a0714f1b724e14b1c2a0f1a13c6d3fd 100644 (file)
@@ -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"
index a442b7f7ead8adcfb20fd9118fcfb09df08cbb10..f154bf62d01749fc8e08fe225e9af47ca3ee3db3 100644 (file)
@@ -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
index 2b75e737bac2751d73a3ad92568fc1d998962cce..413aa94bd699f738c7fe14d2b45d13426732c541 100644 (file)
@@ -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