clang 20.0.0git
Public Member Functions | Public Attributes | List of all members
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.
 
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 47 of file TokenAnnotator.h.

Constructor & Destructor Documentation

◆ AnnotatedLine()

clang::format::AnnotatedLine::AnnotatedLine ( const UnwrappedLine Line)
inline

◆ ~AnnotatedLine()

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

Definition at line 102 of file TokenAnnotator.h.

References Children, and First.

Member Function Documentation

◆ addChildren()

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

Definition at line 85 of file TokenAnnotator.h.

References Children, ContainsMacroCall, and Node.

Referenced by AnnotatedLine().

◆ 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 127 of file TokenAnnotator.h.

References clang::format::FormatToken::endsSequence(), and Last.

Referenced by mightBeFunctionDefinition().

◆ getFirstNonComment()

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

◆ getLastNonComment()

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

◆ isComment()

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

◆ 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 133 of file TokenAnnotator.h.

References endsWith(), and MightBeFunctionDecl.

◆ size()

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

Definition at line 95 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 119 of file TokenAnnotator.h.

References First, and clang::format::FormatToken::startsSequence().

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

◆ startsWithNamespace()

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

true if this line starts a namespace definition.

Definition at line 149 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 190 of file TokenAnnotator.h.

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

◆ Children

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

Definition at line 168 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 197 of file TokenAnnotator.h.

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

◆ Computed

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

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

Definition at line 186 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 183 of file TokenAnnotator.h.

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

◆ First

FormatToken* clang::format::AnnotatedLine::First

◆ FirstStartColumn

unsigned clang::format::AnnotatedLine::FirstStartColumn

Definition at line 206 of file TokenAnnotator.h.

◆ InMacroBody

bool clang::format::AnnotatedLine::InMacroBody

Definition at line 177 of file TokenAnnotator.h.

◆ InPPDirective

bool clang::format::AnnotatedLine::InPPDirective

◆ InPragmaDirective

bool clang::format::AnnotatedLine::InPragmaDirective

Definition at line 176 of file TokenAnnotator.h.

◆ 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 204 of file TokenAnnotator.h.

◆ IsMultiVariableDeclStmt

bool clang::format::AnnotatedLine::IsMultiVariableDeclStmt

Definition at line 180 of file TokenAnnotator.h.

◆ Last

FormatToken* clang::format::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 194 of file TokenAnnotator.h.

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

◆ Level

unsigned clang::format::AnnotatedLine::Level

◆ MatchingClosingBlockLineIndex

size_t clang::format::AnnotatedLine::MatchingClosingBlockLineIndex

Definition at line 174 of file TokenAnnotator.h.

◆ MatchingOpeningBlockLineIndex

size_t clang::format::AnnotatedLine::MatchingOpeningBlockLineIndex

Definition at line 173 of file TokenAnnotator.h.

Referenced by clang::format::NamespaceEndCommentsFixer::analyze().

◆ MightBeFunctionDecl

bool clang::format::AnnotatedLine::MightBeFunctionDecl

Definition at line 179 of file TokenAnnotator.h.

Referenced by mightBeFunctionDefinition().

◆ MustBeDeclaration

bool clang::format::AnnotatedLine::MustBeDeclaration

Definition at line 178 of file TokenAnnotator.h.

◆ PPLevel

unsigned clang::format::AnnotatedLine::PPLevel

Definition at line 172 of file TokenAnnotator.h.

◆ ReturnTypeWrapped

bool clang::format::AnnotatedLine::ReturnTypeWrapped

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

Definition at line 200 of file TokenAnnotator.h.

◆ Type

LineType clang::format::AnnotatedLine::Type

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