clang 19.0.0git
Public Member Functions | Public Attributes | List of all members
clang::format::ParenState Struct Reference

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

Public Member Functions

 ParenState (const FormatToken *Tok, unsigned Indent, unsigned LastSpace, bool AvoidBinPacking, bool NoLineBreak)
 
bool operator< (const ParenState &Other) const
 

Public Attributes

const FormatTokenTok
 The token opening this parenthesis level, or nullptr if this level is opened by fake parenthesis.
 
unsigned Indent
 The position to which a specific parenthesis level needs to be indented.
 
unsigned LastSpace
 The position of the last space on each level.
 
unsigned NestedBlockIndent
 If a block relative to this parenthesis level gets wrapped, indent it this much.
 
unsigned FirstLessLess = 0
 The position the first "<<" operator encountered on each level.
 
unsigned QuestionColumn = 0
 The column of a ? in a conditional expression;.
 
unsigned ColonPos = 0
 The position of the colon in an ObjC method declaration/call.
 
unsigned StartOfFunctionCall = 0
 The start of the most recent function in a builder-type call.
 
unsigned StartOfArraySubscripts = 0
 Contains the start of array subscript expressions, so that they can be aligned.
 
unsigned NestedNameSpecifierContinuation = 0
 If a nested name specifier was broken over multiple lines, this contains the start column of the second line.
 
unsigned CallContinuation = 0
 If a call expression was broken over multiple lines, this contains the start column of the second line.
 
unsigned VariablePos = 0
 The column of the first variable name in a variable declaration.
 
bool IsAligned: 1
 Whether this block's indentation is used for alignment.
 
bool BreakBeforeClosingBrace: 1
 Whether a newline needs to be inserted before the block's closing brace.
 
bool BreakBeforeClosingParen: 1
 Whether a newline needs to be inserted before the block's closing paren.
 
bool AvoidBinPacking: 1
 Avoid bin packing, i.e.
 
bool BreakBeforeParameter: 1
 Break after the next comma (or all the commas in this context if AvoidBinPacking is true).
 
bool NoLineBreak: 1
 Line breaking in this context would break a formatting rule.
 
bool NoLineBreakInOperand: 1
 Same as NoLineBreak, but is restricted until the end of the operand (including the next ",").
 
bool LastOperatorWrapped: 1
 True if the last binary operator on this level was wrapped to the next line.
 
bool ContainsLineBreak: 1
 true if this ParenState already contains a line-break.
 
bool ContainsUnwrappedBuilder: 1
 true if this ParenState contains multiple segments of a builder-type call on one line.
 
bool AlignColons: 1
 true if the colons of the curren ObjC method expression should be aligned.
 
bool ObjCSelectorNameFound: 1
 true if at least one selector name was found in the current ObjC method expression.
 
bool HasMultipleNestedBlocks: 1
 true if there are multiple nested blocks inside these parens.
 
bool NestedBlockInlined: 1
 The start of a nested block (e.g.
 
bool IsInsideObjCArrayLiteral: 1
 true if the current ParenState represents an Objective-C array literal.
 
bool IsCSharpGenericTypeConstraint: 1
 
bool IsChainedConditional: 1
 true if the current ParenState represents the false branch of a chained conditional expression (e.g.
 
bool IsWrappedConditional: 1
 true if there conditionnal was wrapped on the first operator (the question mark)
 
bool UnindentOperator: 1
 Indicates the indent should be reduced by the length of the operator.
 

Detailed Description

Definition at line 197 of file ContinuationIndenter.h.

Constructor & Destructor Documentation

◆ ParenState()

clang::format::ParenState::ParenState ( const FormatToken Tok,
unsigned  Indent,
unsigned  LastSpace,
bool  AvoidBinPacking,
bool  NoLineBreak 
)
inline

Definition at line 198 of file ContinuationIndenter.h.

Member Function Documentation

◆ operator<()

bool clang::format::ParenState::operator< ( const ParenState Other) const
inline

Member Data Documentation

◆ AlignColons

bool clang::format::ParenState::AlignColons

true if the colons of the curren ObjC method expression should be aligned.

Not considered for memoization as it will always have the same value at the same token.

Definition at line 318 of file ContinuationIndenter.h.

◆ AvoidBinPacking

bool clang::format::ParenState::AvoidBinPacking

Avoid bin packing, i.e.

multiple parameters/elements on multiple lines, in this context.

Definition at line 285 of file ContinuationIndenter.h.

Referenced by operator<().

◆ BreakBeforeClosingBrace

bool clang::format::ParenState::BreakBeforeClosingBrace

Whether a newline needs to be inserted before the block's closing brace.

We only want to insert a newline before the closing brace if there also was a newline after the beginning left brace.

Definition at line 274 of file ContinuationIndenter.h.

Referenced by operator<().

◆ BreakBeforeClosingParen

bool clang::format::ParenState::BreakBeforeClosingParen

Whether a newline needs to be inserted before the block's closing paren.

We only want to insert a newline before the closing paren if there also was a newline after the beginning left paren.

Definition at line 281 of file ContinuationIndenter.h.

Referenced by operator<().

◆ BreakBeforeParameter

bool clang::format::ParenState::BreakBeforeParameter

Break after the next comma (or all the commas in this context if AvoidBinPacking is true).

Definition at line 289 of file ContinuationIndenter.h.

Referenced by operator<().

◆ CallContinuation

unsigned clang::format::ParenState::CallContinuation = 0

If a call expression was broken over multiple lines, this contains the start column of the second line.

Otherwise 0.

Definition at line 259 of file ContinuationIndenter.h.

Referenced by operator<().

◆ ColonPos

unsigned clang::format::ParenState::ColonPos = 0

The position of the colon in an ObjC method declaration/call.

Definition at line 244 of file ContinuationIndenter.h.

Referenced by operator<().

◆ ContainsLineBreak

bool clang::format::ParenState::ContainsLineBreak

true if this ParenState already contains a line-break.

The first line break in a certain ParenState causes extra penalty so that clang-format prefers similar breaks, i.e. breaks in the same parenthesis.

Definition at line 307 of file ContinuationIndenter.h.

Referenced by operator<().

◆ ContainsUnwrappedBuilder

bool clang::format::ParenState::ContainsUnwrappedBuilder

true if this ParenState contains multiple segments of a builder-type call on one line.

Definition at line 311 of file ContinuationIndenter.h.

Referenced by operator<().

◆ FirstLessLess

unsigned clang::format::ParenState::FirstLessLess = 0

The position the first "<<" operator encountered on each level.

Used to align "<<" operators. 0 if no such operator has been encountered on a level.

Definition at line 238 of file ContinuationIndenter.h.

Referenced by operator<().

◆ HasMultipleNestedBlocks

bool clang::format::ParenState::HasMultipleNestedBlocks

true if there are multiple nested blocks inside these parens.

Not considered for memoization as it will always have the same value at the same token.

Definition at line 331 of file ContinuationIndenter.h.

◆ Indent

unsigned clang::format::ParenState::Indent

The position to which a specific parenthesis level needs to be indented.

Definition at line 221 of file ContinuationIndenter.h.

Referenced by operator<().

◆ IsAligned

bool clang::format::ParenState::IsAligned

Whether this block's indentation is used for alignment.

Definition at line 267 of file ContinuationIndenter.h.

Referenced by operator<().

◆ IsChainedConditional

bool clang::format::ParenState::IsChainedConditional

true if the current ParenState represents the false branch of a chained conditional expression (e.g.

else-if)

Definition at line 345 of file ContinuationIndenter.h.

Referenced by operator<().

◆ IsCSharpGenericTypeConstraint

bool clang::format::ParenState::IsCSharpGenericTypeConstraint

Definition at line 341 of file ContinuationIndenter.h.

Referenced by operator<().

◆ IsInsideObjCArrayLiteral

bool clang::format::ParenState::IsInsideObjCArrayLiteral

true if the current ParenState represents an Objective-C array literal.

Definition at line 339 of file ContinuationIndenter.h.

◆ IsWrappedConditional

bool clang::format::ParenState::IsWrappedConditional

true if there conditionnal was wrapped on the first operator (the question mark)

Definition at line 349 of file ContinuationIndenter.h.

Referenced by operator<().

◆ LastOperatorWrapped

bool clang::format::ParenState::LastOperatorWrapped

True if the last binary operator on this level was wrapped to the next line.

Definition at line 300 of file ContinuationIndenter.h.

Referenced by operator<().

◆ LastSpace

unsigned clang::format::ParenState::LastSpace

The position of the last space on each level.

Used e.g. to break like: functionCall(Parameter, otherCall( OtherParameter));

Definition at line 228 of file ContinuationIndenter.h.

Referenced by operator<().

◆ NestedBlockIndent

unsigned clang::format::ParenState::NestedBlockIndent

If a block relative to this parenthesis level gets wrapped, indent it this much.

Definition at line 232 of file ContinuationIndenter.h.

Referenced by operator<().

◆ NestedBlockInlined

bool clang::format::ParenState::NestedBlockInlined

The start of a nested block (e.g.

lambda introducer in C++ or "function" in JavaScript) is not wrapped to a new line.

Definition at line 335 of file ContinuationIndenter.h.

Referenced by operator<().

◆ NestedNameSpecifierContinuation

unsigned clang::format::ParenState::NestedNameSpecifierContinuation = 0

If a nested name specifier was broken over multiple lines, this contains the start column of the second line.

Otherwise 0.

Definition at line 255 of file ContinuationIndenter.h.

◆ NoLineBreak

bool clang::format::ParenState::NoLineBreak

Line breaking in this context would break a formatting rule.

Definition at line 292 of file ContinuationIndenter.h.

Referenced by operator<().

◆ NoLineBreakInOperand

bool clang::format::ParenState::NoLineBreakInOperand

Same as NoLineBreak, but is restricted until the end of the operand (including the next ",").

Definition at line 296 of file ContinuationIndenter.h.

◆ ObjCSelectorNameFound

bool clang::format::ParenState::ObjCSelectorNameFound

true if at least one selector name was found in the current ObjC method expression.

Not considered for memoization as it will always have the same value at the same token.

Definition at line 325 of file ContinuationIndenter.h.

◆ QuestionColumn

unsigned clang::format::ParenState::QuestionColumn = 0

The column of a ? in a conditional expression;.

Definition at line 241 of file ContinuationIndenter.h.

Referenced by operator<().

◆ StartOfArraySubscripts

unsigned clang::format::ParenState::StartOfArraySubscripts = 0

Contains the start of array subscript expressions, so that they can be aligned.

Definition at line 251 of file ContinuationIndenter.h.

Referenced by operator<().

◆ StartOfFunctionCall

unsigned clang::format::ParenState::StartOfFunctionCall = 0

The start of the most recent function in a builder-type call.

Definition at line 247 of file ContinuationIndenter.h.

Referenced by operator<().

◆ Tok

const FormatToken* clang::format::ParenState::Tok

The token opening this parenthesis level, or nullptr if this level is opened by fake parenthesis.

Not considered for memoization as it will always have the same value at the same token.

Definition at line 217 of file ContinuationIndenter.h.

◆ UnindentOperator

bool clang::format::ParenState::UnindentOperator

Indicates the indent should be reduced by the length of the operator.

Definition at line 353 of file ContinuationIndenter.h.

Referenced by operator<().

◆ VariablePos

unsigned clang::format::ParenState::VariablePos = 0

The column of the first variable name in a variable declaration.

Used to align further variables if necessary.

Definition at line 264 of file ContinuationIndenter.h.

Referenced by operator<().


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