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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184306 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2013-06-19 14:58:16 +00:00
parent ca0984cb86
commit 8fe960ed50
2 changed files with 6 additions and 45 deletions

View File

@ -0,0 +1,2 @@
;RUN: not llvm-ar r %T/test.a . 2>&1 | FileCheck %s
;CHECK: . Is a directory

View File

@ -96,7 +96,6 @@ bool DontSkipBitcode = false; ///< 'k' modifier
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::string* ErrMsg) {
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);
}