std::shared_ptr<TokenRole>
Role;
394 unsignedBlockKind : 2;
402assert(
getBlockKind() == BBK &&
"BraceBlockKind overflow!");
407 unsignedDecision : 2;
415assert(
getDecision() ==
D&&
"FormatDecision overflow!");
420 unsignedPackingKind : 2;
428assert(
getPackingKind() == K &&
"ParameterPackingKind overflow!");
432 unsignedTypeIsFinalized : 1;
445assert((!TypeIsFinalized ||
T==
Type) &&
446 "Please use overwriteFixedType to change a fixed type.");
457TypeIsFinalized =
true;
462TypeIsFinalized =
false;
609std::optional<MacroExpansion>
MacroCtx;
632 template<
typenameA,
typenameB>
bool isOneOf(A K1, B K2)
const{
635 template<
typenameA,
typenameB,
typename... Ts>
636 bool isOneOf(A K1, B K2, Ts... Ks)
const{
639 template<
typenameT>
bool isNot(
T Kind)
const{
return!
is(
Kind); }
641 bool isIf(
boolAllowConstexprMacro =
true)
const{
642 return is(tok::kw_if) ||
endsSequence(tok::kw_constexpr, tok::kw_if) ||
643(
endsSequence(tok::identifier, tok::kw_if) && AllowConstexprMacro);
656 template<
typenameA,
typename... Ts>
658 returnstartsSequenceInternal(K1, Tokens...);
667 template<
typenameA,
typename... Ts>
669 returnendsSequenceInternal(K1, Tokens...);
675 return isOneOf(tok::kw___attribute, tok::kw___declspec, TT_AttributeMacro);
683 return isOneOf(tok::kw_public, tok::kw_protected, tok::kw_private);
692 returnNextNonComment && NextNonComment->is(tok::colon);
696 return isOneOf(tok::kw_const, tok::kw_restrict, tok::kw_volatile,
697tok::kw__Nonnull, tok::kw__Nullable,
698tok::kw__Null_unspecified, tok::kw___ptr32, tok::kw___ptr64,
699tok::kw___funcref) ||
707 return is(tok::at) &&
Next&&
717 if(
is(TT_TemplateString) &&
TokenText.ends_with(
"${"))
719 if(
is(TT_DictLiteral) &&
is(tok::less))
721 return isOneOf(tok::l_paren, tok::l_brace, tok::l_square,
727 if(
is(TT_TemplateString) &&
TokenText.starts_with(
"}"))
729 if(
is(TT_DictLiteral) &&
is(tok::greater))
731 return isOneOf(tok::r_paren, tok::r_brace, tok::r_square,
737 return isOneOf(tok::arrow, tok::period, tok::arrowstar) &&
738!
isOneOf(TT_DesignatedInitializerPeriod, TT_TrailingReturnArrow,
739TT_LambdaArrow, TT_LeadingJavaAnnotation);
743 return isOneOf(tok::star, tok::amp, tok::ampamp);
758 casetok::exclaimequal:
762 casetok::caretequal:
774 casetok::minusminus:
778 casetok::kw_alignof:
791 return is(tok::comment) &&
801 return isOneOf(tok::kw_throw, tok::kw_typeid, tok::kw_return,
802tok::kw_sizeof, tok::kw_alignof, tok::kw_alignas,
803tok::kw_decltype, tok::kw_noexcept, tok::kw_static_assert,
806#include
"clang/Basic/TransformTypeTraits.def" 813 if(
isNot(tok::string_literal))
816 if(Content.starts_with(
"\"") || Content.starts_with(
"'"))
817Content = Content.drop_front(1);
818 if(Content.ends_with(
"\"") || Content.ends_with(
"'"))
819Content = Content.drop_back(1);
820Content = Content.trim();
821 returnContent.size() > 1 &&
822(Content.back() ==
':'|| Content.back() ==
'=');
858 while(
Tok&&
Tok->
is(tok::comment))
873 if(!IsCpp ||
isNot(tok::l_square))
877 T=
T->getPreviousNonComment();
878}
while(
T&&
T->isOneOf(tok::kw_const, tok::kw_volatile, tok::amp,
880 return T&&
T->is(tok::kw_auto);
894 if(
is(tok::comment))
897 if(NamespaceTok && NamespaceTok->
isOneOf(tok::kw_inline, tok::kw_export))
899 returnNamespaceTok &&
900NamespaceTok->
isOneOf(tok::kw_namespace, TT_NamespaceMacro)
912 template<
typenameA,
typename... Ts>
913 boolstartsSequenceInternal(A K1, Ts... Tokens)
const{
914 if(
is(tok::comment) &&
Next)
915 return Next->startsSequenceInternal(K1, Tokens...);
916 return is(K1) &&
Next&&
Next->startsSequenceInternal(Tokens...);
919 template<
typenameA>
boolstartsSequenceInternal(A K1)
const{
920 if(
is(tok::comment) &&
Next)
921 return Next->startsSequenceInternal(K1);
925 template<
typenameA,
typename... Ts>
boolendsSequenceInternal(A K1)
const{
927 return Previous->endsSequenceInternal(K1);
931 template<
typenameA,
typename... Ts>
932 boolendsSequenceInternal(A K1, Ts... Tokens)
const{
934 return Previous->endsSequenceInternal(K1, Tokens...);
988 boolDryRun)
override;
991 boolDryRun)
override;
995Commas.push_back(
Token);
1001 returnCommas.back();
1007 structColumnFormat {
1012 unsignedTotalWidth;
1023 constColumnFormat *getColumnFormat(
unsignedRemainingCharacters)
const;
1026SmallVector<const FormatToken *, 8> Commas;
1030SmallVector<unsigned, 8> ItemLengths;
1033SmallVector<ColumnFormat, 4> Formats;
1035 boolHasNestedBracedList;
1105&IdentTable.
get(
"__CLANG_FORMAT_INTERNAL_IDENT_AFTER_DEFINE__");
1293JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
1300CSharpExtraKeywords = std::unordered_set<IdentifierInfo *>(
1317VerilogExtraKeywords = std::unordered_set<IdentifierInfo *>(
1383TableGenExtraKeywords = std::unordered_set<IdentifierInfo *>({
1676 boolAcceptIdentifierName =
true)
const{
1686 casetok::kw_continue:
1688 casetok::kw_default:
1689 casetok::kw_delete:
1693 casetok::kw_export:
1697 casetok::kw_import:
1698 casetok::kw_module:
1700 casetok::kw_return:
1701 casetok::kw_static:
1702 casetok::kw_switch:
1707 casetok::kw_typeof:
1712 casetok::identifier: {
1715 boolIsPseudoKeyword =
1717JsExtraKeywords.end();
1718 returnAcceptIdentifierName || !IsPseudoKeyword;
1728#define KEYWORD(X, Y) case tok::kw_##X: 1729#include "clang/Basic/TokenKinds.def" 1742 if(Tok.isAccessSpecifierKeyword())
1744 switch(Tok.Tok.getKind()) {
1752 casetok::kw_continue:
1753 casetok::kw_default:
1755 casetok::kw_double:
1758 casetok::kw_explicit:
1759 casetok::kw_extern:
1767 casetok::kw_namespace:
1769 casetok::kw_operator:
1770 casetok::kw_return:
1772 casetok::kw_sizeof:
1773 casetok::kw_static:
1774 casetok::kw_struct:
1775 casetok::kw_switch:
1780 casetok::kw_typeof:
1782 casetok::kw_virtual:
1784 casetok::kw_volatile:
1788 returnTok.is(tok::identifier) &&
1789CSharpExtraKeywords.find(Tok.Tok.getIdentifierInfo()) ==
1790CSharpExtraKeywords.end();
1808 casetok::kw_continue:
1809 casetok::kw_default:
1811 casetok::kw_extern:
1816 casetok::kw_restrict:
1817 casetok::kw_signed:
1818 casetok::kw_static:
1819 casetok::kw_struct:
1820 casetok::kw_typedef:
1822 casetok::kw_unsigned:
1823 casetok::kw_virtual:
1826 casetok::identifier:
1829VerilogExtraKeywords.end();
1840 autoInfo = Tok.Tok.getIdentifierInfo();
1843 switch(Info->getPPKeywordID()) {
1844 casetok::pp_define:
1848 casetok::pp_ifndef:
1849 casetok::pp_include:
1851 casetok::pp_pragma:
1903 returnTok.
is(TT_CaseLabelColon) ||
1904(Tok.
is(tok::kw_default) &&
1918 casetok::kw_extern:
1919 casetok::kw_signed:
1920 casetok::kw_static:
1921 casetok::kw_unsigned:
1922 casetok::kw_virtual:
1924 casetok::identifier:
1952 returnTok.
is(tok::identifier) &&
1954TableGenExtraKeywords.end();
1960std::unordered_set<IdentifierInfo *> JsExtraKeywords;
1963std::unordered_set<IdentifierInfo *> CSharpExtraKeywords;
1966std::unordered_set<IdentifierInfo *> VerilogExtraKeywords;
1969std::unordered_set<IdentifierInfo *> TableGenExtraKeywords;
1973 returnFormatTok.is(tok::comment) && !FormatTok.TokenText.starts_with(
"/*");
1981 constFormatToken *MinColumnToken) {
1984 unsignedMinContinueColumn =
1985MinColumnToken->OriginalColumn + (
isLineComment(*MinColumnToken) ? 0 : 1);
1986 return isLineComment(FormatTok) && FormatTok.NewlinesBefore == 1 &&
1988FormatTok.OriginalColumn >= MinContinueColumn;
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
Various functions to configurably format source code.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines and computes precedence levels for binary/ternary operators.
static constexpr bool isOneOf()
#define TRANSFORM_TYPE_TRAIT_DEF(Enum, _)
ContinuationIndenter * Indenter
One of these records is kept for each identifier that is lexed.
tok::PPKeywordKind getPPKeywordID() const
Return the preprocessor keyword ID for this identifier.
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Encodes a location in the source.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
Token - This structure provides full information about a lexed token.
IdentifierInfo * getIdentifierInfo() const
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)) {....
tok::TokenKind getKind() const
bool isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const
Return true if we have an ObjC keyword identifier.
The base class of the type hierarchy.
unsigned formatFromToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun) override
Apply the special formatting that the given role demands.
void CommaFound(const FormatToken *Token) override
Adds Token as the next comma to the CommaSeparated list.
const FormatToken * lastComma() override
unsigned formatAfterToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun) override
Same as formatFromToken, but assumes that the first token has already been set thereby deciding on th...
void precomputeFormattingInfos(const FormatToken *Token) override
After the TokenAnnotator has finished annotating all the tokens, this function precomputes required i...
virtual unsigned formatAfterToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun)
Same as formatFromToken, but assumes that the first token has already been set thereby deciding on th...
virtual void precomputeFormattingInfos(const FormatToken *Token)
After the TokenAnnotator has finished annotating all the tokens, this function precomputes required i...
const FormatStyle & Style
virtual void CommaFound(const FormatToken *Token)
Notifies the Role that a comma was found.
virtual const FormatToken * lastComma()
virtual unsigned formatFromToken(LineState &State, ContinuationIndenter *Indenter, bool DryRun)
Apply the special formatting that the given role demands.
const char * getTokenTypeName(TokenType Type)
Determines the name of a token type.
MacroRole
Roles a token can take in a configured macro expansion.
@ MR_UnexpandedArg
The token is part of a macro argument that was previously formatted as expansion when formatting the ...
@ MR_Hidden
The token was expanded from a macro definition, and is not visible as part of the macro call.
@ MR_ExpandedArg
The token was expanded from a macro argument when formatting the expanded token sequence.
bool continuesLineComment(const FormatToken &FormatTok, const FormatToken *Previous, const FormatToken *MinColumnToken)
bool isLineComment(const FormatToken &FormatTok)
TokenType
Determines the semantic type of a syntactic token, e.g.
bool startsNextParameter(const FormatToken &Current, const FormatStyle &Style)
bool isStringLiteral(TokenKind K)
Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
PPKeywordKind
Provides a namespace for preprocessor keywords which start with a '#' at the beginning of the line.
The JSON file list parser is used to communicate input to InstallAPI.
prec::Level getBinOpPrecedence(tok::TokenKind Kind, bool GreaterThanIsOperator, bool CPlusPlus11)
Return the precedence of the specified binary operator token.
const FunctionProtoType * T
Encapsulates keywords that are context sensitive or for languages not properly supported by Clang's l...
IdentifierInfo * kw_endchecker
IdentifierInfo * kw_endcelldefine
IdentifierInfo * kw_endtable
IdentifierInfo * kw_decimal
IdentifierInfo * kw_module
IdentifierInfo * kw_randc
bool isVerilogEnd(const FormatToken &Tok) const
Returns whether Tok is a Verilog keyword that closes a block.
IdentifierInfo * kw_undefineall
IdentifierInfo * kw_verilogHashHash
IdentifierInfo * kw_foreach
IdentifierInfo * kw_forever
IdentifierInfo * kw_nounconnected_drive
IdentifierInfo * kw_celldefine
IdentifierInfo * kw_delay_mode_unit
IdentifierInfo * kw_signals
IdentifierInfo * kw_strong0
IdentifierInfo * kw_unsafe
IdentifierInfo * kw_inside
IdentifierInfo * kw_CF_ENUM
IdentifierInfo * kw_ifnone
IdentifierInfo * kw_checked
IdentifierInfo * kw_extend
IdentifierInfo * kw_endmodule
IdentifierInfo * kw_inout
IdentifierInfo * kw_synchronized
IdentifierInfo * kw_sample
IdentifierInfo * kw_object
IdentifierInfo * kw_specparam
IdentifierInfo * kw_randcase
IdentifierInfo * kw_endcase
bool isWordLike(const FormatToken &Tok, bool IsVerilog=true) const
Returns true if Tok is a keyword or an identifier.
IdentifierInfo * kw_native
IdentifierInfo * kw_randsequence
IdentifierInfo * kw_always_ff
IdentifierInfo * kw_always_latch
IdentifierInfo * kw_end_keywords
IdentifierInfo * kw_typeof
IdentifierInfo * kw_endproperty
IdentifierInfo * kw_final
IdentifierInfo * kw_interconnect
IdentifierInfo * kw_trireg
IdentifierInfo * kw_apostrophe
IdentifierInfo * kw_join_any
IdentifierInfo * kw_endgenerate
IdentifierInfo * kw_option
IdentifierInfo * kw_assert
IdentifierInfo * kw_weak0
IdentifierInfo * kw_intersect
IdentifierInfo * kw_uwire
IdentifierInfo * kw_string
bool isVerilogBegin(const FormatToken &Tok) const
Returns whether Tok is a Verilog keyword that opens a block.
IdentifierInfo * kw_before
IdentifierInfo * kw_constraint
bool isJavaScriptIdentifier(const FormatToken &Tok, bool AcceptIdentifierName=true) const
Returns true if Tok is a true JavaScript identifier, returns false if it is a keyword or a pseudo key...
IdentifierInfo * kw_initial
bool isVerilogQualifier(const FormatToken &Tok) const
IdentifierInfo * kw_priority
IdentifierInfo * kw_weak1
IdentifierInfo * kw_supply1
IdentifierInfo * kw_input
IdentifierInfo * kw_medium
IdentifierInfo * kw_qsignals
IdentifierInfo * kw_illegal_bins
IdentifierInfo * kw_cover
IdentifierInfo * kw_assume
IdentifierInfo * kw_default_trireg_strength
bool isVerilogStructuredProcedure(const FormatToken &Tok) const
Returns whether Tok is a Verilog keyword that starts a structured procedure like 'always'.
IdentifierInfo * kw_negedge
IdentifierInfo * kw_endtask
IdentifierInfo * kw_CF_OPTIONS
bool isVerilogEndOfLabel(const FormatToken &Tok) const
IdentifierInfo * kw_defset
IdentifierInfo * kw_unique0
IdentifierInfo * kw_vectored
IdentifierInfo * kw_readonly
IdentifierInfo * kw_interface
IdentifierInfo * kw_include
IdentifierInfo * kw_delay_mode_path
IdentifierInfo * kw_declare
bool isVerilogWordOperator(const FormatToken &Tok) const
IdentifierInfo * kw_NS_ERROR_ENUM
IdentifierInfo * kw_sbyte
IdentifierInfo * kw_yield
IdentifierInfo * kw_checker
IdentifierInfo * kw_delay_mode_distributed
IdentifierInfo * kw_ignore_bins
IdentifierInfo * kw_CF_CLOSED_ENUM
IdentifierInfo * kw_program
IdentifierInfo * kw_endfunction
IdentifierInfo * kw_posedge
IdentifierInfo * kw_implicit
IdentifierInfo * kw_assign
IdentifierInfo * kw_optional
IdentifierInfo * kw_delay_mode_zero
IdentifierInfo * kw_delegate
IdentifierInfo * kw_slots
IdentifierInfo * kw_import
IdentifierInfo * kw_multiclass
IdentifierInfo * kw_large
IdentifierInfo * kw_trior
IdentifierInfo * kw_casex
IdentifierInfo * kw_dollar
bool isTableGenKeyword(const FormatToken &Tok) const
IdentifierInfo * kw_repeat
IdentifierInfo * kw_highz0
IdentifierInfo * kw_ushort
bool isVerilogKeywordSymbol(const FormatToken &Tok) const
IdentifierInfo * kw_where
IdentifierInfo * kw_pull1
IdentifierInfo * kw_automatic
IdentifierInfo * kw_ulong
IdentifierInfo * kw_default_decay_time
IdentifierInfo * kw_small
IdentifierInfo * kw_stackalloc
IdentifierInfo * kw_finally
IdentifierInfo * kw_event
IdentifierInfo * kw_timescale
IdentifierInfo * kw_coverpoint
IdentifierInfo * kw_scalared
IdentifierInfo * kw_strong1
IdentifierInfo * kw_NS_CLOSED_ENUM
IdentifierInfo * kw_supply0
IdentifierInfo * kw_endpackage
IdentifierInfo * kw_triand
IdentifierInfo * kw_join_none
IdentifierInfo * kw_returns
IdentifierInfo * kw_local
IdentifierInfo * kw_resetall
IdentifierInfo * kw_solve
bool isCSharpKeyword(const FormatToken &Tok) const
Returns true if Tok is a C# keyword, returns false if it is a anything else.
IdentifierInfo * kw_region
IdentifierInfo * kw_disable
IdentifierInfo * kw___has_include_next
IdentifierInfo * kw___has_include
bool isVerilogHierarchy(const FormatToken &Tok) const
Returns whether Tok is a Verilog keyword that opens a module, etc.
IdentifierInfo * kw_repeated
IdentifierInfo * kw_binsof
IdentifierInfo * kw_endclass
IdentifierInfo * kw_package
IdentifierInfo * kw_async
IdentifierInfo * kw_pull0
IdentifierInfo * kw_wildcard
IdentifierInfo * kw_required
IdentifierInfo * kw_always_comb
IdentifierInfo * kw_internal
IdentifierInfo * kw_sequence
bool isVerilogPPDirective(const FormatToken &Tok) const
Returns whether Tok is a Verilog preprocessor directive.
IdentifierInfo * kw_primitive
IdentifierInfo * kw_casez
IdentifierInfo * kw_localparam
IdentifierInfo * kw_endinterface
IdentifierInfo * kw_infer
IdentifierInfo * kw_unconnected_drive
IdentifierInfo * kw_throws
IdentifierInfo * kw_begin
IdentifierInfo * kw_NS_ENUM
IdentifierInfo * kw_override
IdentifierInfo * kw___except
IdentifierInfo * kw_endprimitive
IdentifierInfo * kw_endgroup
IdentifierInfo * kw_elsif
IdentifierInfo * kw_table
IdentifierInfo * kw_params
IdentifierInfo * kw_endprogram
IdentifierInfo * kw_parameter
IdentifierInfo * kw_NS_OPTIONS
IdentifierInfo * kw_abstract
IdentifierInfo * kw_fixed
IdentifierInfo * kw_internal_ident_after_define
bool isTableGenDefinition(const FormatToken &Tok) const
IdentifierInfo * kw_await
IdentifierInfo * kw_packed
IdentifierInfo * kw_defvar
IdentifierInfo * kw_implements
IdentifierInfo * kw_always
IdentifierInfo * kw_specify
IdentifierInfo * kw_endclocking
IdentifierInfo * kw_verilogHash
IdentifierInfo * kw_generate
IdentifierInfo * kw_macromodule
IdentifierInfo * kw_covergroup
IdentifierInfo * kw_instanceof
IdentifierInfo * kw_matches
IdentifierInfo * kw_qslots
IdentifierInfo * kw_function
IdentifierInfo * kw_unchecked
bool isVerilogIdentifier(const FormatToken &Tok) const
IdentifierInfo * kw_clocking
IdentifierInfo * kw_unique
IdentifierInfo * kw_endspecify
IdentifierInfo * kw_highz1
IdentifierInfo * kw_extends
IdentifierInfo * kw_begin_keywords
IdentifierInfo * kw_tagged
IdentifierInfo * kw_property
IdentifierInfo * kw_default_nettype
IdentifierInfo * kw_output
IdentifierInfo * kw_endsequence
IdentifierInfo * kw_sealed
The FormatStyle is used to configure the formatting to follow specific guidelines.
A wrapper around a Token storing information about the whitespace characters preceding it.
unsigned NestingLevel
The nesting level of this token, i.e.
unsigned MustBreakBeforeFinalized
Whether MustBreakBefore is finalized during parsing and must not be reset between runs.
bool isMemberAccess() const
Returns true if this is a "." or "->" accessing a member.
unsigned FakeRParens
Insert this many fake ) after this token for correct indentation.
bool ArrayInitializerLineStart
This notes the start of the line of an array initializer.
bool isTypeFinalized() const
bool Optional
Is optional and can be removed.
bool MacroParent
When macro expansion introduces nodes with children, those are marked as MacroParent.
int Newlines
The number of newlines immediately before the Token after formatting.
SmallVector< AnnotatedLine *, 1 > Children
If this token starts a block, this contains all the unwrapped lines in it.
bool closesScopeAfterBlock() const
bool isObjCAtKeyword(tok::ObjCKeywordKind Kind) const
prec::Level ForcedPrecedence
Used to set an operator precedence explicitly.
bool closesBlockOrBlockTypeList(const FormatStyle &Style) const
Same as opensBlockOrBlockTypeList, but for the closing token.
unsigned BindingStrength
The binding strength of a token.
bool isObjCAccessSpecifier() const
const FormatToken * getNamespaceToken() const
Return the actual namespace token, if this token starts a namespace block.
bool isTypeName(const LangOptions &LangOpts) const
unsigned StartsBinaryExpression
true if this token starts a binary expression, i.e.
void setPackingKind(ParameterPackingKind K)
unsigned ClosesTemplateDeclaration
true if this is the ">" of "template<..>".
unsigned OperatorIndex
If this is an operator (or "."/"->") in a sequence of operators with the same precedence,...
bool MightBeFunctionDeclParen
Might be function declaration open/closing paren.
unsigned OriginalColumn
The original 0-based column of this token, including expanded tabs.
unsigned ContinuesLineCommentSection
Does this line comment continue a line comment section?
unsigned CanBreakBefore
true if it is allowed to break before this token.
bool isCppAlternativeOperatorKeyword() const
StringRef TokenText
The raw text of the token.
unsigned LongestObjCSelectorName
If this is the first ObjC selector name in an ObjC method definition or call, this contains the lengt...
ParameterPackingKind getPackingKind() const
SourceLocation getStartOfNonWhitespace() const
Returns actual token start location without leading escaped newlines and whitespace.
bool startsSequence(A K1, Ts... Tokens) const
true if this token starts a sequence with the given tokens in order, following the Next pointers,...
tok::TokenKind ParentBracket
If this is a bracket ("<", "(", "[" or "{"), contains the kind of the surrounding bracket.
unsigned LastNewlineOffset
The offset just past the last ' ' in this token's leading whitespace (relative to WhiteSpaceStart).
unsigned SplitPenalty
Penalty for inserting a line break before this token.
bool opensScope() const
Returns whether Tok is ([{ or an opening < of a template or in protos.
bool isPointerOrReference() const
FormatToken * getNextNonComment() const
Returns the next token ignoring comments.
void setDecision(FormatDecision D)
FormatToken * getPreviousNonComment() const
Returns the previous token ignoring comments.
SmallVector< prec::Level, 4 > FakeLParens
Stores the number of required fake parentheses and the corresponding operator precedence.
unsigned Finalized
If true, this token has been fully formatted (indented and potentially re-formatted inside),...
std::optional< MacroExpansion > MacroCtx
BraceBlockKind getBlockKind() const
FormatToken * Next
The next token in the unwrapped line.
unsigned IsMultiline
Whether the token text contains newlines (escaped or not).
unsigned EndsCppAttributeGroup
true if this token ends a group of C++ attributes.
unsigned NewlinesBefore
The number of newlines immediately before the Token.
void setBlockKind(BraceBlockKind BBK)
bool isIf(bool AllowConstexprMacro=true) const
unsigned SpacesRequiredBefore
The number of spaces that should be inserted before this token.
std::shared_ptr< TokenRole > Role
A token can have a special role that can carry extra information about the token's formatting.
unsigned MustBreakBefore
Whether there must be a line break before this token.
unsigned HasUnescapedNewline
Whether there is at least one unescaped newline before the Token.
unsigned PartOfMultiVariableDeclStmt
Is this token part of a DeclStmt defining multiple variables?
unsigned ColumnWidth
The width of the non-whitespace parts of the token (or its first line for multi-line tokens) in colum...
unsigned ObjCSelectorNameParts
If this is the first ObjC selector name in an ObjC method definition or call, this contains the numbe...
void setType(TokenType T)
bool HasFormFeedBefore
Has "\n\f\n" or "\n\f\r\n" before TokenText.
bool isFunctionLikeKeyword() const
Returns true if this is a keyword that can be used like a function call (e.g.
bool isStringLiteral() const
bool IsArrayInitializer
This starts an array initializer.
bool isBlockIndentedInitRBrace(const FormatStyle &Style) const
Returns true if this token ends a block indented initializer list.
bool closesScope() const
Returns whether Tok is )]} or a closing > of a template or in protos.
unsigned EndsBinaryExpression
true if this token ends a binary expression.
bool isBinaryOperator() const
bool isCppStructuredBinding(bool IsCpp) const
Returns whether the token is the left square bracket of a C++ structured binding declaration.
unsigned UnbreakableTailLength
The length of following tokens until the next natural split point, or the next token that can be brok...
prec::Level getPrecedence() const
FormatDecision getDecision() const
bool is(tok::TokenKind Kind) const
unsigned LastLineColumnWidth
Contains the width in columns of the last line of a multi-line token.
unsigned IndentLevel
The indent level of this token. Copied from the surrounding line.
bool opensBlockOrBlockTypeList(const FormatStyle &Style) const
Returns true if this tokens starts a block-type list, i.e.
unsigned BlockParameterCount
Number of parameters that are nested blocks, if this is "(", "[" or "<".
unsigned TotalLength
The total length of the unwrapped line up to and including this token.
bool hasWhitespaceBefore() const
Returns true if the range of whitespace immediately preceding the Token is not empty.
bool isOneOf(A K1, B K2) const
TokenType getType() const
Returns the token's type, e.g.
unsigned IsFirst
Indicates that this is the first token of the file.
bool isUnaryOperator() const
unsigned IsUnterminatedLiteral
Set to true if this token is an unterminated literal.
bool isTrailingComment() const
unsigned ClosesRequiresClause
true if this is the last token within requires clause.
unsigned ParameterIndex
The 0-based index of the parameter/argument.
int8_t BraceCount
Number of optional braces to be inserted after this token: -1: a single left brace 0: no braces >0: n...
bool isAccessSpecifierKeyword() const
bool canBePointerOrReferenceQualifier() const
unsigned ParameterCount
Number of parameters, if this is "(", "[" or "<".
bool isAccessSpecifier(bool ColonRequired=true) const
bool StartsColumn
The first token in set of column elements.
bool isTypeOrIdentifier(const LangOptions &LangOpts) const
SourceRange WhitespaceRange
The range of the whitespace immediately preceding the Token.
FormatToken * NextOperator
If this is an operator (or "."/"->") in a sequence of operators with the same precedence,...
FormatToken * MatchingParen
If this is a bracket, this points to the matching one.
void copyFrom(const FormatToken &Tok)
void overwriteFixedType(TokenType T)
FormatToken * Previous
The previous token in the unwrapped line.
bool isLabelString() const
Returns true if this is a string literal that's like a label, e.g.
bool endsSequence(A K1, Ts... Tokens) const
true if this token ends a sequence with the given tokens in order, following the Previous pointers,...
void setFinalizedType(TokenType T)
Sets the type and also the finalized flag.
The current state when indenting a unwrapped line.
Contains information on the token's role in a macro expansion.
llvm::SmallVector< FormatToken *, 1 > ExpandedFrom
The stack of macro call identifier tokens this token was expanded from.
unsigned StartOfExpansion
The number of expansions of which this macro is the first entry.
MacroRole Role
The token's role in the macro expansion.
unsigned EndOfExpansion
The number of currently open expansions in ExpandedFrom this macro is the last token in.
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