clang API Documentation

Public Member Functions | Public Attributes
clang::format::LineState Struct Reference

The current state when indenting a unwrapped line. More...

#include <ContinuationIndenter.h>

Collaboration diagram for clang::format::LineState:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool operator< (const LineState &Other) const
 Comparison operator to be able to used LineState in map.

Public Attributes

unsigned Column
 The number of used columns in the current line.
FormatTokenNextToken
 The token that needs to be next formatted.
bool LineContainsContinuedForLoopSection
 true if this line contains a continued for-loop section.
unsigned StartOfLineLevel
 The NestingLevel at the start of this line.
unsigned LowestLevelOnLine
 The lowest NestingLevel on the current line.
unsigned StartOfStringLiteral
 The start column of the string literal, if we're in a string literal sequence, 0 otherwise.
std::vector< ParenStateStack
 A stack keeping track of properties applying to parenthesis levels.
bool IgnoreStackForComparison
 Ignore the stack of ParenStates for state comparison.
unsigned FirstIndent
 The indent of the first token.
const AnnotatedLineLine
 The line that is being formatted.

Detailed Description

The current state when indenting a unwrapped line.

As the indenting tries different combinations this is copied by value.

Definition at line 305 of file ContinuationIndenter.h.


Member Function Documentation

bool clang::format::LineState::operator< ( const LineState Other) const [inline]

Member Data Documentation

The indent of the first token.

Definition at line 345 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::getInitialState().

Ignore the stack of ParenStates for state comparison.

In long and deeply nested unwrapped lines, the current algorithm can be insufficient for finding the best formatting with a reasonable amount of time and memory. Setting this flag will effectively lead to the algorithm not analyzing some combinations. However, these combinations rarely contain the optimal solution: In short, accepting a higher penalty early would need to lead to different values in the ParenState stack (in an otherwise identical state) and these different values would need to lead to a significant amount of avoided penalty later.

FIXME: Come up with a better algorithm instead.

Definition at line 342 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::getInitialState(), and operator<().

The line that is being formatted.

Does not need to be considered for memoization because it doesn't change.

Definition at line 350 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::getColumnLimit(), and clang::format::ContinuationIndenter::getInitialState().

true if this line contains a continued for-loop section.

Definition at line 313 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::getInitialState(), clang::format::ContinuationIndenter::mustBreak(), and operator<().

The lowest NestingLevel on the current line.

Definition at line 319 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::canBreak(), clang::format::ContinuationIndenter::getInitialState(), and operator<().

The NestingLevel at the start of this line.

Definition at line 316 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::canBreak(), clang::format::ContinuationIndenter::getInitialState(), and operator<().

The start column of the string literal, if we're in a string literal sequence, 0 otherwise.

Definition at line 323 of file ContinuationIndenter.h.

Referenced by clang::format::ContinuationIndenter::getInitialState(), and operator<().


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