clang 22.0.0git
clang::format::AnnotatedLine Class Reference

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

Public Member Functions

 AnnotatedLine (const UnwrappedLine &Line)
void addChildren (const UnwrappedLineNode &Node, FormatToken *Current)
size_t size () const
 ~AnnotatedLine ()
bool isComment () const
template<typename... Ts>
bool startsWith (Ts... Tokens) const
 true if this line starts with the given tokens in order, ignoring comments.
template<typename... Ts>
bool endsWith (Ts... Tokens) const
 true if this line ends with the given tokens in reversed order, ignoring comments.
bool mightBeFunctionDefinition () const
 true if this line looks like a function definition instead of a function declaration.
bool startsWithNamespace () const
 true if this line starts a namespace definition.
bool startsWithExportBlock () const
 true if this line starts a C++ export block.
FormatTokengetFirstNonComment () const
FormatTokengetLastNonComment () const

Public Attributes

FormatTokenFirst
FormatTokenLast
SmallVector< AnnotatedLine *, 0 > Children
LineType Type
unsigned Level
unsigned PPLevel
size_t MatchingOpeningBlockLineIndex
size_t MatchingClosingBlockLineIndex
bool InPPDirective
bool InPragmaDirective
bool InMacroBody
bool MustBeDeclaration
bool MightBeFunctionDecl
bool IsMultiVariableDeclStmt
bool ContainsMacroCall = false
 True if this line contains a macro call for which an expansion exists.
bool Computed = false
 True if calculateFormattingInformation() has been called on this line.
bool Affected
 True if this line should be formatted, i.e.
bool LeadingEmptyLinesAffected
 True if the leading empty lines of this line intersect with one of the input ranges.
bool ChildrenAffected
 True if one of this line's children intersects with an input range.
bool ReturnTypeWrapped
 True if breaking after last attribute group in function return type.
bool IsContinuation
 True if this line should be indented by ContinuationIndent in addition to the normal indention level.
unsigned FirstStartColumn

Detailed Description

Definition at line 49 of file TokenAnnotator.h.

Constructor & Destructor Documentation

◆ AnnotatedLine()

◆ ~AnnotatedLine()

clang::format::AnnotatedLine::~AnnotatedLine ( )
inline

Member Function Documentation

◆ addChildren()

void clang::format::AnnotatedLine::addChildren ( const UnwrappedLineNode & Node,
FormatToken * Current )
inline

◆ endsWith()

template<typename... Ts>
bool clang::format::AnnotatedLine::endsWith ( Ts... Tokens) const
inline

true if this line ends with the given tokens in reversed order, ignoring comments.

For example, given tokens [T1, T2, T3, ...], the function returns true if this line is like "... T3 T2 T1".

Definition at line 129 of file TokenAnnotator.h.

References Last.

Referenced by clang::format::computeNewlines(), and mightBeFunctionDefinition().

◆ getFirstNonComment()

FormatToken * clang::format::AnnotatedLine::getFirstNonComment ( ) const
inline

Definition at line 162 of file TokenAnnotator.h.

References First.

◆ getLastNonComment()

FormatToken * clang::format::AnnotatedLine::getLastNonComment ( ) const
inline

Definition at line 167 of file TokenAnnotator.h.

References Last.

◆ isComment()

bool clang::format::AnnotatedLine::isComment ( ) const
inline

Definition at line 115 of file TokenAnnotator.h.

References First.

◆ mightBeFunctionDefinition()

bool clang::format::AnnotatedLine::mightBeFunctionDefinition ( ) const
inline

true if this line looks like a function definition instead of a function declaration.

Asserts MightBeFunctionDecl.

Definition at line 135 of file TokenAnnotator.h.

References endsWith(), and MightBeFunctionDecl.

◆ size()

size_t clang::format::AnnotatedLine::size ( ) const
inline

Definition at line 97 of file TokenAnnotator.h.

References Children.

◆ startsWith()

template<typename... Ts>
bool clang::format::AnnotatedLine::startsWith ( Ts... Tokens) const
inline

true if this line starts with the given tokens in order, ignoring comments.

Definition at line 121 of file TokenAnnotator.h.

References First.

Referenced by clang::format::computeNewlines(), clang::format::UnwrappedLineFormatter::format(), startsWithExportBlock(), and startsWithNamespace().

◆ startsWithExportBlock()

bool clang::format::AnnotatedLine::startsWithExportBlock ( ) const
inline

true if this line starts a C++ export block.

Definition at line 158 of file TokenAnnotator.h.

References startsWith().

◆ startsWithNamespace()

bool clang::format::AnnotatedLine::startsWithNamespace ( ) const
inline

true if this line starts a namespace definition.

Definition at line 151 of file TokenAnnotator.h.

References startsWith().

Referenced by clang::format::computeNewlines().

Member Data Documentation

◆ Affected

bool clang::format::AnnotatedLine::Affected

True if this line should be formatted, i.e.

intersects directly or indirectly with one of the input ranges.

Definition at line 197 of file TokenAnnotator.h.

Referenced by AnnotatedLine(), and clang::format::UnwrappedLineFormatter::format().

◆ Children

SmallVector<AnnotatedLine *, 0> clang::format::AnnotatedLine::Children

Definition at line 175 of file TokenAnnotator.h.

Referenced by addChildren(), size(), and ~AnnotatedLine().

◆ ChildrenAffected

bool clang::format::AnnotatedLine::ChildrenAffected

True if one of this line's children intersects with an input range.

Definition at line 204 of file TokenAnnotator.h.

Referenced by AnnotatedLine(), and clang::format::UnwrappedLineFormatter::format().

◆ Computed

bool clang::format::AnnotatedLine::Computed = false

True if calculateFormattingInformation() has been called on this line.

Definition at line 193 of file TokenAnnotator.h.

◆ ContainsMacroCall

bool clang::format::AnnotatedLine::ContainsMacroCall = false

True if this line contains a macro call for which an expansion exists.

Definition at line 190 of file TokenAnnotator.h.

Referenced by addChildren(), AnnotatedLine(), and clang::format::UnwrappedLineFormatter::format().

◆ First

◆ FirstStartColumn

unsigned clang::format::AnnotatedLine::FirstStartColumn

Definition at line 213 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ InMacroBody

bool clang::format::AnnotatedLine::InMacroBody

Definition at line 184 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ InPPDirective

bool clang::format::AnnotatedLine::InPPDirective

◆ InPragmaDirective

bool clang::format::AnnotatedLine::InPragmaDirective

Definition at line 183 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ IsContinuation

bool clang::format::AnnotatedLine::IsContinuation

True if this line should be indented by ContinuationIndent in addition to the normal indention level.

Definition at line 211 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ IsMultiVariableDeclStmt

bool clang::format::AnnotatedLine::IsMultiVariableDeclStmt

Definition at line 187 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ Last

◆ LeadingEmptyLinesAffected

bool clang::format::AnnotatedLine::LeadingEmptyLinesAffected

True if the leading empty lines of this line intersect with one of the input ranges.

Definition at line 201 of file TokenAnnotator.h.

Referenced by AnnotatedLine(), and clang::format::UnwrappedLineFormatter::format().

◆ Level

◆ MatchingClosingBlockLineIndex

size_t clang::format::AnnotatedLine::MatchingClosingBlockLineIndex

Definition at line 181 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ MatchingOpeningBlockLineIndex

size_t clang::format::AnnotatedLine::MatchingOpeningBlockLineIndex

◆ MightBeFunctionDecl

bool clang::format::AnnotatedLine::MightBeFunctionDecl

Definition at line 186 of file TokenAnnotator.h.

Referenced by AnnotatedLine(), and mightBeFunctionDefinition().

◆ MustBeDeclaration

bool clang::format::AnnotatedLine::MustBeDeclaration

Definition at line 185 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ PPLevel

unsigned clang::format::AnnotatedLine::PPLevel

Definition at line 179 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ ReturnTypeWrapped

bool clang::format::AnnotatedLine::ReturnTypeWrapped

True if breaking after last attribute group in function return type.

Definition at line 207 of file TokenAnnotator.h.

Referenced by AnnotatedLine().

◆ Type


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