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

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

index e5a3c76458b8f903e6b9c4ca49770ad9d799c1c2..18a6e9a14202a2807f79c39baf9a135d71d70580 100644 (file)
@@ -200,16 +200,6 @@ namespace sys {
       /// @brief Determines if the path name is empty (invalid).
       bool isEmpty() const { return path.empty(); }
 
-       /// This function returns the last component of the path name. The last
-      /// component is the file or directory name occurring after the last
-      /// directory separator. If no directory separator is present, the entire
-      /// path name is returned (i.e. same as toString).
-      /// @returns StringRef containing the last component of the path name.
-      /// @brief Returns the last component of the path name.
-      LLVM_ATTRIBUTE_DEPRECATED(
-        StringRef getLast() const,
-        LLVM_PATH_DEPRECATED_MSG(path::filename));
-
       /// This function strips off the path and suffix of the file or directory
       /// name and returns just the basename. For example /a/foo.bar would cause
       /// this function to return "foo".
index e3f20822e51ae55033f788b6c39040d24d9a0e15..13bf9aaef9240f38c01bc657a58e9ec57dad5b36 100644 (file)
@@ -427,28 +427,6 @@ Path::canExecute() const {
   return true;
 }
 
-StringRef
-Path::getLast() const {
-  // Find the last slash
-  size_t pos = path.rfind('/');
-
-  // Handle the corner cases
-  if (pos == std::string::npos)
-    return path;
-
-  // If the last character is a slash
-  if (pos == path.length()-1) {
-    // Find the second to last slash
-    size_t pos2 = path.rfind('/', pos-1);
-    if (pos2 == std::string::npos)
-      return StringRef(path).substr(0,pos);
-    else
-      return StringRef(path).substr(pos2+1,pos-pos2-1);
-  }
-  // Return everything after the last slash
-  return StringRef(path).substr(pos+1);
-}
-
 const FileStatus *
 PathWithStatus::getFileStatus(bool update, std::string *ErrStr) const {
   if (!fsIsValid || update) {
index efbb8b2284e6e14bc21f7ec75a5234aae80feb33..44c89ad8fb653199b36fcff9072ec5470d06850d 100644 (file)
@@ -343,23 +343,6 @@ Path::isRegularFile() const {
   return res;
 }
 
-StringRef
-Path::getLast() const {
-  // Find the last slash
-  size_t pos = path.rfind('/');
-
-  // Handle the corner cases
-  if (pos == std::string::npos)
-    return path;
-
-  // If the last character is a slash, we have a root directory
-  if (pos == path.length()-1)
-    return path;
-
-  // Return everything after the last slash
-  return StringRef(path).substr(pos+1);
-}
-
 const FileStatus *
 PathWithStatus::getFileStatus(bool update, std::string *ErrStr) const {
   if (!fsIsValid || update) {