mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-04 19:26:30 +00:00
Add static.
llvm-svn: 186170
This commit is contained in:
parent
f8bbffe976
commit
4de1314777
@ -88,34 +88,33 @@ enum ArchiveOperation {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Modifiers to follow operation to vary behavior
|
// Modifiers to follow operation to vary behavior
|
||||||
bool AddAfter = false; ///< 'a' modifier
|
static bool AddAfter = false; ///< 'a' modifier
|
||||||
bool AddBefore = false; ///< 'b' modifier
|
static bool AddBefore = false; ///< 'b' modifier
|
||||||
bool Create = false; ///< 'c' modifier
|
static bool Create = false; ///< 'c' modifier
|
||||||
bool OriginalDates = false; ///< 'o' modifier
|
static bool OriginalDates = false; ///< 'o' modifier
|
||||||
bool SymTable = true; ///< 's' & 'S' modifiers
|
static bool OnlyUpdate = false; ///< 'u' modifier
|
||||||
bool OnlyUpdate = false; ///< 'u' modifier
|
static bool Verbose = false; ///< 'v' modifier
|
||||||
bool Verbose = false; ///< 'v' modifier
|
|
||||||
|
|
||||||
// Relative Positional Argument (for insert/move). This variable holds
|
// Relative Positional Argument (for insert/move). This variable holds
|
||||||
// the name of the archive member to which the 'a', 'b' or 'i' modifier
|
// the name of the archive member to which the 'a', 'b' or 'i' modifier
|
||||||
// refers. Only one of 'a', 'b' or 'i' can be specified so we only need
|
// refers. Only one of 'a', 'b' or 'i' can be specified so we only need
|
||||||
// one variable.
|
// one variable.
|
||||||
std::string RelPos;
|
static std::string RelPos;
|
||||||
|
|
||||||
// This variable holds the name of the archive file as given on the
|
// This variable holds the name of the archive file as given on the
|
||||||
// command line.
|
// command line.
|
||||||
std::string ArchiveName;
|
static std::string ArchiveName;
|
||||||
|
|
||||||
// This variable holds the list of member files to proecess, as given
|
// This variable holds the list of member files to proecess, as given
|
||||||
// on the command line.
|
// on the command line.
|
||||||
std::vector<std::string> Members;
|
static std::vector<std::string> Members;
|
||||||
|
|
||||||
// This variable holds the (possibly expanded) list of path objects that
|
// This variable holds the (possibly expanded) list of path objects that
|
||||||
// correspond to files we will
|
// correspond to files we will
|
||||||
std::set<std::string> Paths;
|
static std::set<std::string> Paths;
|
||||||
|
|
||||||
// The Archive object to which all the editing operations will be sent.
|
// The Archive object to which all the editing operations will be sent.
|
||||||
Archive* TheArchive = 0;
|
static Archive *TheArchive = 0;
|
||||||
|
|
||||||
// The name this program was invoked as.
|
// The name this program was invoked as.
|
||||||
static const char *program_name;
|
static const char *program_name;
|
||||||
@ -141,7 +140,7 @@ fail(const std::string &msg) {
|
|||||||
|
|
||||||
// getRelPos - Extract the member filename from the command line for
|
// getRelPos - Extract the member filename from the command line for
|
||||||
// the [relpos] argument associated with a, b, and i modifiers
|
// the [relpos] argument associated with a, b, and i modifiers
|
||||||
void getRelPos() {
|
static void getRelPos() {
|
||||||
if(RestOfArgs.size() == 0)
|
if(RestOfArgs.size() == 0)
|
||||||
show_help("Expected [relpos] for a, b, or i modifier");
|
show_help("Expected [relpos] for a, b, or i modifier");
|
||||||
RelPos = RestOfArgs[0];
|
RelPos = RestOfArgs[0];
|
||||||
@ -149,7 +148,7 @@ void getRelPos() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getArchive - Get the archive file name from the command line
|
// getArchive - Get the archive file name from the command line
|
||||||
void getArchive() {
|
static void getArchive() {
|
||||||
if(RestOfArgs.size() == 0)
|
if(RestOfArgs.size() == 0)
|
||||||
show_help("An archive name must be specified");
|
show_help("An archive name must be specified");
|
||||||
ArchiveName = RestOfArgs[0];
|
ArchiveName = RestOfArgs[0];
|
||||||
@ -158,7 +157,7 @@ void getArchive() {
|
|||||||
|
|
||||||
// getMembers - Copy over remaining items in RestOfArgs to our Members vector
|
// getMembers - Copy over remaining items in RestOfArgs to our Members vector
|
||||||
// This is just for clarity.
|
// This is just for clarity.
|
||||||
void getMembers() {
|
static void getMembers() {
|
||||||
if(RestOfArgs.size() > 0)
|
if(RestOfArgs.size() > 0)
|
||||||
Members = std::vector<std::string>(RestOfArgs);
|
Members = std::vector<std::string>(RestOfArgs);
|
||||||
}
|
}
|
||||||
@ -166,7 +165,7 @@ void getMembers() {
|
|||||||
// parseCommandLine - Parse the command line options as presented and return the
|
// parseCommandLine - Parse the command line options as presented and return the
|
||||||
// operation specified. Process all modifiers and check to make sure that
|
// operation specified. Process all modifiers and check to make sure that
|
||||||
// constraints on modifier/operation pairs have not been violated.
|
// constraints on modifier/operation pairs have not been violated.
|
||||||
ArchiveOperation parseCommandLine() {
|
static ArchiveOperation parseCommandLine() {
|
||||||
|
|
||||||
// Keep track of number of operations. We can only specify one
|
// Keep track of number of operations. We can only specify one
|
||||||
// per execution.
|
// per execution.
|
||||||
@ -247,7 +246,7 @@ ArchiveOperation parseCommandLine() {
|
|||||||
// buildPaths - Convert the strings in the Members vector to sys::Path objects
|
// 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
|
// 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')
|
// the operations that add/replace files to the archive ('q' and 'r')
|
||||||
bool buildPaths(bool checkExistence, std::string* ErrMsg) {
|
static bool buildPaths(bool checkExistence, std::string *ErrMsg) {
|
||||||
for (unsigned i = 0; i < Members.size(); i++) {
|
for (unsigned i = 0; i < Members.size(); i++) {
|
||||||
std::string aPath = Members[i];
|
std::string aPath = Members[i];
|
||||||
if (checkExistence) {
|
if (checkExistence) {
|
||||||
@ -270,7 +269,7 @@ bool buildPaths(bool checkExistence, std::string* ErrMsg) {
|
|||||||
// looking for members that match the path list. It is careful to uncompress
|
// looking for members that match the path list. It is careful to uncompress
|
||||||
// things that should be and to skip bitcode files unless the 'k' modifier was
|
// things that should be and to skip bitcode files unless the 'k' modifier was
|
||||||
// given.
|
// given.
|
||||||
bool doPrint(std::string* ErrMsg) {
|
static bool doPrint(std::string *ErrMsg) {
|
||||||
if (buildPaths(false, ErrMsg))
|
if (buildPaths(false, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
||||||
@ -295,8 +294,7 @@ bool doPrint(std::string* ErrMsg) {
|
|||||||
|
|
||||||
// putMode - utility function for printing out the file mode when the 't'
|
// putMode - utility function for printing out the file mode when the 't'
|
||||||
// operation is in verbose mode.
|
// operation is in verbose mode.
|
||||||
void
|
static void printMode(unsigned mode) {
|
||||||
printMode(unsigned mode) {
|
|
||||||
if (mode & 004)
|
if (mode & 004)
|
||||||
outs() << "r";
|
outs() << "r";
|
||||||
else
|
else
|
||||||
@ -315,8 +313,7 @@ printMode(unsigned mode) {
|
|||||||
// the file names of each of the members. However, if verbose mode is requested
|
// the file names of each of the members. However, if verbose mode is requested
|
||||||
// ('v' modifier) then the file type, permission mode, user, group, size, and
|
// ('v' modifier) then the file type, permission mode, user, group, size, and
|
||||||
// modification time are also printed.
|
// modification time are also printed.
|
||||||
bool
|
static bool doDisplayTable(std::string *ErrMsg) {
|
||||||
doDisplayTable(std::string* ErrMsg) {
|
|
||||||
if (buildPaths(false, ErrMsg))
|
if (buildPaths(false, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
||||||
@ -344,8 +341,7 @@ doDisplayTable(std::string* ErrMsg) {
|
|||||||
|
|
||||||
// doExtract - Implement the 'x' operation. This function extracts files back to
|
// doExtract - Implement the 'x' operation. This function extracts files back to
|
||||||
// the file system.
|
// the file system.
|
||||||
bool
|
static bool doExtract(std::string *ErrMsg) {
|
||||||
doExtract(std::string* ErrMsg) {
|
|
||||||
if (buildPaths(false, ErrMsg))
|
if (buildPaths(false, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
for (Archive::iterator I = TheArchive->begin(), E = TheArchive->end();
|
||||||
@ -396,8 +392,7 @@ doExtract(std::string* ErrMsg) {
|
|||||||
// members from the archive. Note that if the count is specified, there should
|
// members from the archive. Note that if the count is specified, there should
|
||||||
// be no more than one path in the Paths list or else this algorithm breaks.
|
// be no more than one path in the Paths list or else this algorithm breaks.
|
||||||
// That check is enforced in parseCommandLine (above).
|
// That check is enforced in parseCommandLine (above).
|
||||||
bool
|
static bool doDelete(std::string *ErrMsg) {
|
||||||
doDelete(std::string* ErrMsg) {
|
|
||||||
if (buildPaths(false, ErrMsg))
|
if (buildPaths(false, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
if (Paths.empty())
|
if (Paths.empty())
|
||||||
@ -423,8 +418,7 @@ doDelete(std::string* ErrMsg) {
|
|||||||
// order of the archive members so that when the archive is written the move
|
// order of the archive members so that when the archive is written the move
|
||||||
// of the members is accomplished. Note the use of the RelPos variable to
|
// of the members is accomplished. Note the use of the RelPos variable to
|
||||||
// determine where the items should be moved to.
|
// determine where the items should be moved to.
|
||||||
bool
|
static bool doMove(std::string *ErrMsg) {
|
||||||
doMove(std::string* ErrMsg) {
|
|
||||||
if (buildPaths(false, ErrMsg))
|
if (buildPaths(false, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -474,8 +468,7 @@ doMove(std::string* ErrMsg) {
|
|||||||
|
|
||||||
// doQuickAppend - Implements the 'q' operation. This function just
|
// doQuickAppend - Implements the 'q' operation. This function just
|
||||||
// indiscriminantly adds the members to the archive and rebuilds it.
|
// indiscriminantly adds the members to the archive and rebuilds it.
|
||||||
bool
|
static bool doQuickAppend(std::string *ErrMsg) {
|
||||||
doQuickAppend(std::string* ErrMsg) {
|
|
||||||
// Get the list of paths to append.
|
// Get the list of paths to append.
|
||||||
if (buildPaths(true, ErrMsg))
|
if (buildPaths(true, ErrMsg))
|
||||||
return true;
|
return true;
|
||||||
@ -497,8 +490,7 @@ doQuickAppend(std::string* ErrMsg) {
|
|||||||
|
|
||||||
// doReplaceOrInsert - Implements the 'r' operation. This function will replace
|
// doReplaceOrInsert - Implements the 'r' operation. This function will replace
|
||||||
// any existing files or insert new ones into the archive.
|
// any existing files or insert new ones into the archive.
|
||||||
bool
|
static bool doReplaceOrInsert(std::string *ErrMsg) {
|
||||||
doReplaceOrInsert(std::string* ErrMsg) {
|
|
||||||
|
|
||||||
// Build the list of files to be added/replaced.
|
// Build the list of files to be added/replaced.
|
||||||
if (buildPaths(true, ErrMsg))
|
if (buildPaths(true, ErrMsg))
|
||||||
@ -578,7 +570,7 @@ doReplaceOrInsert(std::string* ErrMsg) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldCreateArchive(ArchiveOperation Op) {
|
static bool shouldCreateArchive(ArchiveOperation Op) {
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case Print:
|
case Print:
|
||||||
case Delete:
|
case Delete:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user