clang 22.0.0git
clang::TokenRole Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/Format/FormatToken.h"

Inheritance diagram for clang::TokenRole:
[legend]

Public Member Functions

 TokenRole (const FormatStyle &Style)
virtual ~TokenRole ()
virtual void precomputeFormattingInfos (const FormatToken *Token)
 After the TokenAnnotator has finished annotating all the tokens, this function precomputes required information for formatting.
virtual unsigned formatFromToken (LineState &State, ContinuationIndenter *Indenter, bool DryRun)
 Apply the special formatting that the given role demands.
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 the first line break.
virtual void CommaFound (const FormatToken *Token)
 Notifies the Role that a comma was found.
virtual const FormatTokenlastComma ()

Protected Attributes

const FormatStyle & Style

Detailed Description

Definition at line 938 of file FormatToken.h.

Constructor & Destructor Documentation

◆ TokenRole()

clang::TokenRole::TokenRole ( const FormatStyle & Style)
inline

◆ ~TokenRole()

clang::format::TokenRole::~TokenRole ( )
virtual

Definition at line 94 of file FormatToken.cpp.

Member Function Documentation

◆ CommaFound()

virtual void clang::TokenRole::CommaFound ( const FormatToken * Token)
inlinevirtual

Notifies the Role that a comma was found.

Reimplemented in clang::CommaSeparatedList.

Definition at line 968 of file FormatToken.h.

◆ formatAfterToken()

virtual unsigned clang::TokenRole::formatAfterToken ( LineState & State,
ContinuationIndenter * Indenter,
bool DryRun )
inlinevirtual

Same as formatFromToken, but assumes that the first token has already been set thereby deciding on the first line break.

Reimplemented in clang::CommaSeparatedList.

Definition at line 961 of file FormatToken.h.

◆ formatFromToken()

virtual unsigned clang::TokenRole::formatFromToken ( LineState & State,
ContinuationIndenter * Indenter,
bool DryRun )
inlinevirtual

Apply the special formatting that the given role demands.

Assumes that the token having this role is already formatted.

Continues formatting from State leaving indentation to Indenter and returns the total penalty that this formatting incurs.

Reimplemented in clang::CommaSeparatedList.

Definition at line 953 of file FormatToken.h.

References FormatToken(), precomputeFormattingInfos(), and TokenRole().

◆ lastComma()

virtual const FormatToken * clang::TokenRole::lastComma ( )
inlinevirtual

Reimplemented in clang::CommaSeparatedList.

Definition at line 970 of file FormatToken.h.

◆ precomputeFormattingInfos()

void clang::format::TokenRole::precomputeFormattingInfos ( const FormatToken * Token)
virtual

After the TokenAnnotator has finished annotating all the tokens, this function precomputes required information for formatting.

Reimplemented in clang::CommaSeparatedList.

Definition at line 96 of file FormatToken.cpp.

References FormatToken().

Referenced by formatFromToken().

Member Data Documentation

◆ Style

const FormatStyle& clang::TokenRole::Style
protected

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