diff options
Diffstat (limited to 'include/clang/Basic/TokenKinds.h')
-rw-r--r-- | include/clang/Basic/TokenKinds.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/clang/Basic/TokenKinds.h b/include/clang/Basic/TokenKinds.h index dcbe1da1115d..794625ca91e3 100644 --- a/include/clang/Basic/TokenKinds.h +++ b/include/clang/Basic/TokenKinds.h @@ -15,12 +15,14 @@ #ifndef LLVM_CLANG_TOKENKINDS_H #define LLVM_CLANG_TOKENKINDS_H +#include "llvm/Support/Compiler.h" + namespace clang { namespace tok { /// \brief Provides a simple uniform namespace for tokens from all C languages. -enum TokenKind { +enum TokenKind : unsigned short { #define TOK(X) X, #include "clang/Basic/TokenKinds.def" NUM_TOKENS @@ -52,7 +54,7 @@ enum OnOffSwitch { /// /// The name of a token will be an internal name (such as "l_square") /// and should not be used as part of diagnostic messages. -const char *getTokenName(enum TokenKind Kind); +const char *getTokenName(TokenKind Kind) LLVM_READNONE; /// \brief Determines the spelling of simple punctuation tokens like /// '!' or '%', and returns NULL for literal and annotation tokens. @@ -61,7 +63,11 @@ const char *getTokenName(enum TokenKind Kind); /// and will not produce any alternative spellings (e.g., a /// digraph). For the actual spelling of a given Token, use /// Preprocessor::getSpelling(). -const char *getTokenSimpleSpelling(enum TokenKind Kind); +const char *getPunctuatorSpelling(TokenKind Kind) LLVM_READNONE; + +/// \brief Determines the spelling of simple keyword and contextual keyword +/// tokens like 'int' and 'dynamic_cast'. Returns NULL for other token kinds. +const char *getKeywordSpelling(TokenKind Kind) LLVM_READNONE; /// \brief Return true if this is a raw identifier or an identifier kind. inline bool isAnyIdentifier(TokenKind K) { |