A wrapper around a Token
storing information about the whitespace characters preceding it. More...
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Format/FormatToken.h"
true
if this token starts a sequence with the given tokens in order, following the Next
pointers, ignoring comments.
true
if this token ends a sequence with the given tokens in order, following the Previous
pointers, ignoring comments.
Tok
is ([{ or an opening < of a template or in protos.
Tok
is )]} or a closing > of a template or in protos.
true
if this is a "." or "->" accessing a member.
true
if this is a keyword that can be used like a function call (e.g.
true
if this is a string literal that's like a label, e.g.
true
if the range of whitespace immediately preceding the Token
is not empty.
true
if this token ends a block indented initializer list.
true
if this tokens starts a block-type list, i.e.
Token
.
Token
.
Token
.
true
if this token is an unterminated literal.
true
if it is allowed to break before this token.
true
if this is the ">" of "template<..>".
true
if this token starts a binary expression, i.e.
true
if this token ends a binary expression.
DeclStmt
defining multiple variables?
true
, this token has been fully formatted (indented and potentially re-formatted inside), and we do not allow further formatting changes.
true
if this is the last token within requires clause.
true
if this token ends a group of C++ attributes.
Token
.
Token
after formatting.
WhiteSpaceStart
).
MacroParent
.
A wrapper around a Token
storing information about the whitespace characters preceding it.
Definition at line 299 of file FormatToken.h.
◆ FormatToken() clang::format::FormatToken::FormatToken ( ) inlineDefinition at line 300 of file FormatToken.h.
◆ canBePointerOrReferenceQualifier() bool clang::format::FormatToken::canBePointerOrReferenceQualifier ( ) const inlineDefinition at line 689 of file FormatToken.h.
◆ closesBlockOrBlockTypeList() bool clang::format::FormatToken::closesBlockOrBlockTypeList ( const FormatStyle & Style ) const inlineSame as opensBlockOrBlockTypeList, but for the closing token.
Definition at line 878 of file FormatToken.h.
◆ closesScope() bool clang::format::FormatToken::closesScope ( ) const inline ◆ closesScopeAfterBlock() bool clang::format::FormatToken::closesScopeAfterBlock ( ) const inline ◆ copyFrom() void clang::format::FormatToken::copyFrom ( const FormatToken & Tok ) inline ◆ endsSequence()template<typename A , typename... Ts>
bool clang::format::FormatToken::endsSequence ( A K1, Ts... Tokens ) const inlinetrue
if this token ends a sequence with the given tokens in order, following the Previous
pointers, ignoring comments.
For example, given tokens [T1, T2, T3], the function returns true if 3 tokens ending at this (ignoring comments) are [T3, T2, T1]. In other words, the tokens passed to this function need to the reverse of the order the tokens appear in code.
Definition at line 662 of file FormatToken.h.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), closesScopeAfterBlock(), and clang::format::AnnotatedLine::endsWith().
◆ getBlockKind() ◆ getDecision() ◆ getNamespaceToken() const FormatToken * clang::format::FormatToken::getNamespaceToken ( ) const inline ◆ getNextNonComment() FormatToken * clang::format::FormatToken::getNextNonComment ( ) const inline ◆ getPackingKind() ◆ getPrecedence() prec::Level clang::format::FormatToken::getPrecedence ( ) const inline ◆ getPreviousNonComment() FormatToken * clang::format::FormatToken::getPreviousNonComment ( ) const inline ◆ getStartOfNonWhitespace() SourceLocation clang::format::FormatToken::getStartOfNonWhitespace ( ) const inline ◆ getType() TokenType clang::format::FormatToken::getType ( ) const inlineReturns the token's type, e.g.
whether "<" is a template opener or binary operator.
Definition at line 432 of file FormatToken.h.
◆ hasWhitespaceBefore() bool clang::format::FormatToken::hasWhitespaceBefore ( ) const inline ◆ is() [1/6] ◆ is() [2/6] ◆ is() [3/6] ◆ is() [4/6] ◆ is() [5/6]Definition at line 614 of file FormatToken.h.
Referenced by clang::format::NamespaceEndCommentsFixer::analyze(), clang::format::JavaScriptImportSorter::analyze(), clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(), clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), clang::format::TokenAnnotator::calculateFormattingInformation(), closesScopeAfterBlock(), clang::format::computeNewlines(), clang::format::continuesLineCommentSection(), clang::format::UnwrappedLineFormatter::format(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::AnnotatedLine::getFirstNonComment(), clang::format::AnnotatedLine::getLastNonComment(), clang::format::getNamespaceToken(), clang::format::FormatTokenSource::getNextNonComment(), clang::format::hasNestedBlockInlined(), clang::format::isAllmanBrace(), clang::format::isAllmanLambdaBrace(), isBlockIndentedInitRBrace(), clang::format::AnnotatedLine::isComment(), clang::format::isConfiguredQualifierOrType(), clang::format::isCtorOrDtorName(), clang::format::isFunctionDeclarationName(), isIf(), clang::format::isQualifierOrType(), isTypeName(), clang::format::markOptionalBraces(), clang::format::mustBeJSIdent(), clang::format::ContinuationIndenter::mustBreak(), opensBlockOrBlockTypeList(), clang::format::opensProtoMessageField(), clang::format::MacroExpander::DefinitionParser::parse(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), clang::format::ShouldBreakBeforeBrace(), and clang::format::startsNextParameter().
◆ is() [6/6] ◆ isAccessSpecifier() bool clang::format::FormatToken::isAccessSpecifier ( bool ColonRequired =true
) const inline ◆ isAccessSpecifierKeyword() bool clang::format::FormatToken::isAccessSpecifierKeyword ( ) const inline ◆ isAttribute() bool clang::format::FormatToken::isAttribute ( ) const inline
Definition at line 668 of file FormatToken.h.
◆ isBinaryOperator() bool clang::format::FormatToken::isBinaryOperator ( ) const inlineDefinition at line 779 of file FormatToken.h.
◆ isBlockIndentedInitRBrace() bool clang::format::FormatToken::isBlockIndentedInitRBrace ( const FormatStyle & Style ) const ◆ isCppAlternativeOperatorKeyword() bool clang::format::FormatToken::isCppAlternativeOperatorKeyword ( ) const inlineDefinition at line 740 of file FormatToken.h.
◆ isCppStructuredBinding() bool clang::format::FormatToken::isCppStructuredBinding ( bool IsCpp ) const inlineReturns whether the token is the left square bracket of a C++ structured binding declaration.
Definition at line 866 of file FormatToken.h.
◆ isFunctionLikeKeyword() bool clang::format::FormatToken::isFunctionLikeKeyword ( ) const inlineReturns true
if this is a keyword that can be used like a function call (e.g.
sizeof, typeid, ...).
Definition at line 791 of file FormatToken.h.
◆ isIf() bool clang::format::FormatToken::isIf ( bool AllowConstexprMacro =true
) const inline ◆ isLabelString() bool clang::format::FormatToken::isLabelString ( ) const inline
Returns true
if this is a string literal that's like a label, e.g.
ends with "=" or ":".
Definition at line 806 of file FormatToken.h.
◆ isMemberAccess() bool clang::format::FormatToken::isMemberAccess ( ) const inline ◆ isNot() bool clang::format::FormatToken::isNot ( T Kind ) const inline ◆ isObjCAccessSpecifier() bool clang::format::FormatToken::isObjCAccessSpecifier ( ) const inlineDefinition at line 700 of file FormatToken.h.
◆ isObjCAtKeyword() ◆ isOneOf() [1/2]template<typename A , typename B >
bool clang::format::FormatToken::isOneOf ( A K1, B K2 ) const inlineDefinition at line 626 of file FormatToken.h.
Referenced by clang::format::LeftRightQualifierAlignmentFixer::analyzeLeft(), clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(), clang::format::computeNewlines(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::isAllmanBrace(), clang::format::isAllmanLambdaBrace(), clang::format::isC78ParameterDecl(), clang::format::isC78Type(), clang::format::IsFunctionArgument(), clang::format::isJSDeclOrStmt(), clang::format::AdditionalKeywords::isTableGenKeyword(), clang::format::AdditionalKeywords::isVerilogIdentifier(), clang::format::AdditionalKeywords::isVerilogQualifier(), clang::format::mustBeJSIdent(), clang::format::mustBeJSIdentOrValue(), and clang::format::tokenCanStartNewLine().
◆ isOneOf() [2/2]template<typename A , typename B , typename... Ts>
bool clang::format::FormatToken::isOneOf ( A K1, B K2, Ts... Ks ) const inline ◆ isPointerOrReference() bool clang::format::FormatToken::isPointerOrReference ( ) const inline ◆ isStringLiteral() bool clang::format::FormatToken::isStringLiteral ( ) const inlineDefinition at line 666 of file FormatToken.h.
◆ isTrailingComment() bool clang::format::FormatToken::isTrailingComment ( ) const inline ◆ isTypeFinalized() bool clang::format::FormatToken::isTypeFinalized ( ) const inline ◆ isTypeName() bool clang::format::FormatToken::isTypeName ( const LangOptions & LangOpts ) const ◆ isTypeOrIdentifier() bool clang::format::FormatToken::isTypeOrIdentifier ( const LangOptions & LangOpts ) const ◆ isUnaryOperator() bool clang::format::FormatToken::isUnaryOperator ( ) const inlineDefinition at line 763 of file FormatToken.h.
◆ opensBlockOrBlockTypeList() bool clang::format::FormatToken::opensBlockOrBlockTypeList ( const FormatStyle & Style ) const ◆ opensScope() bool clang::format::FormatToken::opensScope ( ) const inline ◆ overwriteFixedType() void clang::format::FormatToken::overwriteFixedType ( TokenType T ) inline ◆ setBlockKind() ◆ setDecision() ◆ setFinalizedType() void clang::format::FormatToken::setFinalizedType ( TokenType T ) inline ◆ setPackingKind() ◆ setType() ◆ startsSequence()template<typename A , typename... Ts>
bool clang::format::FormatToken::startsSequence ( A K1, Ts... Tokens ) const inline ◆ ArrayInitializerLineStart bool clang::format::FormatToken::ArrayInitializerLineStart = falseThis notes the start of the line of an array initializer.
Definition at line 577 of file FormatToken.h.
◆ BindingStrength unsigned clang::format::FormatToken::BindingStrength = 0The binding strength of a token.
This is a combined value of operator precedence, parenthesis nesting, etc.
Definition at line 518 of file FormatToken.h.
◆ BlockParameterCount unsigned clang::format::FormatToken::BlockParameterCount = 0Number of parameters that are nested blocks, if this is "(", "[" or "<".
Definition at line 497 of file FormatToken.h.
◆ BraceCount int8_t clang::format::FormatToken::BraceCount = 0Number of optional braces to be inserted after this token: -1: a single left brace 0: no braces >0: number of right braces.
Definition at line 595 of file FormatToken.h.
◆ CanBreakBefore unsigned clang::format::FormatToken::CanBreakBefore ◆ Children ◆ ClosesRequiresClause unsigned clang::format::FormatToken::ClosesRequiresClause ◆ ClosesTemplateDeclaration unsigned clang::format::FormatToken::ClosesTemplateDeclaration ◆ ColumnWidth unsigned clang::format::FormatToken::ColumnWidth = 0The width of the non-whitespace parts of the token (or its first line for multi-line tokens) in columns.
We need this to correctly measure number of columns a token spans.
Definition at line 483 of file FormatToken.h.
◆ ContinuesLineCommentSection unsigned clang::format::FormatToken::ContinuesLineCommentSectionDoes this line comment continue a line comment section?
Only set to true if Type
== TT_LineComment
.
Definition at line 373 of file FormatToken.h.
◆ EndsBinaryExpression unsigned clang::format::FormatToken::EndsBinaryExpressiontrue
if this token ends a binary expression.
Definition at line 363 of file FormatToken.h.
◆ EndsCppAttributeGroup unsigned clang::format::FormatToken::EndsCppAttributeGrouptrue
if this token ends a group of C++ attributes.
Definition at line 384 of file FormatToken.h.
◆ FakeLParensStores the number of required fake parentheses and the corresponding operator precedence.
If multiple fake parentheses start at a token, this vector stores them in reverse order, i.e. inner fake parenthesis first.
Definition at line 552 of file FormatToken.h.
◆ FakeRParens unsigned clang::format::FormatToken::FakeRParens = 0Insert this many fake ) after this token for correct indentation.
Definition at line 554 of file FormatToken.h.
◆ Finalized unsigned clang::format::FormatToken::Finalized ◆ ForcedPrecedenceUsed to set an operator precedence explicitly.
Definition at line 462 of file FormatToken.h.
◆ HasFormFeedBefore bool clang::format::FormatToken::HasFormFeedBefore = falseHas "\n\f\n" or "\n\f\r\n" before TokenText.
Definition at line 589 of file FormatToken.h.
◆ HasUnescapedNewline unsigned clang::format::FormatToken::HasUnescapedNewline ◆ IndentLevel unsigned clang::format::FormatToken::IndentLevel = 0 ◆ IsArrayInitializer bool clang::format::FormatToken::IsArrayInitializer = false ◆ IsFirst unsigned clang::format::FormatToken::IsFirst ◆ IsMultiline unsigned clang::format::FormatToken::IsMultilineWhether the token text contains newlines (escaped or not).
Definition at line 335 of file FormatToken.h.
◆ IsUnterminatedLiteral unsigned clang::format::FormatToken::IsUnterminatedLiteralSet to true
if this token is an unterminated literal.
Definition at line 351 of file FormatToken.h.
◆ LastLineColumnWidth unsigned clang::format::FormatToken::LastLineColumnWidth = 0Contains the width in columns of the last line of a multi-line token.
Definition at line 487 of file FormatToken.h.
◆ LastNewlineOffset unsigned clang::format::FormatToken::LastNewlineOffset = 0The offset just past the last '
' in this token's leading whitespace (relative to WhiteSpaceStart
).
0 if there is no '
'.
Definition at line 478 of file FormatToken.h.
◆ LongestObjCSelectorName unsigned clang::format::FormatToken::LongestObjCSelectorName = 0If this is the first ObjC selector name in an ObjC method definition or call, this contains the length of the longest name.
This being set to 0 means that the selectors should not be colon-aligned, e.g. because several of them are block-type.
Definition at line 535 of file FormatToken.h.
◆ MacroCtx ◆ MacroParent bool clang::format::FormatToken::MacroParent = falseWhen macro expansion introduces nodes with children, those are marked as MacroParent
.
FIXME: The formatting code currently hard-codes the assumption that child nodes are introduced by blocks following an opening brace. This is deeply baked into the code and disentangling this will require signficant refactorings. MacroParent
allows us to special-case the cases in which we treat parents as block-openers for now.
Definition at line 612 of file FormatToken.h.
◆ MatchingParen FormatToken* clang::format::FormatToken::MatchingParen = nullptr ◆ MightBeFunctionDeclParen bool clang::format::FormatToken::MightBeFunctionDeclParen = falseMight be function declaration open/closing paren.
Definition at line 586 of file FormatToken.h.
◆ MustBreakBefore unsigned clang::format::FormatToken::MustBreakBefore ◆ MustBreakBeforeFinalized unsigned clang::format::FormatToken::MustBreakBeforeFinalizedWhether MustBreakBefore is finalized during parsing and must not be reset between runs.
Definition at line 348 of file FormatToken.h.
◆ NestingLevel unsigned clang::format::FormatToken::NestingLevel = 0 ◆ Newlines int clang::format::FormatToken::Newlines = -1The number of newlines immediately before the Token
after formatting.
This is used to avoid overlapping whitespace replacements when Newlines
is recomputed for a finalized preprocessor branching directive.
Definition at line 474 of file FormatToken.h.
◆ NewlinesBefore unsigned clang::format::FormatToken::NewlinesBefore = 0 ◆ Next FormatToken* clang::format::FormatToken::Next = nullptrThe next token in the unwrapped line.
Definition at line 571 of file FormatToken.h.
Referenced by clang::format::NamespaceEndCommentsFixer::analyze(), clang::format::LeftRightQualifierAlignmentFixer::analyzeRight(), clang::format::AnnotatedLine::AnnotatedLine(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), clang::format::TokenAnnotator::calculateFormattingInformation(), clang::format::UnwrappedLineFormatter::format(), clang::format::CommaSeparatedList::formatAfterToken(), clang::format::IsFunctionArgument(), clang::format::isFunctionDeclarationName(), clang::format::CommaSeparatedList::precomputeFormattingInfos(), and clang::format::BreakableLineCommentSection::updateNextToken().
◆ NextOperator FormatToken* clang::format::FormatToken::NextOperator = nullptr ◆ ObjCSelectorNameParts unsigned clang::format::FormatToken::ObjCSelectorNameParts = 0If this is the first ObjC selector name in an ObjC method definition or call, this contains the number of parts that the whole selector consist of.
Definition at line 540 of file FormatToken.h.
◆ OperatorIndex unsigned clang::format::FormatToken::OperatorIndex = 0If this is an operator (or "."/"->") in a sequence of operators with the same precedence, contains the 0-based operator index.
Definition at line 558 of file FormatToken.h.
◆ Optional bool clang::format::FormatToken::Optional = false ◆ OriginalColumn unsigned clang::format::FormatToken::OriginalColumn = 0 ◆ ParameterCount unsigned clang::format::FormatToken::ParameterCount = 0Number of parameters, if this is "(", "[" or "<".
Definition at line 493 of file FormatToken.h.
◆ ParameterIndex unsigned clang::format::FormatToken::ParameterIndex = 0The 0-based index of the parameter/argument.
For ObjC it is set for the selector name token. For now calculated only for ObjC.
Definition at line 545 of file FormatToken.h.
◆ ParentBracket tok::TokenKind clang::format::FormatToken::ParentBracket = tok::unknownIf this is a bracket ("<", "(", "[" or "{"), contains the kind of the surrounding bracket.
Definition at line 501 of file FormatToken.h.
◆ PartOfMultiVariableDeclStmt unsigned clang::format::FormatToken::PartOfMultiVariableDeclStmtIs this token part of a DeclStmt
defining multiple variables?
Only set if Type
== TT_StartOfName
.
Definition at line 368 of file FormatToken.h.
◆ Previous FormatToken* clang::format::FormatToken::Previous = nullptr ◆ Role std::shared_ptr<TokenRole> clang::format::FormatToken::RoleA token can have a special role that can carry extra information about the token's formatting.
FIXME: Make FormatToken for parsing and AnnotatedToken two different classes and make this a unique_ptr in the AnnotatedToken class.
Definition at line 325 of file FormatToken.h.
◆ SpacesRequiredBefore unsigned clang::format::FormatToken::SpacesRequiredBefore = 0The number of spaces that should be inserted before this token.
Definition at line 490 of file FormatToken.h.
◆ SplitPenalty unsigned clang::format::FormatToken::SplitPenalty = 0Penalty for inserting a line break before this token.
Definition at line 528 of file FormatToken.h.
◆ StartsBinaryExpression unsigned clang::format::FormatToken::StartsBinaryExpressiontrue
if this token starts a binary expression, i.e.
has at least one fake l_paren with a precedence greater than prec::Unknown.
Definition at line 361 of file FormatToken.h.
◆ StartsColumn bool clang::format::FormatToken::StartsColumn = falseThe first token in set of column elements.
Definition at line 574 of file FormatToken.h.
◆ Tok Token clang::format::FormatToken::TokThe Token
.
Definition at line 313 of file FormatToken.h.
Referenced by clang::format::UnwrappedLineFormatter::format(), is(), clang::format::isConfiguredQualifier(), clang::format::isFunctionDeclarationName(), clang::format::AdditionalKeywords::isJavaScriptIdentifier(), isObjCAtKeyword(), clang::format::isQualifier(), isTypeName(), clang::format::AdditionalKeywords::isWordLike(), clang::format::JavaScriptImportSorter::JavaScriptImportSorter(), clang::format::mustBeJSIdent(), clang::format::mustBeJSIdentOrValue(), clang::format::ScopedMacroState::ScopedMacroState(), and clang::format::ShouldBreakBeforeBrace().
◆ TokenText StringRef clang::format::FormatToken::TokenTextThe raw text of the token.
Contains the raw token text without leading whitespace and without leading escaped newlines.
Definition at line 319 of file FormatToken.h.
Referenced by clang::format::BreakableBlockComment::adaptStartOfLine(), clang::format::NamespaceEndCommentsFixer::analyze(), clang::format::JavaScriptImportSorter::analyze(), clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableStringLiteral::BreakableStringLiteral(), clang::format::BreakableComment::compressWhitespace(), clang::format::continuesLineCommentSection(), clang::format::getEnclosingFunctionName(), clang::format::getNamespaceTokenText(), clang::format::BreakableBlockComment::insertBreak(), clang::format::BreakableLineCommentSection::insertBreak(), clang::format::isCtorOrDtorName(), clang::format::isPossibleMacro(), isTypeName(), clang::format::MacroExpander::DefinitionParser::parse(), clang::format::BreakableBlockComment::reflow(), clang::format::BreakableLineCommentSection::reflow(), and clang::format::BreakableStringLiteralUsingOperators::updateAfterBroken().
◆ TotalLength unsigned clang::format::FormatToken::TotalLength = 0 ◆ UnbreakableTailLength unsigned clang::format::FormatToken::UnbreakableTailLength = 0The length of following tokens until the next natural split point, or the next token that can be broken.
Definition at line 513 of file FormatToken.h.
◆ WhitespaceRange SourceRange clang::format::FormatToken::WhitespaceRangeThe documentation for this struct was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4