[cfe-commits] r116422 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Basic/IdentifierTable.cpp test/CodeGenObjC/ivar-layout-64-bitfields.m

Douglas Gregor dgregor at apple.com
Wed Oct 13 13:00:38 PDT 2010


Author: dgregor
Date: Wed Oct 13 15:00:38 2010
New Revision: 116422

URL: http://llvm.org/viewvc/llvm-project?rev=116422&view=rev
Log:
_Bool is not a keyword in C++. Fixes PR7388 and PR8349.

Modified:
    cfe/trunk/include/clang/Basic/TokenKinds.def
    cfe/trunk/lib/Basic/IdentifierTable.cpp
    cfe/trunk/test/CodeGenObjC/ivar-layout-64-bitfields.m

Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=116422&r1=116421&r2=116422&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Wed Oct 13 15:00:38 2010
@@ -183,6 +183,7 @@
 //   KEYC99   - This is a keyword introduced to C in C99
 //   KEYCXX   - This is a C++ keyword, or a C++-specific keyword in the
 //              implementation namespace
+//   KEYNOCXX - This is a keyword in every non-C++ dialect.
 //   KEYCXX0X - This is a C++ keyword introduced to C++ in C++0x
 //   KEYGNU   - This is a keyword if GNU extensions are enabled
 //   KEYMS    - This is a keyword if Microsoft extensions are enabled
@@ -222,7 +223,7 @@
 KEYWORD(void                        , KEYALL)
 KEYWORD(volatile                    , KEYALL)
 KEYWORD(while                       , KEYALL)
-KEYWORD(_Bool                       , KEYNOMS)
+KEYWORD(_Bool                       , KEYNOCXX)
 KEYWORD(_Complex                    , KEYALL)
 KEYWORD(_Imaginary                  , KEYALL)
 KEYWORD(__func__                    , KEYALL)

Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=116422&r1=116421&r2=116422&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Wed Oct 13 15:00:38 2010
@@ -73,7 +73,7 @@
     KEYMS = 32,
     BOOLSUPPORT = 64,
     KEYALTIVEC = 128,
-    KEYNOMS = 256,
+    KEYNOCXX = 256,
     KEYBORLAND = 512
   };
 }
@@ -99,7 +99,7 @@
   else if (LangOpts.Borland && (Flags & KEYBORLAND)) AddResult = 1;
   else if (LangOpts.Bool && (Flags & BOOLSUPPORT)) AddResult = 2;
   else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2;
-  else if (!LangOpts.Microsoft && (Flags & KEYNOMS)) AddResult = 2;
+  else if (!LangOpts.CPlusPlus && (Flags & KEYNOCXX)) AddResult = 2;
 
   // Don't add this keyword if disabled in this language.
   if (AddResult == 0) return;

Modified: cfe/trunk/test/CodeGenObjC/ivar-layout-64-bitfields.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/ivar-layout-64-bitfields.m?rev=116422&r1=116421&r2=116422&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/ivar-layout-64-bitfields.m (original)
+++ cfe/trunk/test/CodeGenObjC/ivar-layout-64-bitfields.m Wed Oct 13 15:00:38 2010
@@ -1,5 +1,10 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s
+
+#ifdef __cplusplus
+typedef bool _Bool;
+#endif
+
 @interface I
 {
   struct {





More information about the cfe-commits mailing list