X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FCommandLine.cpp;h=17fba95ebb2b4e9e8ee852b73a9ccf09d2e523b8;hb=c46ea19bd32e04dbf3cd2fd5db1c60a7d3ec6814;hp=b4e32257a01f6224e2c8739e060ba04b2e101138;hpb=d3198ce4bcc3ec64068d6508f2f08be97e6be83e;p=oota-llvm.git diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index b4e32257a01..17fba95ebb2 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" @@ -31,11 +32,10 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" +#include "llvm/Support/StringSaver.h" #include "llvm/Support/raw_ostream.h" -#include #include #include -#include using namespace llvm; using namespace cl; @@ -46,21 +46,21 @@ using namespace cl; // namespace llvm { namespace cl { -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); -TEMPLATE_INSTANTIATION(class basic_parser); - -TEMPLATE_INSTANTIATION(class opt); -TEMPLATE_INSTANTIATION(class opt); -TEMPLATE_INSTANTIATION(class opt); -TEMPLATE_INSTANTIATION(class opt); -TEMPLATE_INSTANTIATION(class opt); +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; +template class basic_parser; + +template class opt; +template class opt; +template class opt; +template class opt; +template class opt; } } // end namespace llvm::cl @@ -79,133 +79,175 @@ void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} void parser::anchor() {} -void StringSaver::anchor() {} //===----------------------------------------------------------------------===// -// Globals for name and overview of program. Program name is not a string to -// avoid static ctor/dtor issues. -static char ProgramName[80] = ""; -static const char *ProgramOverview = nullptr; +namespace { -// This collects additional help to be printed. -static ManagedStatic> MoreHelp; +class CommandLineParser { +public: + // Globals for name and overview of program. Program name is not a string to + // avoid static ctor/dtor issues. + std::string ProgramName; + const char *ProgramOverview; -extrahelp::extrahelp(const char *Help) : morehelp(Help) { - MoreHelp->push_back(Help); -} + // This collects additional help to be printed. + std::vector MoreHelp; -static bool OptionListChanged = false; + SmallVector