mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Add support for a new "CommaSeparated" modifier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6293 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <stdarg.h>
|
#include <cstdarg>
|
||||||
#include "boost/type_traits/object_traits.hpp"
|
#include "boost/type_traits/object_traits.hpp"
|
||||||
|
|
||||||
namespace cl { // Short namespace to make usage concise
|
namespace cl { // Short namespace to make usage concise
|
||||||
@@ -50,7 +50,7 @@ enum NumOccurances { // Flags for the number of occurances allowed...
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum ValueExpected { // Is a value required for the option?
|
enum ValueExpected { // Is a value required for the option?
|
||||||
ValueOptional = 0x08, // The value can oppear... or not
|
ValueOptional = 0x08, // The value can appear... or not
|
||||||
ValueRequired = 0x10, // The value is required to appear!
|
ValueRequired = 0x10, // The value is required to appear!
|
||||||
ValueDisallowed = 0x18, // A value may not be specified (for flags)
|
ValueDisallowed = 0x18, // A value may not be specified (for flags)
|
||||||
ValueMask = 0x18,
|
ValueMask = 0x18,
|
||||||
@@ -86,6 +86,12 @@ enum FormattingFlags {
|
|||||||
FormattingMask = 0x180,
|
FormattingMask = 0x180,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MiscFlags { // Miscellaneous flags to adjust argument
|
||||||
|
CommaSeparated = 0x200, // Should this cl::list split between commas?
|
||||||
|
MiscMask = 0x200,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Option Base class
|
// Option Base class
|
||||||
@@ -137,6 +143,9 @@ public:
|
|||||||
int OH = Flags & FormattingMask;
|
int OH = Flags & FormattingMask;
|
||||||
return OH ? (enum FormattingFlags)OH : getFormattingFlagDefault();
|
return OH ? (enum FormattingFlags)OH : getFormattingFlagDefault();
|
||||||
}
|
}
|
||||||
|
inline unsigned getMiscFlags() const {
|
||||||
|
return Flags & MiscMask;
|
||||||
|
}
|
||||||
|
|
||||||
// hasArgStr - Return true if the argstr != ""
|
// hasArgStr - Return true if the argstr != ""
|
||||||
bool hasArgStr() const { return ArgStr[0] != 0; }
|
bool hasArgStr() const { return ArgStr[0] != 0; }
|
||||||
@@ -163,7 +172,7 @@ public:
|
|||||||
void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
|
void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
|
||||||
void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
|
void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
|
||||||
void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
|
void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
|
||||||
|
void setMiscFlag(enum MiscFlags M) { setFlag(M, M); }
|
||||||
protected:
|
protected:
|
||||||
Option() : NumOccurances(0), Flags(0),
|
Option() : NumOccurances(0), Flags(0),
|
||||||
ArgStr(""), HelpStr(""), ValueStr("") {}
|
ArgStr(""), HelpStr(""), ValueStr("") {}
|
||||||
@@ -583,6 +592,9 @@ template<> struct applicator<OptionHidden> {
|
|||||||
template<> struct applicator<FormattingFlags> {
|
template<> struct applicator<FormattingFlags> {
|
||||||
static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
|
static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
|
||||||
};
|
};
|
||||||
|
template<> struct applicator<MiscFlags> {
|
||||||
|
static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
|
||||||
|
};
|
||||||
|
|
||||||
// apply method - Apply a modifier to an option in a type safe way.
|
// apply method - Apply a modifier to an option in a type safe way.
|
||||||
template<class Mod, class Opt>
|
template<class Mod, class Opt>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <stdarg.h>
|
#include <cstdarg>
|
||||||
#include "boost/type_traits/object_traits.hpp"
|
#include "boost/type_traits/object_traits.hpp"
|
||||||
|
|
||||||
namespace cl { // Short namespace to make usage concise
|
namespace cl { // Short namespace to make usage concise
|
||||||
@@ -50,7 +50,7 @@ enum NumOccurances { // Flags for the number of occurances allowed...
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum ValueExpected { // Is a value required for the option?
|
enum ValueExpected { // Is a value required for the option?
|
||||||
ValueOptional = 0x08, // The value can oppear... or not
|
ValueOptional = 0x08, // The value can appear... or not
|
||||||
ValueRequired = 0x10, // The value is required to appear!
|
ValueRequired = 0x10, // The value is required to appear!
|
||||||
ValueDisallowed = 0x18, // A value may not be specified (for flags)
|
ValueDisallowed = 0x18, // A value may not be specified (for flags)
|
||||||
ValueMask = 0x18,
|
ValueMask = 0x18,
|
||||||
@@ -86,6 +86,12 @@ enum FormattingFlags {
|
|||||||
FormattingMask = 0x180,
|
FormattingMask = 0x180,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MiscFlags { // Miscellaneous flags to adjust argument
|
||||||
|
CommaSeparated = 0x200, // Should this cl::list split between commas?
|
||||||
|
MiscMask = 0x200,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Option Base class
|
// Option Base class
|
||||||
@@ -137,6 +143,9 @@ public:
|
|||||||
int OH = Flags & FormattingMask;
|
int OH = Flags & FormattingMask;
|
||||||
return OH ? (enum FormattingFlags)OH : getFormattingFlagDefault();
|
return OH ? (enum FormattingFlags)OH : getFormattingFlagDefault();
|
||||||
}
|
}
|
||||||
|
inline unsigned getMiscFlags() const {
|
||||||
|
return Flags & MiscMask;
|
||||||
|
}
|
||||||
|
|
||||||
// hasArgStr - Return true if the argstr != ""
|
// hasArgStr - Return true if the argstr != ""
|
||||||
bool hasArgStr() const { return ArgStr[0] != 0; }
|
bool hasArgStr() const { return ArgStr[0] != 0; }
|
||||||
@@ -163,7 +172,7 @@ public:
|
|||||||
void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
|
void setValueExpectedFlag(enum ValueExpected Val) { setFlag(Val, ValueMask); }
|
||||||
void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
|
void setHiddenFlag(enum OptionHidden Val) { setFlag(Val, HiddenMask); }
|
||||||
void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
|
void setFormattingFlag(enum FormattingFlags V) { setFlag(V, FormattingMask); }
|
||||||
|
void setMiscFlag(enum MiscFlags M) { setFlag(M, M); }
|
||||||
protected:
|
protected:
|
||||||
Option() : NumOccurances(0), Flags(0),
|
Option() : NumOccurances(0), Flags(0),
|
||||||
ArgStr(""), HelpStr(""), ValueStr("") {}
|
ArgStr(""), HelpStr(""), ValueStr("") {}
|
||||||
@@ -583,6 +592,9 @@ template<> struct applicator<OptionHidden> {
|
|||||||
template<> struct applicator<FormattingFlags> {
|
template<> struct applicator<FormattingFlags> {
|
||||||
static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
|
static void opt(FormattingFlags FF, Option &O) { O.setFormattingFlag(FF); }
|
||||||
};
|
};
|
||||||
|
template<> struct applicator<MiscFlags> {
|
||||||
|
static void opt(MiscFlags MF, Option &O) { O.setMiscFlag(MF); }
|
||||||
|
};
|
||||||
|
|
||||||
// apply method - Apply a modifier to an option in a type safe way.
|
// apply method - Apply a modifier to an option in a type safe way.
|
||||||
template<class Mod, class Opt>
|
template<class Mod, class Opt>
|
||||||
|
Reference in New Issue
Block a user