diff options
author | Chris Lattner <sabre@nondot.org> | 2006-08-27 12:45:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-08-27 12:45:47 +0000 |
commit | 7422a761008ef63152417c5e69ddc31252fb6b10 (patch) | |
tree | ebb58495e8af383d095b34eb70f6a39bdc0c7208 /lib/Support/CommandLine.cpp | |
parent | 0c0cc92762bdf34f26762eeaf66f6f8791428db5 (diff) |
Add external definitions for commonly-used template specializations and add
anchor methods to others. This eliminates the vtable/template method bloat
in .o files that defining a cl::opt used to impose (~4K per .o file for one
cp::opt<unsigned>).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/CommandLine.cpp')
-rw-r--r-- | lib/Support/CommandLine.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/lib/Support/CommandLine.cpp b/lib/Support/CommandLine.cpp index 863f5e349d..d9e5cf9f47 100644 --- a/lib/Support/CommandLine.cpp +++ b/lib/Support/CommandLine.cpp @@ -28,11 +28,36 @@ #include <cerrno> #include <cstring> using namespace llvm; - using namespace cl; +//===----------------------------------------------------------------------===// +// Template instantiations and anchors. +// +TEMPLATE_INSTANTIATION(class basic_parser<bool>); +TEMPLATE_INSTANTIATION(class basic_parser<int>); +TEMPLATE_INSTANTIATION(class basic_parser<unsigned>); +TEMPLATE_INSTANTIATION(class basic_parser<double>); +TEMPLATE_INSTANTIATION(class basic_parser<float>); +TEMPLATE_INSTANTIATION(class basic_parser<std::string>); + +TEMPLATE_INSTANTIATION(class opt<unsigned>); +TEMPLATE_INSTANTIATION(class opt<int>); +TEMPLATE_INSTANTIATION(class opt<std::string>); +TEMPLATE_INSTANTIATION(class opt<bool>); + +void Option::anchor() {} +void basic_parser_impl::anchor() {} +void parser<bool>::anchor() {} +void parser<int>::anchor() {} +void parser<unsigned>::anchor() {} +void parser<double>::anchor() {} +void parser<float>::anchor() {} +void parser<std::string>::anchor() {} + +//===----------------------------------------------------------------------===// + // Globals for name and overview of program -static std::string ProgramName ( "<premain>" ); +static std::string ProgramName = "<premain>"; static const char *ProgramOverview = 0; // This collects additional help to be printed. @@ -47,7 +72,7 @@ extrahelp::extrahelp(const char* Help) } //===----------------------------------------------------------------------===// -// Basic, shared command line option processing machinery... +// Basic, shared command line option processing machinery. // // Return the global command line option vector. Making it a function scoped @@ -596,10 +621,6 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, // Option Base class implementation // -// Out of line virtual function to provide home for the class. -void Option::anchor() { -} - bool Option::error(std::string Message, const char *ArgName) { if (ArgName == 0) ArgName = ArgStr; if (ArgName[0] == 0) |