mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
LLVM 3.7: Workaround for the FlagParser problem.
Replaces the FlagParser with llvm:🆑:parser<bool>.
If no one objects then this will be the default implementation
starting with LLVM 3.7.
TODO: The help text still has the footnote for the FlagParser options.
This commit is contained in:
parent
f691638956
commit
c2c00d00a2
2 changed files with 6 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
|
||||
namespace opts {
|
||||
|
||||
#if LDC_LLVM_VER < 307
|
||||
bool FlagParser::parse(cl::Option &O, llvm::StringRef ArgName, llvm::StringRef Arg, bool &Val) {
|
||||
// Make a std::string out of it to make comparisons easier
|
||||
// (and avoid repeated conversion)
|
||||
|
@ -48,7 +49,7 @@ void FlagParser::getExtraOptionNames(llvm::SmallVectorImpl<const char*> &Names)
|
|||
Names.push_back(I->first.data());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
MultiSetter::MultiSetter(bool invert, bool* p, ...) {
|
||||
this->invert = invert;
|
||||
|
|
|
@ -28,6 +28,9 @@ typedef Array<const char *> Strings;
|
|||
namespace opts {
|
||||
namespace cl = llvm::cl;
|
||||
|
||||
#if LDC_LLVM_VER >= 307
|
||||
typedef cl::parser<bool> FlagParser;
|
||||
#else
|
||||
/// Helper class for fancier options
|
||||
class FlagParser : public cl::parser<bool> {
|
||||
#if LDC_LLVM_VER >= 307
|
||||
|
@ -64,6 +67,7 @@ namespace opts {
|
|||
|
||||
void getExtraOptionNames(llvm::SmallVectorImpl<const char*> &Names);
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Helper class for options that set multiple flags
|
||||
class MultiSetter {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue