aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/IdentifierTable.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-23 01:05:54 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-23 01:05:54 +0000
commit8e748ab52395328f2905855b295a22e33dc800b2 (patch)
tree060752d7d253d82329da20b40a115abc1a0820b4 /include/clang/Basic/IdentifierTable.h
parent471733d84639fcea35d7876940d7d32fa575e158 (diff)
Change encoding of TokenKind in IdentifierTable to be of type "unsigned"
instead of TokenKind because of signedness issues with MSVC and enums. Patch from Argiris Kirtzidis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/IdentifierTable.h')
-rw-r--r--include/clang/Basic/IdentifierTable.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h
index bb68e650cb..97119261d9 100644
--- a/include/clang/Basic/IdentifierTable.h
+++ b/include/clang/Basic/IdentifierTable.h
@@ -36,7 +36,9 @@ namespace clang {
/// variable or function name). The preprocessor keeps this information in a
/// set, and all tok::identifier tokens have a pointer to one of these.
class IdentifierInfo {
- tok::TokenKind TokenID : 8; // Front-end token ID or tok::identifier.
+ // Note: DON'T make TokenID a 'tok::TokenKind'; MSVC will treat it as a
+ // signed char and TokenKinds > 127 won't be handled correctly.
+ unsigned TokenID : 8; // Front-end token ID or tok::identifier.
unsigned BuiltinID : 9; // ID if this is a builtin (__builtin_inf).
tok::ObjCKeywordKind ObjCID : 5; // ID for objc @ keyword like @'protocol'.
bool HasMacro : 1; // True if there is a #define for this.
@@ -79,7 +81,7 @@ public:
/// get/setTokenID - If this is a source-language token (e.g. 'for'), this API
/// can be used to cause the lexer to map identifiers to source-language
/// tokens.
- tok::TokenKind getTokenID() const { return TokenID; }
+ tok::TokenKind getTokenID() const { return (tok::TokenKind)TokenID; }
void setTokenID(tok::TokenKind ID) { TokenID = ID; }
/// getPPKeywordID - Return the preprocessor keyword ID for this identifier.