Mercurial > projects > ldc
diff gen/cl_helpers.h @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 3171f67ad006 |
children |
line wrap: on
line diff
--- a/gen/cl_helpers.h Fri Mar 19 09:31:25 2010 +0100 +++ b/gen/cl_helpers.h Wed May 19 12:42:32 2010 +0200 @@ -10,7 +10,7 @@ namespace opts { namespace cl = llvm::cl; - + /// Helper class for fancier options class FlagParser : public cl::parser<bool> { std::vector<std::pair<std::string, bool> > switches; @@ -21,14 +21,14 @@ switches.push_back(make_pair("enable-" + Name, true)); switches.push_back(make_pair("disable-" + Name, false)); // Replace <foo> with -enable-<foo> - O.ArgStr = switches[0].first.c_str(); + O.ArgStr = switches[0].first.data(); } - - bool parse(cl::Option &O, const char *ArgName, const std::string &ArgValue, bool &Val); - - void getExtraOptionNames(std::vector<const char*> &Names); + + bool parse(cl::Option &O, llvm::StringRef ArgName, llvm::StringRef ArgValue, bool &Val); + + void getExtraOptionNames(llvm::SmallVectorImpl<const char*> &Names); }; - + /// Helper class for options that set multiple flags class MultiSetter { std::vector<bool*> locations; @@ -36,10 +36,10 @@ MultiSetter(bool); //not implemented, disable auto-conversion public: MultiSetter(bool invert, bool* p, ...) END_WITH_NULL; - + void operator=(bool val); }; - + /// Helper class to fill Array with char* when given strings /// (Errors on empty strings) class ArrayAdapter { @@ -52,14 +52,14 @@ assert(name); assert(arrp); } - + void push_back(const char* cstr); - + void push_back(const std::string& str) { push_back(str.c_str()); } }; - + /// Helper class to allow use of a parser<bool> with BoolOrDefault class BoolOrDefaultAdapter { cl::boolOrDefault value; @@ -67,11 +67,11 @@ operator cl::boolOrDefault() { return value; } - + void operator=(cl::boolOrDefault val) { value = val; } - + void operator=(bool val) { *this = (val ? cl::BOU_TRUE : cl::BOU_FALSE); }