From 7422a761008ef63152417c5e69ddc31252fb6b10 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 27 Aug 2006 12:45:47 +0000 Subject: 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29909 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/CommandLine.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'lib/Support/CommandLine.cpp') 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 #include using namespace llvm; - using namespace cl; +//===----------------------------------------------------------------------===// +// Template instantiations and anchors. +// +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); + +void Option::anchor() {} +void basic_parser_impl::anchor() {} +void parser::anchor() {} +void parser::anchor() {} +void parser::anchor() {} +void parser::anchor() {} +void parser::anchor() {} +void parser::anchor() {} + +//===----------------------------------------------------------------------===// + // Globals for name and overview of program -static std::string ProgramName ( "" ); +static std::string ProgramName = ""; 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) -- cgit v1.2.3-18-g5258