clang
8.0.0
|
#include "/work/www-prereleases/8.0.0/rc4/docsbuild/llvm.src/tools/clang/lib/Format/ContinuationIndenter.h"
Public Member Functions | |
ContinuationIndenter (const FormatStyle &Style, const AdditionalKeywords &Keywords, const SourceManager &SourceMgr, WhitespaceManager &Whitespaces, encoding::Encoding Encoding, bool BinPackInconclusiveFunctions) | |
Constructs a ContinuationIndenter to format Line starting in column FirstIndent . More... | |
LineState | getInitialState (unsigned FirstIndent, unsigned FirstStartColumn, const AnnotatedLine *Line, bool DryRun) |
Get the initial state, i.e. More... | |
bool | canBreak (const LineState &State) |
Returns true , if a line break after State is allowed. More... | |
bool | mustBreak (const LineState &State) |
Returns true , if a line break after State is mandatory. More... | |
unsigned | addTokenToState (LineState &State, bool Newline, bool DryRun, unsigned ExtraSpaces=0) |
Appends the next token to State and updates information necessary for indentation. More... | |
unsigned | getColumnLimit (const LineState &State) const |
Get the column limit for this line. More... | |
Definition at line 51 of file ContinuationIndenter.h.
clang::format::ContinuationIndenter::ContinuationIndenter | ( | const FormatStyle & | Style, |
const AdditionalKeywords & | Keywords, | ||
const SourceManager & | SourceMgr, | ||
WhitespaceManager & | Whitespaces, | ||
encoding::Encoding | Encoding, | ||
bool | BinPackInconclusiveFunctions | ||
) |
Constructs a ContinuationIndenter
to format Line
starting in column FirstIndent
.
Definition at line 225 of file ContinuationIndenter.cpp.
unsigned clang::format::ContinuationIndenter::addTokenToState | ( | LineState & | State, |
bool | Newline, | ||
bool | DryRun, | ||
unsigned | ExtraSpaces = 0 |
||
) |
Appends the next token to State
and updates information necessary for indentation.
Puts the token on the current line if Newline
is false
and adds a line break and necessary indentation otherwise.
If DryRun
is false
, also creates and stores the required Replacement
.
Definition at line 504 of file ContinuationIndenter.cpp.
Referenced by clang::format::CommaSeparatedList::formatAfterToken().
Returns true
, if a line break after State
is allowed.
Definition at line 278 of file ContinuationIndenter.cpp.
Referenced by clang::format::getEnclosingFunctionName().
unsigned clang::format::ContinuationIndenter::getColumnLimit | ( | const LineState & | State | ) | const |
Get the column limit for this line.
This is the style's column limit, potentially reduced for preprocessor definitions.
Definition at line 2164 of file ContinuationIndenter.cpp.
References clang::format::FormatStyle::BreakStringLiterals, clang::format::LineState::Column, clang::format::FormatStyle::ColumnLimit, clang::format::FormatToken::ColumnWidth, clang::format::FormatToken::getNextNonComment(), clang::format::AnnotatedLine::InPPDirective, clang::format::FormatToken::is(), clang::format::FormatToken::IsMultiline, clang::format::FormatToken::isStringLiteral(), clang::format::LineState::Line, clang::format::LineState::NextToken, clang::format::FormatToken::TokenText, and clang::format::FormatToken::UnbreakableTailLength.
Referenced by clang::format::getEnclosingFunctionName().
LineState clang::format::ContinuationIndenter::getInitialState | ( | unsigned | FirstIndent, |
unsigned | FirstStartColumn, | ||
const AnnotatedLine * | Line, | ||
bool | DryRun | ||
) |
Get the initial state, i.e.
the state after placing Line's
first token at FirstIndent
. When reformatting a fragment of code, as in the case of formatting inside raw string literals, FirstStartColumn
is the column at which the state of the parent formatter is.
Definition at line 236 of file ContinuationIndenter.cpp.
References clang::format::LineState::Column, clang::format::AnnotatedLine::First, clang::format::LineState::FirstIndent, clang::format::LineState::IgnoreStackForComparison, clang::format::FormatStyle::IndentPPDirectives, clang::format::FormatStyle::Language, Line, clang::format::LineState::Line, clang::format::LineState::LineContainsContinuedForLoopSection, clang::format::FormatStyle::LK_TextProto, clang::format::LineState::LowestLevelOnLine, clang::format::LT_ImportStatement, clang::format::LT_PreprocessorDirective, clang::format::FormatToken::NewlinesBefore, clang::format::LineState::NextToken, clang::format::LineState::NoContinuation, clang::format::FormatStyle::PPDIS_AfterHash, clang::format::LineState::Stack, clang::format::LineState::StartOfLineLevel, clang::format::LineState::StartOfStringLiteral, State, and clang::format::AnnotatedLine::Type.
Returns true
, if a line break after State
is mandatory.
Definition at line 330 of file ContinuationIndenter.cpp.