refactor flags for TokenKinds.def

Make KEYALL a combination of all other flags instead
of its own separate flag. Also rewrite the enum
definitions in hex instead of decimal.

llvm-svn: 129213
This commit is contained in:
Dylan Noblesmith 2011-04-09 13:34:05 +00:00
parent 70e73a3d60
commit 92c07c27be
1 changed files with 12 additions and 12 deletions

View File

@ -81,17 +81,17 @@ IdentifierTable::IdentifierTable(const LangOptions &LangOpts,
// Constants for TokenKinds.def // Constants for TokenKinds.def
namespace { namespace {
enum { enum {
KEYALL = 1, KEYC99 = 0x1,
KEYC99 = 2, KEYCXX = 0x2,
KEYCXX = 4, KEYCXX0X = 0x4,
KEYCXX0X = 8, KEYGNU = 0x8,
KEYGNU = 16, KEYMS = 0x10,
KEYMS = 32, BOOLSUPPORT = 0x20,
BOOLSUPPORT = 64, KEYALTIVEC = 0x40,
KEYALTIVEC = 128, KEYNOCXX = 0x80,
KEYNOCXX = 256, KEYBORLAND = 0x100,
KEYBORLAND = 512, KEYOPENCL = 0x200,
KEYOPENCL = 1024 KEYALL = 0x3ff
}; };
} }
@ -107,7 +107,7 @@ static void AddKeyword(llvm::StringRef Keyword,
tok::TokenKind TokenCode, unsigned Flags, tok::TokenKind TokenCode, unsigned Flags,
const LangOptions &LangOpts, IdentifierTable &Table) { const LangOptions &LangOpts, IdentifierTable &Table) {
unsigned AddResult = 0; unsigned AddResult = 0;
if (Flags & KEYALL) AddResult = 2; if (Flags == KEYALL) AddResult = 2;
else if (LangOpts.CPlusPlus && (Flags & KEYCXX)) AddResult = 2; else if (LangOpts.CPlusPlus && (Flags & KEYCXX)) AddResult = 2;
else if (LangOpts.CPlusPlus0x && (Flags & KEYCXX0X)) AddResult = 2; else if (LangOpts.CPlusPlus0x && (Flags & KEYCXX0X)) AddResult = 2;
else if (LangOpts.C99 && (Flags & KEYC99)) AddResult = 2; else if (LangOpts.C99 && (Flags & KEYC99)) AddResult = 2;