X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FCommandLine.cpp;h=17fba95ebb2b4e9e8ee852b73a9ccf09d2e523b8;hb=c46ea19bd32e04dbf3cd2fd5db1c60a7d3ec6814;hp=c2a25a18cd9dae8c67cc4802724dd5ad610345d0;hpb=431b0a7646105c53c607cbf0015c615269bc5f11;p=oota-llvm.git diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index c2a25a18cd9..17fba95ebb2 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -17,8 +17,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" +#include "llvm-c/Support.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/OwningPtr.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" @@ -31,35 +32,40 @@ #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 "llvm/Support/system_error.h" -#include #include #include using namespace llvm; using namespace cl; +#define DEBUG_TYPE "commandline" + //===----------------------------------------------------------------------===// // Template instantiations and anchors. // -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); -} } // end namespace llvm::cl +namespace llvm { +namespace cl { +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 +// Pin the vtables to this file. +void GenericOptionValue::anchor() {} void OptionValue::anchor() {} void OptionValue::anchor() {} void Option::anchor() {} @@ -76,123 +82,193 @@ void parser::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 = 0; - -// This collects additional help to be printed. -static ManagedStatic > MoreHelp; - -extrahelp::extrahelp(const char *Help) - : morehelp(Help) { - MoreHelp->push_back(Help); -} +namespace { -static bool OptionListChanged = false; +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; -// MarkOptionsChanged - Internal helper function. -void cl::MarkOptionsChanged() { - OptionListChanged = true; -} + // This collects additional help to be printed. + std::vector MoreHelp; -/// RegisteredOptionList - This is the list of the command line options that -/// have statically constructed themselves. -static Option *RegisteredOptionList = 0; + SmallVector