[llvm-ar] Simplify and make two global variables static. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375082 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 70e21df..6233c60 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -214,6 +214,9 @@
// command line.
static std::string ArchiveName;
+static std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
+static std::vector<std::unique_ptr<object::Archive>> Archives;
+
// This variable holds the list of member files to proecess, as given
// on the command line.
static std::vector<StringRef> Members;
@@ -251,15 +254,6 @@
PositionalArgs.erase(PositionalArgs.begin());
}
-// Copy over remaining items in PositionalArgs to our Members vector
-static void getMembers() {
- for (auto &Arg : PositionalArgs)
- Members.push_back(Arg);
-}
-
-std::vector<std::unique_ptr<MemoryBuffer>> ArchiveBuffers;
-std::vector<std::unique_ptr<object::Archive>> Archives;
-
static object::Archive &readLibrary(const Twine &Library) {
auto BufOrErr = MemoryBuffer::getFile(Library, -1, false);
failIfError(BufOrErr.getError(), "could not open library " + Library);
@@ -399,7 +393,7 @@
getArchive();
// Everything on the command line at this point is a member.
- getMembers();
+ Members.assign(PositionalArgs.begin(), PositionalArgs.end());
if (NumOperations == 0 && MaybeJustCreateSymTab) {
NumOperations = 1;