[cfe-commits] r129213 - /cfe/trunk/lib/Basic/IdentifierTable.cpp

Dylan Noblesmith nobled at dreamwidth.org
Sat Apr 9 06:34:06 PDT 2011


Author: nobled
Date: Sat Apr  9 08:34:05 2011
New Revision: 129213

URL: http://llvm.org/viewvc/llvm-project?rev=129213&view=rev
Log:
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.


Modified:
    cfe/trunk/lib/Basic/IdentifierTable.cpp

Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=129213&r1=129212&r2=129213&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Sat Apr  9 08:34:05 2011
@@ -81,17 +81,17 @@
 // Constants for TokenKinds.def
 namespace {
   enum {
-    KEYALL = 1,
-    KEYC99 = 2,
-    KEYCXX = 4,
-    KEYCXX0X = 8,
-    KEYGNU = 16,
-    KEYMS = 32,
-    BOOLSUPPORT = 64,
-    KEYALTIVEC = 128,
-    KEYNOCXX = 256,
-    KEYBORLAND = 512,
-    KEYOPENCL = 1024
+    KEYC99 = 0x1,
+    KEYCXX = 0x2,
+    KEYCXX0X = 0x4,
+    KEYGNU = 0x8,
+    KEYMS = 0x10,
+    BOOLSUPPORT = 0x20,
+    KEYALTIVEC = 0x40,
+    KEYNOCXX = 0x80,
+    KEYBORLAND = 0x100,
+    KEYOPENCL = 0x200,
+    KEYALL = 0x3ff
   };
 }
 
@@ -107,7 +107,7 @@
                        tok::TokenKind TokenCode, unsigned Flags,
                        const LangOptions &LangOpts, IdentifierTable &Table) {
   unsigned AddResult = 0;
-  if (Flags & KEYALL) AddResult = 2;
+  if (Flags == KEYALL) AddResult = 2;
   else if (LangOpts.CPlusPlus && (Flags & KEYCXX)) AddResult = 2;
   else if (LangOpts.CPlusPlus0x && (Flags & KEYCXX0X)) AddResult = 2;
   else if (LangOpts.C99 && (Flags & KEYC99)) AddResult = 2;





More information about the cfe-commits mailing list