X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FCommandLine.cpp;h=3cabc54a73aad4a5cb171526d2105a7f53eeaf2e;hb=c16fc548515f2fd01bc2cbe4befd822a636cc154;hp=ba2cd02622a554d7d26c81494d60279696ffb2b7;hpb=845c00e2e6261b17ff47af2774492b21b7a8a96c;p=oota-llvm.git diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index ba2cd02622a..3cabc54a73a 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm-c/Support.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" @@ -32,10 +33,8 @@ #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/raw_ostream.h" -#include #include #include -#include using namespace llvm; using namespace cl; @@ -198,7 +197,7 @@ public: assert(std::count_if(RegisteredOptionCategories.begin(), RegisteredOptionCategories.end(), [cat](const OptionCategory *Category) { - return getName() == Category->getName(); + return cat->getName() == Category->getName(); }) == 0 && "Duplicate option categories"); @@ -314,7 +313,7 @@ static Option *LookupNearestOption(StringRef Arg, if (RHS.empty() || !PermitValue) NearestString = OptionNames[i]; else - NearestString = std::string(OptionNames[i]) + "=" + RHS.str(); + NearestString = (Twine(OptionNames[i]) + "=" + RHS).str(); } } } @@ -785,7 +784,7 @@ class StrDupSaver : public StringSaver { std::vector Dups; public: - ~StrDupSaver() { + ~StrDupSaver() override { for (std::vector::iterator I = Dups.begin(), E = Dups.end(); I != E; ++I) { char *Dup = *I; @@ -840,9 +839,7 @@ void CommandLineParser::ParseCommandLineOptions(int argc, assert(hasOptions() && "No options specified!"); // Expand response files. - SmallVector newArgv; - for (int i = 0; i != argc; ++i) - newArgv.push_back(argv[i]); + SmallVector newArgv(argv, argv + argc); StrDupSaver Saver; ExpandResponseFiles(Saver, TokenizeGNUCommandLine, newArgv); argv = &newArgv[0]; @@ -1465,10 +1462,9 @@ void basic_parser_impl::printOptionNoValue(const Option &O, // -help and -help-hidden option implementation // -static int OptNameCompare(const void *LHS, const void *RHS) { - typedef std::pair pair_ty; - - return strcmp(((const pair_ty *)LHS)->first, ((const pair_ty *)RHS)->first); +static int OptNameCompare(const std::pair *LHS, + const std::pair *RHS) { + return strcmp(LHS->first, RHS->first); } // Copy Options into a vector so we can sort them as we like. @@ -1496,7 +1492,7 @@ static void sortOpts(StringMap