[llvm] r184306 - Remove the 'R' modifier.

Rafael Espindola rafael.espindola at gmail.com
Wed Jun 19 07:58:17 PDT 2013


Author: rafael
Date: Wed Jun 19 09:58:16 2013
New Revision: 184306

URL: http://llvm.org/viewvc/llvm-project?rev=184306&view=rev
Log:
Remove the 'R' modifier.

It is not present in GNU or OS X versions and doesn't make a lot of sense
for llvm-ar.

Added:
    llvm/trunk/test/Archive/directory.ll
Modified:
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp

Added: llvm/trunk/test/Archive/directory.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Archive/directory.ll?rev=184306&view=auto
==============================================================================
--- llvm/trunk/test/Archive/directory.ll (added)
+++ llvm/trunk/test/Archive/directory.ll Wed Jun 19 09:58:16 2013
@@ -0,0 +1,2 @@
+;RUN: not llvm-ar r %T/test.a . 2>&1 | FileCheck %s
+;CHECK: . Is a directory

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=184306&r1=184305&r2=184306&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Wed Jun 19 09:58:16 2013
@@ -96,7 +96,6 @@ bool DontSkipBitcode = false;    ///< 'k
 bool UseCount = false;           ///< 'N' modifier
 bool OriginalDates = false;      ///< 'o' modifier
 bool FullPath = false;           ///< 'P' modifier
-bool RecurseDirectories = false; ///< 'R' modifier
 bool SymTable = true;            ///< 's' & 'S' modifiers
 bool OnlyUpdate = false;         ///< 'u' modifier
 bool Verbose = false;            ///< 'v' modifier
@@ -218,7 +217,6 @@ ArchiveOperation parseCommandLine() {
     case 'l': /* accepted but unused */ break;
     case 'o': OriginalDates = true; break;
     case 'P': FullPath = true; break;
-    case 'R': RecurseDirectories = true; break;
     case 's': SymTable = true; break;
     case 'S': SymTable = false; break;
     case 'u': OnlyUpdate = true; break;
@@ -268,8 +266,6 @@ ArchiveOperation parseCommandLine() {
       show_help("The 'a', 'b' and 'i' modifiers can only be specified with "
             "the 'm' or 'r' operations");
   }
-  if (RecurseDirectories && Operation != ReplaceOrInsert)
-    show_help("The 'R' modifiers is only applicabe to the 'r' operation");
   if (OriginalDates && Operation != Extract)
     show_help("The 'o' modifier is only applicable to the 'x' operation");
   if (TruncateNames && Operation!=QuickAppend && Operation!=ReplaceOrInsert)
@@ -284,39 +280,6 @@ ArchiveOperation parseCommandLine() {
   return Operation;
 }
 
-// recurseDirectories - Implements the "R" modifier. This function scans through
-// the Paths vector (built by buildPaths, below) and replaces any directories it
-// finds with all the files in that directory (recursively). It uses the
-// sys::Path::getDirectoryContent method to perform the actual directory scans.
-bool
-recurseDirectories(const sys::Path& path,
-                   std::set<sys::Path>& result, std::string* ErrMsg) {
-  result.clear();
-  if (RecurseDirectories) {
-    std::set<sys::Path> content;
-    if (path.getDirectoryContents(content, ErrMsg))
-      return true;
-
-    for (std::set<sys::Path>::iterator I = content.begin(), E = content.end();
-         I != E; ++I) {
-      // Make sure it exists and is a directory
-      sys::PathWithStatus PwS(*I);
-      const sys::FileStatus *Status = PwS.getFileStatus(false, ErrMsg);
-      if (!Status)
-        return true;
-      if (Status->isDir) {
-        std::set<sys::Path> moreResults;
-        if (recurseDirectories(*I, moreResults, ErrMsg))
-          return true;
-        result.insert(moreResults.begin(), moreResults.end());
-      } else {
-          result.insert(*I);
-      }
-    }
-  }
-  return false;
-}
-
 // buildPaths - Convert the strings in the Members vector to sys::Path objects
 // and make sure they are valid and exist exist. This check is only needed for
 // the operations that add/replace files to the archive ('q' and 'r')
@@ -334,14 +297,10 @@ bool buildPaths(bool checkExistence, std
       const sys::FileStatus *si = PwS.getFileStatus(false, &Err);
       if (!si)
         fail(Err);
-      if (si->isDir) {
-        std::set<sys::Path> dirpaths;
-        if (recurseDirectories(aPath, dirpaths, ErrMsg))
-          return true;
-        Paths.insert(dirpaths.begin(),dirpaths.end());
-      } else {
-        Paths.insert(aPath);
-      }
+      if (si->isDir)
+        fail(aPath.str() + " Is a directory");
+
+      Paths.insert(aPath);
     } else {
       Paths.insert(aPath);
     }





More information about the llvm-commits mailing list