#include "llvm/Support/type_traits.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Compiler.h"
#include <string>
#include <vector>
#include <utility>
// 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
typedef DataType parser_data_type;
};
-
//--------------------------------------------------
// parser<bool>
//
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>
// 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>
// 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>
// 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>
// 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>
// 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
}
};
+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
#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.
}
//===----------------------------------------------------------------------===//
-// 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
// 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)