AMDG

The attached patch deals with the fact the yvals.h
in the standard library that ships with msvc contains
typedef bool _Bool;
However, i'd really prefer to disable the _Bool keyword
in Microsoft compatibility mode.  Is there a good
way to do this?

In Christ,
Steven Watanabe

Index: tools/clang/lib/Parse/ParseDecl.cpp
===================================================================
--- tools/clang/lib/Parse/ParseDecl.cpp	(revision 104222)
+++ tools/clang/lib/Parse/ParseDecl.cpp	(working copy)
@@ -1276,8 +1276,18 @@
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_char32, Loc, PrevSpec,
                                      DiagID);
       break;
+    case tok::kw__Bool:
+      // Microsoft has a typedef bool _Bool;  As a totally
+      // evil hack, if we see this construct, stop treating
+      // _Bool as a keyword
+      if(DS.getTypeSpecType() == DeclSpec::TST_bool) {
+          IdentifierTable& table = PP.getIdentifierTable();
+          IdentifierInfo& ident = table.get(llvm::StringRef("_Bool"));
+          ident.setTokenID(tok::identifier);
+          Tok.setKind(tok::identifier);
+          goto DoneWithDeclSpec;
+      }
     case tok::kw_bool:
-    case tok::kw__Bool:
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_bool, Loc, PrevSpec,
                                      DiagID);
       break;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to