clang  6.0.0svn
Public Types | Public Member Functions | List of all members
clang::Token Class Reference

Token - This structure provides full information about a lexed token. More...

#include "clang/Lex/Token.h"

Public Types

enum  TokenFlags {
  StartOfLine = 0x01, LeadingSpace = 0x02, DisableExpand = 0x04, NeedsCleaning = 0x08,
  LeadingEmptyMacro = 0x10, HasUDSuffix = 0x20, HasUCN = 0x40, IgnoredComma = 0x80,
  StringifiedInMacro = 0x100, CommaAfterElided = 0x200, IsEditorPlaceholder = 0x400
}
 

Public Member Functions

tok::TokenKind getKind () const
 
void setKind (tok::TokenKind K)
 
bool is (tok::TokenKind K) const
 is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {...}". More...
 
bool isNot (tok::TokenKind K) const
 
bool isOneOf (tok::TokenKind K1, tok::TokenKind K2) const
 
template<typename... Ts>
bool isOneOf (tok::TokenKind K1, tok::TokenKind K2, Ts... Ks) const
 
bool isAnyIdentifier () const
 Return true if this is a raw identifier (when lexing in raw mode) or a non-keyword identifier (when lexing in non-raw mode). More...
 
bool isLiteral () const
 Return true if this is a "literal", like a numeric constant, string, etc. More...
 
bool isAnnotation () const
 Return true if this is any of tok::annot_* kind tokens. More...
 
SourceLocation getLocation () const
 Return a source location identifier for the specified offset in the current file. More...
 
unsigned getLength () const
 
void setLocation (SourceLocation L)
 
void setLength (unsigned Len)
 
SourceLocation getAnnotationEndLoc () const
 
void setAnnotationEndLoc (SourceLocation L)
 
SourceLocation getLastLoc () const
 
SourceLocation getEndLoc () const
 
SourceRange getAnnotationRange () const
 SourceRange of the group of tokens that this annotation token represents. More...
 
void setAnnotationRange (SourceRange R)
 
const char * getName () const
 
void startToken ()
 Reset all flags to cleared. More...
 
IdentifierInfogetIdentifierInfo () const
 
void setIdentifierInfo (IdentifierInfo *II)
 
const void * getEofData () const
 
void setEofData (const void *D)
 
StringRef getRawIdentifier () const
 getRawIdentifier - For a raw identifier token (i.e., an identifier lexed in raw mode), returns a reference to the text substring in the buffer if known. More...
 
void setRawIdentifierData (const char *Ptr)
 
const char * getLiteralData () const
 getLiteralData - For a literal token (numeric constant, string, etc), this returns a pointer to the start of it in the text buffer if known, null otherwise. More...
 
void setLiteralData (const char *Ptr)
 
void * getAnnotationValue () const
 
void setAnnotationValue (void *val)
 
void setFlag (TokenFlags Flag)
 Set the specified flag. More...
 
bool getFlag (TokenFlags Flag) const
 Get the specified flag. More...
 
void clearFlag (TokenFlags Flag)
 Unset the specified flag. More...
 
unsigned getFlags () const
 Return the internal represtation of the flags. More...
 
void setFlagValue (TokenFlags Flag, bool Val)
 Set a flag to either true or false. More...
 
bool isAtStartOfLine () const
 isAtStartOfLine - Return true if this token is at the start of a line. More...
 
bool hasLeadingSpace () const
 Return true if this token has whitespace before it. More...
 
bool isExpandDisabled () const
 Return true if this identifier token should never be expanded in the future, due to C99 6.10.3.4p2. More...
 
bool isObjCAtKeyword (tok::ObjCKeywordKind objcKey) const
 Return true if we have an ObjC keyword identifier. More...
 
tok::ObjCKeywordKind getObjCKeywordID () const
 Return the ObjC keyword kind. More...
 
bool needsCleaning () const
 Return true if this token has trigraphs or escaped newlines in it. More...
 
bool hasLeadingEmptyMacro () const
 Return true if this token has an empty macro before it. More...
 
bool hasUDSuffix () const
 Return true if this token is a string or character literal which has a ud-suffix. More...
 
bool hasUCN () const
 Returns true if this token contains a universal character name. More...
 
bool stringifiedInMacro () const
 Returns true if this token is formed by macro by stringizing or charizing operator. More...
 
bool commaAfterElided () const
 Returns true if the comma after this token was elided. More...
 
bool isEditorPlaceholder () const
 Returns true if this token is an editor placeholder. More...
 

Detailed Description

Token - This structure provides full information about a lexed token.

It is not intended to be space efficient, it is intended to return as much information as possible about each returned token. This is expected to be compressed into a smaller form if memory footprint is important.

The parser can create a special "annotation token" representing a stream of tokens that were parsed and semantically resolved, e.g.: "foo::MyClass<int>" can be represented by a single typename annotation token that carries information about the SourceRange of the tokens and the type object.

Definition at line 35 of file Token.h.

Member Enumeration Documentation

◆ TokenFlags

Enumerator
StartOfLine 
LeadingSpace 
DisableExpand 
NeedsCleaning 
LeadingEmptyMacro 
HasUDSuffix 
HasUCN 
IgnoredComma 
StringifiedInMacro 
CommaAfterElided 
IsEditorPlaceholder 

Definition at line 73 of file Token.h.

Member Function Documentation

◆ clearFlag()

void clang::Token::clearFlag ( TokenFlags  Flag)
inline

Unset the specified flag.

Definition at line 244 of file Token.h.

Referenced by findPlaceholderEnd(), isGCCAsmStatement(), isTargetEnvironment(), clang::TokenLexer::Lex(), and setFlagValue().

◆ commaAfterElided()

bool clang::Token::commaAfterElided ( ) const
inline

Returns true if the comma after this token was elided.

Definition at line 301 of file Token.h.

References CommaAfterElided, and getFlag().

◆ getAnnotationEndLoc()

SourceLocation clang::Token::getAnnotationEndLoc ( ) const
inline

Definition at line 138 of file Token.h.

References clang::SourceLocation::getFromRawEncoding(), and isAnnotation().

Referenced by getAnnotationRange(), getEndLoc(), and getLastLoc().

◆ getAnnotationRange()

SourceRange clang::Token::getAnnotationRange ( ) const
inline

SourceRange of the group of tokens that this annotation token represents.

Definition at line 158 of file Token.h.

References getAnnotationEndLoc(), and getLocation().

Referenced by clang::Parser::TryAnnotateTypeOrScopeToken().

◆ getAnnotationValue()

void* clang::Token::getAnnotationValue ( ) const
inline

◆ getEndLoc()

SourceLocation clang::Token::getEndLoc ( ) const
inline

◆ getEofData()

const void* clang::Token::getEofData ( ) const
inline

Definition at line 190 of file Token.h.

References clang::comments::tok::eof, and is().

Referenced by TypeTraitArity().

◆ getFlag()

bool clang::Token::getFlag ( TokenFlags  Flag) const
inline

◆ getFlags()

unsigned clang::Token::getFlags ( ) const
inline

Return the internal represtation of the flags.

This is only intended for low-level operations such as writing tokens to disk.

Definition at line 252 of file Token.h.

Referenced by clang::ASTWriter::AddToken().

◆ getIdentifierInfo()

IdentifierInfo* clang::Token::getIdentifierInfo ( ) const
inline

Definition at line 177 of file Token.h.

References clang::comments::tok::eof, is(), isAnnotation(), isLiteral(), and isNot().

Referenced by addConstexprToLambdaDeclSpecifier(), clang::ASTWriter::AddToken(), clang::MacroArgs::ArgNeedsPreexpansion(), attributeParsedArgsUnevaluated(), clang::TokenConcatenation::AvoidConcat(), CheckArrayDesignatorSyntax(), clang::Preprocessor::CheckEndOfDirective(), clang::Preprocessor::CheckMacroName(), clang::Preprocessor::checkModuleIsAvailable(), DetectEOL(), EvaluateDefined(), EvaluateFeatureLikeBuiltinMacro(), EvaluateValue(), ExpectFeatureIdentifierInfo(), clang::PreprocessingRecord::findMacroDefinition(), clang::arcmt::getFileRemappings(), GetFirstChar(), getIdentifier(), getMissingDeclaratorIdLoc(), getObjCKeywordID(), clang::Parser::getTypeAnnotation(), clang::Preprocessor::HandleDirective(), clang::Preprocessor::HandleIdentifier(), clang::Preprocessor::HandlePoisonedIdentifier(), clang::PragmaNamespace::HandlePragma(), clang::format::FormatToken::is(), isAttributeLateParsed(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isConfigurationPattern(), clang::format::AdditionalKeywords::IsJavaScriptIdentifier(), isObjCAtKeyword(), isSameToken(), isTargetEnvironment(), isTrivialSingleTokenExpansion(), clang::VAOptDefinitionContext::isVAOptToken(), isWideStringLiteralFromMacro(), clang::TokenLexer::Lex(), clang::Preprocessor::Lex(), clang::Preprocessor::LexAfterModuleImport(), LexModuleNameComponent(), clang::Preprocessor::LexOnOffSwitch(), clang::ASTUnit::LoadFromASTFile(), clang::MacroPPCallbacks::MacroDefined(), clang::MacroPPCallbacks::MacroUndefined(), clang::Preprocessor::MaybeHandlePoisonedIdentifier(), clang::format::mustBeJSIdent(), clang::TokenValue::operator==(), ParseAlignPragma(), parseDeclareSimdClauses(), ParseLoopHintValue(), clang::Parser::ParseMSAsmIdentifier(), parseOpenMPReductionId(), clang::Parser::ParseUnqualifiedId(), PragmaLoopHintString(), ReadLineMarkerFlags(), takeDeclAttributes(), clang::Parser::TryAnnotateTypeOrScopeToken(), clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(), and clang::Preprocessor::TypoCorrectToken().

◆ getKind()

tok::TokenKind clang::Token::getKind ( ) const
inline

Definition at line 90 of file Token.h.

Referenced by clang::Sema::ActOnCharacterConstant(), addConstexprToLambdaDeclSpecifier(), clang::ASTWriter::AddToken(), clang::TokenConcatenation::AvoidConcat(), clang::Preprocessor::CheckMacroName(), clang::Preprocessor::checkModuleIsAvailable(), clang::Preprocessor::DumpToken(), EvaluateDirectiveSubExpr(), EvaluateFeatureLikeBuiltinMacro(), EvaluateHasIncludeCommon(), EvaluateValue(), clang::ModuleMapParser::getLocation(), getMissingDeclaratorIdLoc(), clang::Parser::getNullabilityKeyword(), clang::format::FormatToken::getPrecedence(), clang::Preprocessor::HandleDirective(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaModuleBuild(), isAnnotation(), isAnyIdentifier(), isConfigurationPattern(), clang::format::FormatToken::isFunctionLikeKeyword(), isLiteral(), isPipeDeclerator(), clang::Preprocessor::IsPreviousCachedToken(), isSameToken(), clang::format::FormatToken::isSimpleTypeSpecifier(), clang::format::FormatToken::isStringLiteral(), isTargetEnvironment(), isTypeQualifier(), clang::format::FormatToken::isUnaryOperator(), clang::Preprocessor::LexAfterModuleImport(), clang::Preprocessor::LexNonComment(), clang::Preprocessor::LexOnOffSwitch(), clang::Preprocessor::LexUnexpandedNonComment(), clang::TokenValue::operator==(), ParseAlignPragma(), clang::Parser::ParseConstraintExpression(), parseOpenMPReductionId(), ParseReductionId(), clang::Parser::ParseTopLevelDecl(), ReadOriginalFileName(), clang::Parser::SkipMalformedDecl(), clang::Parser::SkipUntil(), clang::MacroArgs::StringifyArgument(), clang::html::SyntaxHighlight(), clang::Parser::TryAnnotateCXXScopeToken(), tryConsumeMutableOrConstexprToken(), and TypeTraitArity().

◆ getLastLoc()

SourceLocation clang::Token::getLastLoc ( ) const
inline

Definition at line 147 of file Token.h.

References getAnnotationEndLoc(), getLocation(), and isAnnotation().

Referenced by clang::Parser::TryAnnotateTypeOrScopeToken().

◆ getLength()

unsigned clang::Token::getLength ( ) const
inline

◆ getLiteralData()

const char* clang::Token::getLiteralData ( ) const
inline

getLiteralData - For a literal token (numeric constant, string, etc), this returns a pointer to the start of it in the text buffer if known, null otherwise.

Definition at line 215 of file Token.h.

References isLiteral().

Referenced by GetFirstChar(), clang::Preprocessor::getSpellingOfSingleCharacterNumericConstant(), and UseNSOptionsMacro().

◆ getLocation()

SourceLocation clang::Token::getLocation ( ) const
inline

Return a source location identifier for the specified offset in the current file.

Definition at line 124 of file Token.h.

References clang::SourceLocation::getFromRawEncoding().

Referenced by clang::Sema::ActOnCharacterConstant(), clang::Sema::ActOnNumericConstant(), addConstexprToLambdaDeclSpecifier(), clang::ASTWriter::AddToken(), attributeParsedArgsUnevaluated(), AuditedType(), clang::TokenConcatenation::AvoidConcat(), CheckArrayDesignatorSyntax(), clang::Preprocessor::CheckEndOfDirective(), clang::Preprocessor::CheckMacroName(), clang::Preprocessor::checkModuleIsAvailable(), ComputeDATE_TIME(), clang::Preprocessor::ConcatenateIncludeName(), clang::Parser::ConsumeToken(), DetectEOL(), clang::Parser::Diag(), clang::Preprocessor::Diag(), diagnoseUnexpectedOperator(), clang::DoPrintPreprocessedInput(), clang::Preprocessor::DumpToken(), EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateFeatureLikeBuiltinMacro(), EvaluateHasIncludeCommon(), EvaluateValue(), clang::Parser::ExitScope(), ExpectFeatureIdentifierInfo(), findDirectives(), clang::PreprocessingRecord::findMacroDefinition(), FixDigraph(), getAnnotationRange(), getEndLoc(), clang::arcmt::getFileRemappings(), GetFirstChar(), getLastLoc(), GetLineValue(), clang::ModuleMapParser::getLocation(), getMissingDeclaratorIdLoc(), clang::StringLiteralParser::getOffsetOfStringByte(), clang::Lexer::getSpelling(), clang::Preprocessor::getSpellingOfSingleCharacterNumericConstant(), clang::Preprocessor::HandleDirective(), clang::Preprocessor::HandleEndOfFile(), clang::Preprocessor::HandleIdentifier(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaDependency(), clang::Preprocessor::HandlePragmaIncludeAlias(), clang::Preprocessor::HandlePragmaModuleBuild(), clang::Preprocessor::HandlePragmaPopMacro(), clang::Preprocessor::HandlePragmaSystemHeader(), clang::html::HighlightMacros(), clang::TokenLexer::Init(), isAttributeLateParsed(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isConfigurationPattern(), isGCCAsmStatement(), clang::Preprocessor::IsPreviousCachedToken(), IsStringPrefix(), isTargetEnvironment(), isTrivialSingleTokenExpansion(), clang::TokenLexer::Lex(), clang::Preprocessor::LexAfterModuleImport(), clang::PreprocessorLexer::LexIncludeFilename(), LexModuleNameComponent(), clang::Preprocessor::LexOnOffSwitch(), clang::Preprocessor::LookUpIdentifierInfo(), clang::MacroPPCallbacks::MacroDefined(), clang::MacroPPCallbacks::MacroUndefined(), ParseAlignPragma(), clang::Parser::ParseConstraintExpression(), parseDeclareSimdClauses(), ParseLoopHintValue(), clang::Parser::ParseMSAsmIdentifier(), parseOpenMPReductionId(), clang::Preprocessor::ParsePragmaPushOrPopMacro(), clang::Preprocessor::parseSimpleIntegerLiteral(), clang::Parser::ParseTopLevelDecl(), clang::Parser::ParseUnqualifiedId(), ReadLineMarkerFlags(), ReadOriginalFileName(), resyncUTF8(), clang::RewriteMacrosInInput(), clang::arcmt::trans::MigrationContext::rewritePropertyAttribute(), SelectDigraphErrorMessage(), clang::html::SyntaxHighlight(), takeDeclAttributes(), clang::Parser::TryAnnotateCXXScopeToken(), clang::Parser::TryAnnotateTypeOrScopeToken(), clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(), tryConsumeMutableOrConstexprToken(), clang::Parser::TryConsumeToken(), TypeTraitArity(), updateConsecutiveMacroArgTokens(), and VersionNumberSeparator().

◆ getName()

const char* clang::Token::getName ( ) const
inline

Definition at line 166 of file Token.h.

References clang::tok::getTokenName().

◆ getObjCKeywordID()

tok::ObjCKeywordKind Token::getObjCKeywordID ( ) const

Return the ObjC keyword kind.

getObjCKeywordID - Return the ObjC keyword kind.

Definition at line 67 of file Lexer.cpp.

References clang::CMK_None, getIdentifierInfo(), clang::IdentifierInfo::getObjCKeywordID(), and isAnnotation().

Referenced by isExpandDisabled().

◆ getRawIdentifier()

StringRef clang::Token::getRawIdentifier ( ) const
inline

getRawIdentifier - For a raw identifier token (i.e., an identifier lexed in raw mode), returns a reference to the text substring in the buffer if known.

Definition at line 203 of file Token.h.

References getLength(), and is().

Referenced by clang::Preprocessor::CheckEndOfDirective(), clang::ModuleMapParser::getLocation(), clang::Preprocessor::HandlePragmaModuleBuild(), and clang::Preprocessor::LookUpIdentifierInfo().

◆ hasLeadingEmptyMacro()

bool clang::Token::hasLeadingEmptyMacro ( ) const
inline

Return true if this token has an empty macro before it.

Definition at line 287 of file Token.h.

References getFlag(), and LeadingEmptyMacro.

Referenced by findPlaceholderEnd().

◆ hasLeadingSpace()

bool clang::Token::hasLeadingSpace ( ) const
inline

◆ hasUCN()

bool clang::Token::hasUCN ( ) const
inline

Returns true if this token contains a universal character name.

Definition at line 294 of file Token.h.

References getFlag(), and HasUCN.

Referenced by clang::Preprocessor::LookUpIdentifierInfo().

◆ hasUDSuffix()

bool clang::Token::hasUDSuffix ( ) const
inline

◆ is()

bool clang::Token::is ( tok::TokenKind  K) const
inline

is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {...}".

Definition at line 95 of file Token.h.

Referenced by addConstexprToLambdaDeclSpecifier(), attributeParsedArgsUnevaluated(), clang::TokenConcatenation::AvoidConcat(), buildMSAsmString(), CheckArrayDesignatorSyntax(), clang::Preprocessor::CheckEndOfDirective(), clang::Preprocessor::CheckMacroName(), clang::Preprocessor::ConcatenateIncludeName(), clang::Parser::ConsumeAnyToken(), clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), clang::Preprocessor::CreateString(), DetectEOL(), diagnoseDynamicExceptionSpecification(), diagnoseUnexpectedOperator(), clang::DoPrintPreprocessedInput(), EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateHasIncludeCommon(), EvaluateValue(), findDirectives(), clang::Preprocessor::FinishLexStringLiteral(), getEofData(), getIdentifier(), getIdentifierInfo(), GetLineValue(), getMissingDeclaratorIdLoc(), clang::Parser::getNullabilityKeyword(), getRawIdentifier(), clang::Preprocessor::getSpellingOfSingleCharacterNumericConstant(), clang::Preprocessor::HandleDirective(), clang::Preprocessor::HandleIdentifier(), clang::Preprocessor::HandleMicrosoftCommentPaste(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaDependency(), clang::Preprocessor::HandlePragmaIncludeAlias(), clang::Preprocessor::HandlePragmaModuleBuild(), clang::Preprocessor::HandlePragmaPoison(), clang::format::hash_combine(), clang::html::HighlightMacros(), clang::format::FormatToken::is(), isAttributeLateParsed(), IsBuiltInOrStandardCXX11Attribute(), IsCommonTypo(), isConfigurationPattern(), isEndOfTemplateArgument(), isGCCAsmStatement(), clang::TokenLexer::isNextTokenLParen(), isOneOf(), clang::TokenLexer::isParsingPreprocessorDirective(), isPipeDeclerator(), isResultTypeOrTemplate(), isTargetEnvironment(), isWideStringLiteralFromMacro(), clang::TokenLexer::Lex(), clang::Preprocessor::Lex(), clang::PreprocessorLexer::LexIncludeFilename(), LexModuleNameComponent(), clang::Preprocessor::LexOnOffSwitch(), LexRawTokensFromMainFile(), ParseAlignPragma(), clang::Parser::ParseAssignmentExpression(), clang::Parser::ParseConstraintExpression(), parseDeclareSimdClauses(), ParseLoopHintValue(), clang::Parser::ParseMSAsmIdentifier(), parseOpenMPReductionId(), clang::Preprocessor::parseSimpleIntegerLiteral(), clang::Parser::ParseTopLevelDecl(), clang::Parser::ParseUnqualifiedId(), ReadLineMarkerFlags(), clang::Lexer::ReadToEndOfLine(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::arcmt::trans::MigrationContext::rewritePropertyAttribute(), setEofData(), setRawIdentifierData(), clang::Parser::SkipMalformedDecl(), clang::Parser::SkipUntil(), clang::MacroArgs::StringifyArgument(), takeDeclAttributes(), clang::Parser::TryAnnotateCXXScopeToken(), clang::Parser::TryAnnotateTypeOrScopeToken(), clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec(), TypeTraitArity(), and VersionNumberSeparator().

◆ isAnnotation()

bool clang::Token::isAnnotation ( ) const
inline

◆ isAnyIdentifier()

bool clang::Token::isAnyIdentifier ( ) const
inline

Return true if this is a raw identifier (when lexing in raw mode) or a non-keyword identifier (when lexing in non-raw mode).

Definition at line 107 of file Token.h.

References getKind(), and clang::tok::isAnyIdentifier().

◆ isAtStartOfLine()

bool clang::Token::isAtStartOfLine ( ) const
inline

◆ isEditorPlaceholder()

bool clang::Token::isEditorPlaceholder ( ) const
inline

Returns true if this token is an editor placeholder.

Editor placeholders are produced by the code-completion engine and are represented as characters between '<#' and '#>' in the source code. The lexer uses identifier tokens to represent placeholders.

Definition at line 308 of file Token.h.

References getFlag(), and IsEditorPlaceholder.

Referenced by clang::Parser::ParseTopLevelDecl(), and clang::Parser::TryAnnotateTypeOrScopeToken().

◆ isExpandDisabled()

bool clang::Token::isExpandDisabled ( ) const
inline

Return true if this identifier token should never be expanded in the future, due to C99 6.10.3.4p2.

Definition at line 274 of file Token.h.

References DisableExpand, getFlag(), getObjCKeywordID(), and isObjCAtKeyword().

Referenced by clang::Preprocessor::DumpToken(), and clang::Preprocessor::HandleIdentifier().

◆ isLiteral()

bool clang::Token::isLiteral ( ) const
inline

◆ isNot()

bool clang::Token::isNot ( tok::TokenKind  K) const
inline

Definition at line 96 of file Token.h.

Referenced by addConstexprToLambdaDeclSpecifier(), clang::MacroArgs::ArgNeedsPreexpansion(), attributeParsedArgsUnevaluated(), clang::TokenConcatenation::AvoidConcat(), clang::CacheTokens(), CheckArrayDesignatorSyntax(), clang::Preprocessor::CheckEndOfDirective(), clang::Preprocessor::CheckMacroName(), clang::Preprocessor::ConcatenateIncludeName(), DetectEOL(), diagnoseDynamicExceptionSpecification(), clang::Preprocessor::DiscardUntilEndOfDirective(), DoPrintMacros(), EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateFeatureLikeBuiltinMacro(), EvaluateHasIncludeCommon(), EvaluateValue(), clang::DumpRawTokensAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), findDirectives(), clang::Preprocessor::FinishLexStringLiteral(), clang::MacroArgs::getArgLength(), getIdentifierInfo(), GetLineValue(), getMissingDeclaratorIdLoc(), clang::Preprocessor::HandleMicrosoftCommentPaste(), clang::PragmaNamespace::HandlePragma(), clang::Preprocessor::HandlePragmaDependency(), clang::Preprocessor::HandlePragmaIncludeAlias(), clang::Preprocessor::HandlePragmaModuleBuild(), clang::Preprocessor::HandlePragmaPoison(), clang::html::HighlightMacros(), clang::MacroArgs::invokedWithVariadicArgument(), isAttributeLateParsed(), IsBuiltInOrStandardCXX11Attribute(), isPipeDeclerator(), isTargetEnvironment(), LexModuleName(), clang::Preprocessor::LexOnOffSwitch(), LexRawTokensFromMainFile(), clang::Parser::ConditionDeclarationOrInitStatementState::markNotExpression(), ParseAlignPragma(), clang::Parser::ParseConstraintExpression(), parseDeclareSimdClauses(), ParseLoopHintValue(), clang::Parser::ParseMSAsmIdentifier(), clang::Preprocessor::ParsePragmaPushOrPopMacro(), clang::Parser::ParseTopLevelDecl(), clang::Parser::ParseUnqualifiedId(), ReadLineMarkerFlags(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::arcmt::trans::MigrationContext::rewritePropertyAttribute(), clang::Parser::SkipUntil(), clang::MacroArgs::StringifyArgument(), clang::html::SyntaxHighlight(), clang::format::tokenCanStartNewLine(), clang::TokenRewriter::TokenRewriter(), clang::Parser::TryConsumeToken(), and TypeTraitArity().

◆ isObjCAtKeyword()

bool Token::isObjCAtKeyword ( tok::ObjCKeywordKind  objcKey) const

Return true if we have an ObjC keyword identifier.

isObjCAtKeyword - Return true if we have an ObjC keyword identifier.

Definition at line 58 of file Lexer.cpp.

References getIdentifierInfo(), and isAnnotation().

Referenced by isExpandDisabled(), clang::format::FormatToken::isObjCAtKeyword(), clang::Parser::ParseTopLevelDecl(), and clang::Parser::SkipMalformedDecl().

◆ isOneOf() [1/2]

bool clang::Token::isOneOf ( tok::TokenKind  K1,
tok::TokenKind  K2 
) const
inline

◆ isOneOf() [2/2]

template<typename... Ts>
bool clang::Token::isOneOf ( tok::TokenKind  K1,
tok::TokenKind  K2,
Ts...  Ks 
) const
inline

Definition at line 101 of file Token.h.

References is(), and isOneOf().

◆ needsCleaning()

bool clang::Token::needsCleaning ( ) const
inline

◆ setAnnotationEndLoc()

void clang::Token::setAnnotationEndLoc ( SourceLocation  L)
inline

◆ setAnnotationRange()

void clang::Token::setAnnotationRange ( SourceRange  R)
inline

◆ setAnnotationValue()

void clang::Token::setAnnotationValue ( void *  val)
inline

◆ setEofData()

void clang::Token::setEofData ( const void *  D)
inline

Definition at line 194 of file Token.h.

References clang::comments::tok::eof, and is().

Referenced by TypeTraitArity().

◆ setFlag()

void clang::Token::setFlag ( TokenFlags  Flag)
inline

◆ setFlagValue()

void clang::Token::setFlagValue ( TokenFlags  Flag,
bool  Val 
)
inline

Set a flag to either true or false.

Definition at line 257 of file Token.h.

References clearFlag(), and setFlag().

Referenced by isTrivialSingleTokenExpansion(), and clang::TokenLexer::Lex().

◆ setIdentifierInfo()

void clang::Token::setIdentifierInfo ( IdentifierInfo II)
inline

◆ setKind()

void clang::Token::setKind ( tok::TokenKind  K)
inline

◆ setLength()

void clang::Token::setLength ( unsigned  Len)
inline

◆ setLiteralData()

void clang::Token::setLiteralData ( const char *  Ptr)
inline

◆ setLocation()

void clang::Token::setLocation ( SourceLocation  L)
inline

◆ setRawIdentifierData()

void clang::Token::setRawIdentifierData ( const char *  Ptr)
inline

Definition at line 207 of file Token.h.

References is().

Referenced by clang::Preprocessor::CreateString(), findPlaceholderEnd(), and maybeDiagnoseUTF8Homoglyph().

◆ startToken()

void clang::Token::startToken ( )
inline

◆ stringifiedInMacro()

bool clang::Token::stringifiedInMacro ( ) const
inline

Returns true if this token is formed by macro by stringizing or charizing operator.

Definition at line 298 of file Token.h.

References getFlag(), and StringifiedInMacro.

Referenced by isWideStringLiteralFromMacro().


The documentation for this class was generated from the following files: