diff options
author | Nate Begeman <natebegeman@mac.com> | 2007-11-15 07:30:50 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2007-11-15 07:30:50 +0000 |
commit | 8aebcb739a4aff5ccf007fd740aa9105071feff4 (patch) | |
tree | 0db7f55272b6fcbd9008767eda33f8584096e89f /Basic/IdentifierTable.cpp | |
parent | e7579b57eb3eabfd3545b86320fb67466730e9fc (diff) |
Break out bool/true/false support into a LangOption
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/IdentifierTable.cpp')
-rw-r--r-- | Basic/IdentifierTable.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Basic/IdentifierTable.cpp b/Basic/IdentifierTable.cpp index c1830fa0ab..73be7d34dd 100644 --- a/Basic/IdentifierTable.cpp +++ b/Basic/IdentifierTable.cpp @@ -68,10 +68,18 @@ IdentifierTable::IdentifierTable() : HashTable(8192) {} /// specified language. static void AddKeyword(const char *Keyword, unsigned KWLen, tok::TokenKind TokenCode, - int C90, int C99, int CXX, int CXX0x, + int C90, int C99, int CXX, int CXX0x, int BoolSupport, const LangOptions &LangOpts, IdentifierTable &Table) { - int Flags = LangOpts.CPlusPlus ? (LangOpts.CPlusPlus0x? CXX0x : CXX) - : (LangOpts.C99 ? C99 : C90); + int Flags = 0; + if (BoolSupport != 0) { + Flags = LangOpts.Boolean ? BoolSupport : 2; + } else if (LangOpts.CPlusPlus) { + Flags = LangOpts.CPlusPlus0x ? CXX0x : CXX; + } else if (LangOpts.C99) { + Flags = C99; + } else { + Flags = C90; + } // Don't add this keyword if disabled in this language or if an extension // and extensions are disabled. @@ -126,6 +134,8 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { CPP0xShift = 6, EXTCPP0x = 1 << CPP0xShift, NOTCPP0x = 2 << CPP0xShift, + BoolShift = 8, + BOOLSUPPORT = 1 << BoolShift, Mask = 3 }; @@ -135,7 +145,8 @@ void IdentifierTable::AddKeywords(const LangOptions &LangOpts) { ((FLAGS) >> C90Shift) & Mask, \ ((FLAGS) >> C99Shift) & Mask, \ ((FLAGS) >> CPPShift) & Mask, \ - ((FLAGS) >> CPP0xShift) & Mask, LangOpts, *this); + ((FLAGS) >> CPP0xShift) & Mask, \ + ((FLAGS) >> BoolShift) & Mask, LangOpts, *this); #define ALIAS(NAME, TOK) \ AddAlias(NAME, strlen(NAME), #TOK, strlen(#TOK), LangOpts, *this); #define CXX_KEYWORD_OPERATOR(NAME, ALIAS) \ |