clang
19.0.0git
|
#include "/home/runner/work/llvm/llvm/repo/clang/lib/Format/BreakableToken.h"
Public Member Functions | |
BreakableLineCommentSection (const FormatToken &Token, unsigned StartColumn, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
unsigned | getRangeLength (unsigned LineIndex, unsigned Offset, StringRef::size_type Length, unsigned StartColumn) const override |
Returns the number of columns required to format the text in the byte range [Offset , Offset + Length ). More... | |
unsigned | getContentStartColumn (unsigned LineIndex, bool Break) const override |
Returns the column at which content in line LineIndex starts, assuming no reflow. More... | |
void | insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, unsigned ContentIndent, WhitespaceManager &Whitespaces) const override |
Emits the previously retrieved Split via Whitespaces . More... | |
Split | getReflowSplit (unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const override |
Returns a whitespace range (offset, length) of the content at LineIndex such that the content of that line is reflown to the end of the previous one. More... | |
void | reflow (unsigned LineIndex, WhitespaceManager &Whitespaces) const override |
Reflows the current line into the end of the previous one. More... | |
void | adaptStartOfLine (unsigned LineIndex, WhitespaceManager &Whitespaces) const override |
Replaces the whitespace between LineIndex-1 and LineIndex . More... | |
void | updateNextToken (LineState &State) const override |
Updates the next token of State to the next token after this one. More... | |
bool | mayReflow (unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const override |
![]() | |
bool | supportsReflow () const override |
Returns whether the token supports reflowing text. More... | |
unsigned | getLineCount () const override |
Returns the number of lines in this token in the original code. More... | |
Split | getSplit (unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit, unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const override |
Returns a range (offset, length) at which to break the line at LineIndex , if previously broken at TailOffset . More... | |
void | compressWhitespace (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) const override |
Replaces the whitespace range described by Split with a single space. More... | |
![]() | |
virtual | ~BreakableToken () |
virtual unsigned | getRemainingLength (unsigned LineIndex, unsigned Offset, unsigned StartColumn) const |
Returns the number of columns required to format the text following the byte Offset in the line LineIndex , including potentially unbreakable sequences of tokens following after the end of the token. More... | |
virtual unsigned | getContentIndent (unsigned LineIndex) const |
Returns additional content indent required for the second line after the content at line LineIndex is broken. More... | |
unsigned | getLengthAfterCompression (unsigned RemainingTokenColumns, Split Split) const |
Returns the number of columns needed to format RemainingTokenColumns , assuming that Split is within the range measured by RemainingTokenColumns , and that the whitespace in Split is reduced to a single space. More... | |
virtual bool | introducesBreakBeforeToken () const |
Returns whether there will be a line break at the start of the token. More... | |
virtual Split | getSplitAfterLastLine (unsigned TailOffset) const |
Returns a whitespace range (offset, length) of the content at the last line that needs to be reformatted after the last line has been reformatted. More... | |
void | replaceWhitespaceAfterLastLine (unsigned TailOffset, Split SplitAfterLastLine, WhitespaceManager &Whitespaces) const |
Replaces the whitespace from SplitAfterLastLine on the last line after the last line has been formatted by performing a reformatting. More... | |
virtual void | updateAfterBroken (WhitespaceManager &Whitespaces) const |
Adds replacements that are needed when the token is broken. More... | |
Definition at line 477 of file BreakableToken.h.
clang::format::BreakableLineCommentSection::BreakableLineCommentSection | ( | const FormatToken & | Token, |
unsigned | StartColumn, | ||
bool | InPPDirective, | ||
encoding::Encoding | Encoding, | ||
const FormatStyle & | Style | ||
) |
Definition at line 863 of file BreakableToken.cpp.
|
overridevirtual |
Replaces the whitespace between LineIndex-1
and LineIndex
.
Reimplemented from clang::format::BreakableToken.
Definition at line 1104 of file BreakableToken.cpp.
|
overridevirtual |
Returns the column at which content in line LineIndex
starts, assuming no reflow.
If Break
is true, returns the column at which the line should start after the line break. If Break
is false, returns the column at which the line itself will start.
Implements clang::format::BreakableToken.
Definition at line 1021 of file BreakableToken.cpp.
References clang::format::BreakableComment::ContentColumn.
|
overridevirtual |
Returns the number of columns required to format the text in the byte range [Offset
, Offset
+
Length
).
Offset
is the byte offset from the start of the content of the line at LineIndex
.
StartColumn
is the column at which the text starts in the formatted file, needed to compute tab stops correctly.
Implements clang::format::BreakableToken.
Definition at line 1012 of file BreakableToken.cpp.
References clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableComment::Content, clang::format::BreakableToken::Encoding, Offset, clang::format::BreakableComment::StartColumn, clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
|
overridevirtual |
Returns a whitespace range (offset, length) of the content at LineIndex
such that the content of that line is reflown to the end of the previous one.
Returning (StringRef::npos, 0) indicates reflowing is not possible.
The range will include any whitespace preceding the specified line's content.
If the split is not contained within one token, for example when reflowing line comments, returns (0, <length>).
Reimplemented from clang::format::BreakableToken.
Definition at line 1041 of file BreakableToken.cpp.
References clang::format::Blanks, clang::format::BreakableComment::Content, and mayReflow().
|
overridevirtual |
Emits the previously retrieved Split
via Whitespaces
.
Implements clang::format::BreakableToken.
Definition at line 1026 of file BreakableToken.cpp.
|
overridevirtual |
Implements clang::format::BreakableComment.
Definition at line 1150 of file BreakableToken.cpp.
References clang::format::BreakableComment::Content, clang::format::FormatToken::Finalized, clang::format::BreakableComment::Lines, clang::format::mayReflowContent(), clang::format::switchesFormatting(), clang::format::BreakableToken::Tok, and clang::format::BreakableComment::tokenAt().
Referenced by getReflowSplit().
|
overridevirtual |
Reflows the current line into the end of the previous one.
Reimplemented from clang::format::BreakableToken.
Definition at line 1055 of file BreakableToken.cpp.
|
overridevirtual |
Updates the next token of State
to the next token after this one.
This can be used when this token manages a set of underlying tokens as a unit and is responsible for the formatting of the them.
Reimplemented from clang::format::BreakableToken.
Definition at line 1145 of file BreakableToken.cpp.
References clang::format::FormatToken::Next, and State.