clang 8.0.0

Enumerations | Functions
clang::tok Namespace Reference

## Enumerations
enum | TokenKind : unsigned short { NUM_TOKENS }
| Provides a simple uniform namespace for tokens from all C languages. More...
enum | PPKeywordKind { NUM_PP_KEYWORDS }
| Provides a namespace for preprocessor keywords which start with a '#' at the beginning of the line. More...
enum | ObjCKeywordKind { NUM_OBJC_KEYWORDS }
| Provides a namespace for Objective-C keywords which start with an '@'. More...
enum | OnOffSwitch { OOS_ON, OOS_OFF, OOS_DEFAULT }
| Defines the possible values of an on-off-switch (C99 6.10.6p2). More...

## Functions
const char * | getTokenName (TokenKind Kind) LLVM_READNONE
| Determines the name of a token as used within the front end. More...
const char * | getPunctuatorSpelling (TokenKind Kind) LLVM_READNONE
| Determines the spelling of simple punctuation tokens like '!' or '', and returns NULL for literal and annotation tokens. More...
const char * | getKeywordSpelling (TokenKind Kind) LLVM_READNONE
| Determines the spelling of simple keyword and contextual keyword tokens like 'int' and 'dynamic_cast'. More...
bool | isAnyIdentifier (TokenKind K)
| Return true if this is a raw identifier or an identifier kind. More...
bool | isStringLiteral (TokenKind K)
| Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token. More...
bool | isLiteral (TokenKind K)
| Return true if this is a "literal" kind, like a numeric constant, string, etc. More...
bool | isAnnotation (TokenKind K)
| Return true if this is any of tok::annot_* kinds. More...

## Enumeration Type Documentation

## ◆ ObjCKeywordKind

enum clang::tok::ObjCKeywordKind

Provides a namespace for Objective-C keywords which start with an '@'.

Enumerator
NUM_OBJC_KEYWORDS |

Definition at line 41 of file TokenKinds.h.

## ◆ OnOffSwitch

enum clang::tok::OnOffSwitch

Defines the possible values of an on-off-switch (C99 6.10.6p2).

Enumerator
OOS_ON |
OOS_OFF |
OOS_DEFAULT |

Definition at line 48 of file TokenKinds.h.

## ◆ PPKeywordKind

enum clang::tok::PPKeywordKind

Provides a namespace for preprocessor keywords which start with a '#' at the beginning of the line.

Enumerator
NUM_PP_KEYWORDS |

Definition at line 33 of file TokenKinds.h.

## ◆ TokenKind

enum clang::tok::TokenKind : unsigned short

Provides a simple uniform namespace for tokens from all C languages.

Enumerator
NUM_TOKENS |

Definition at line 25 of file TokenKinds.h.

## Function Documentation

## ◆ getKeywordSpelling()

const char * clang::tok::getKeywordSpelling | ( | TokenKind | Kind | ) |

Determines the spelling of simple keyword and contextual keyword tokens like 'int' and 'dynamic_cast'.

Returns NULL for other token kinds.

Definition at line 41 of file TokenKinds.cpp.

## ◆ getPunctuatorSpelling()

const char * clang::tok::getPunctuatorSpelling | ( | TokenKind | Kind | ) |

Determines the spelling of simple punctuation tokens like '!' or '', and returns NULL for literal and annotation tokens.

This routine only retrieves the "simple" spelling of the token, and will not produce any alternative spellings (e.g., a digraph). For the actual spelling of a given Token, use Preprocessor::getSpelling().

Definition at line 32 of file TokenKinds.cpp.

Referenced by clang::MacroInfo::dump(), and IsCommonTypo().

## ◆ getTokenName()

const char * clang::tok::getTokenName | ( | TokenKind | Kind | ) |

Determines the name of a token as used within the front end.

The name of a token will be an internal name (such as "l_square") and should not be used as part of diagnostic messages.

Definition at line 25 of file TokenKinds.cpp.

References NUM_TOKENS, and TokNames.

Referenced by clang::Preprocessor::DumpToken(), and clang::Token::getName().

## ◆ isAnnotation()

bool clang::tok::isAnnotation | ( | TokenKind | K | ) |
| inline

Return true if this is any of tok::annot_* kinds.

Definition at line 94 of file TokenKinds.h.

Referenced by clang::Token::isAnnotation(), and clang::TokenValue::TokenValue().

## ◆ isAnyIdentifier()

bool clang::tok::isAnyIdentifier | ( | TokenKind | K | ) |
| inline

Return true if this is a raw identifier or an identifier kind.

Definition at line 72 of file TokenKinds.h.

Referenced by clang::Token::isAnyIdentifier().

## ◆ isLiteral()

bool clang::tok::isLiteral | ( | TokenKind | K | ) |
| inline

Return true if this is a "literal" kind, like a numeric constant, string, etc.

Definition at line 86 of file TokenKinds.h.

References isStringLiteral().

Referenced by clang::Token::isLiteral(), and clang::TokenValue::TokenValue().

## ◆ isStringLiteral()

bool clang::tok::isStringLiteral | ( | TokenKind | K | ) |
| inline

Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token.

Definition at line 78 of file TokenKinds.h.

Referenced by clang::Parser::getNullabilityKeyword(), getSpellingSlow(), clang::PragmaNamespace::HandlePragma(), isLiteral(), clang::format::FormatToken::isStringLiteral(), and clang::MacroArgs::StringifyArgument().