Changes in directory llvm/include/llvm/Support:
CommandLine.h updated: 1.55 -> 1.56 --- Log message: 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>). --- Diffs of the changes: (+37 -2) CommandLine.h | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.55 llvm/include/llvm/Support/CommandLine.h:1.56 --- llvm/include/llvm/Support/CommandLine.h:1.55 Tue Jul 18 18:59:33 2006 +++ llvm/include/llvm/Support/CommandLine.h Sun Aug 27 07:45:46 2006 @@ -22,6 +22,7 @@ #include "llvm/Support/type_traits.h" #include "llvm/Support/DataTypes.h" +#include "llvm/Support/Compiler.h" #include <string> #include <vector> #include <utility> @@ -509,6 +510,9 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "value"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; // basic_parser - The real basic parser is just a template wrapper that provides @@ -519,7 +523,6 @@ typedef DataType parser_data_type; }; - //-------------------------------------------------- // parser<bool> // @@ -533,10 +536,15 @@ return ValueOptional; } - // getValueName - Do not print =<value> at all + // getValueName - Do not print =<value> at all. virtual const char *getValueName() const { return 0; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<bool>); + //-------------------------------------------------- // parser<int> @@ -549,8 +557,13 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "int"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<int>); + //-------------------------------------------------- // parser<unsigned> @@ -563,8 +576,12 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "uint"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned>); //-------------------------------------------------- // parser<double> @@ -577,8 +594,12 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<double>); //-------------------------------------------------- // parser<float> @@ -591,8 +612,12 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "number"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<float>); //-------------------------------------------------- // parser<std::string> @@ -609,8 +634,13 @@ // getValueName - Overload in subclass to provide a better default value. virtual const char *getValueName() const { return "string"; } + + // An out-of-line virtual method to provide a 'home' for this class. + virtual void anchor(); }; +EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<std::string>); + //===----------------------------------------------------------------------===// // applicator class - This class is used because we must use partial // specialization to handle literal string arguments specially (const char* does @@ -845,6 +875,11 @@ } }; +EXTERN_TEMPLATE_INSTANTIATION(class opt<unsigned>); +EXTERN_TEMPLATE_INSTANTIATION(class opt<int>); +EXTERN_TEMPLATE_INSTANTIATION(class opt<std::string>); +EXTERN_TEMPLATE_INSTANTIATION(class opt<bool>); + //===----------------------------------------------------------------------===// // list_storage class _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits