|
clang
5.0.0
|
Public Member Functions | |
| 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, 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) override |
Replaces the whitespace range described by Split with a single space. More... | |
Public Member Functions inherited from clang::format::BreakableToken | |
| virtual | ~BreakableToken () |
| virtual unsigned | getLineLengthAfterSplit (unsigned LineIndex, unsigned TailOffset, StringRef::size_type Length) const =0 |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset with length Length. More... | |
| virtual void | insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces)=0 |
Emits the previously retrieved Split via Whitespaces. More... | |
| unsigned | getLineLengthAfterCompression (unsigned RemainingTokenColumns, Split Split) const |
Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset after the whitespace range Split has been compressed into a single space. More... | |
| virtual Split | getSplitBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, llvm::Regex &CommentPragmasRegex) const |
Returns a whitespace range (offset, length) of the content at LineIndex such that the content preceding this range needs to be reformatted before any breaks are made to this line. More... | |
| virtual unsigned | getLineLengthAfterSplitBefore (unsigned LineIndex, unsigned TailOffset, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore) const |
Returns the number of columns required to format the piece of line at LineIndex after the content preceding the whitespace range specified SplitBefore has been reformatted, but before any breaks are made to this line. More... | |
| virtual void | replaceWhitespaceBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore, WhitespaceManager &Whitespaces) |
Replaces the whitespace between LineIndex-1 and LineIndex. More... | |
| virtual void | updateNextToken (LineState &State) const |
Updates the next token of State to the next token after this one. More... | |
Protected Member Functions | |
| BreakableComment (const FormatToken &Token, unsigned StartColumn, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
| Creates a breakable token for a comment. More... | |
| virtual unsigned | getContentStartColumn (unsigned LineIndex, unsigned TailOffset) const =0 |
| Split | getReflowSplit (StringRef Text, StringRef ReflowPrefix, unsigned PreviousEndColumn, unsigned ColumnLimit) const |
| const FormatToken & | tokenAt (unsigned LineIndex) const |
| virtual bool | mayReflow (unsigned LineIndex, llvm::Regex &CommentPragmasRegex) const =0 |
Protected Member Functions inherited from clang::format::BreakableToken | |
| BreakableToken (const FormatToken &Tok, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style) | |
Protected Attributes | |
| SmallVector< StringRef, 16 > | Lines |
| SmallVector< StringRef, 16 > | Content |
| SmallVector< FormatToken *, 16 > | Tokens |
| SmallVector< int, 16 > | ContentColumn |
| unsigned | StartColumn |
| StringRef | ReflowPrefix = " " |
Protected Attributes inherited from clang::format::BreakableToken | |
| const FormatToken & | Tok |
| const bool | InPPDirective |
| const encoding::Encoding | Encoding |
| const FormatStyle & | Style |
Additional Inherited Members | |
Public Types inherited from clang::format::BreakableToken | |
| typedef std::pair < StringRef::size_type, unsigned > | Split |
| Contains starting character index and length of split. More... | |
Definition at line 208 of file BreakableToken.h.
|
protected |
Creates a breakable token for a comment.
StartColumn specifies the column in which the comment will start after formatting.
Definition at line 227 of file BreakableToken.cpp.
|
overridevirtual |
Replaces the whitespace range described by Split with a single space.
Implements clang::format::BreakableToken.
Definition at line 249 of file BreakableToken.cpp.
References Content, clang::format::WhitespaceManager::replaceWhitespaceInToken(), Text, tokenAt(), and clang::format::FormatToken::TokenText.
|
protectedpure virtual |
Referenced by getSplit().
|
overridevirtual |
Returns the number of lines in this token in the original code.
Implements clang::format::BreakableToken.
Definition at line 235 of file BreakableToken.cpp.
References Lines.
|
protected |
Definition at line 266 of file BreakableToken.cpp.
References clang::format::Blanks, clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableToken::Encoding, clang::format::getCommentSplit(), clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
Referenced by clang::format::BreakableBlockComment::getSplitBefore(), and clang::format::BreakableLineCommentSection::getSplitBefore().
|
overridevirtual |
Returns a range (offset, length) at which to break the line at LineIndex, if previously broken at TailOffset.
If possible, do not violate ColumnLimit.
Implements clang::format::BreakableToken.
Definition at line 238 of file BreakableToken.cpp.
References Content, clang::format::BreakableToken::Encoding, clang::format::getCommentSplit(), getContentStartColumn(), clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.
|
protectedpure virtual |
Implemented in clang::format::BreakableLineCommentSection, and clang::format::BreakableBlockComment.
|
protected |
Definition at line 303 of file BreakableToken.cpp.
References clang::format::BreakableToken::Tok, and Tokens.
Referenced by compressWhitespace(), clang::format::BreakableBlockComment::insertBreak(), clang::format::BreakableLineCommentSection::insertBreak(), clang::format::BreakableBlockComment::mayReflow(), clang::format::BreakableLineCommentSection::mayReflow(), clang::format::BreakableBlockComment::replaceWhitespaceBefore(), and clang::format::BreakableLineCommentSection::replaceWhitespaceBefore().
|
protected |
Definition at line 252 of file BreakableToken.h.
Referenced by clang::format::BreakableBlockComment::BreakableBlockComment(), compressWhitespace(), clang::format::BreakableBlockComment::getLineLengthAfterSplit(), getSplit(), clang::format::BreakableBlockComment::getSplitBefore(), and clang::format::BreakableBlockComment::insertBreak().
|
protected |
Definition at line 269 of file BreakableToken.h.
Referenced by clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), clang::format::BreakableLineCommentSection::getLineLengthAfterSplit(), clang::format::BreakableBlockComment::replaceWhitespaceBefore(), and clang::format::BreakableLineCommentSection::replaceWhitespaceBefore().
|
protected |
Definition at line 247 of file BreakableToken.h.
Referenced by clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), getLineCount(), clang::format::BreakableBlockComment::getLineLengthAfterSplit(), clang::format::BreakableBlockComment::insertBreak(), clang::format::BreakableBlockComment::mayReflow(), clang::format::BreakableLineCommentSection::mayReflow(), clang::format::BreakableBlockComment::replaceWhitespaceBefore(), and clang::format::BreakableLineCommentSection::replaceWhitespaceBefore().
|
protected |
Definition at line 282 of file BreakableToken.h.
Referenced by clang::format::BreakableLineCommentSection::getLineLengthAfterSplitBefore(), clang::format::BreakableBlockComment::getSplitBefore(), clang::format::BreakableLineCommentSection::getSplitBefore(), clang::format::BreakableBlockComment::replaceWhitespaceBefore(), and clang::format::BreakableLineCommentSection::replaceWhitespaceBefore().
|
protected |
Definition at line 272 of file BreakableToken.h.
Referenced by clang::format::BreakableBlockComment::BreakableBlockComment().
|
protected |
Definition at line 257 of file BreakableToken.h.
Referenced by clang::format::BreakableBlockComment::BreakableBlockComment(), clang::format::BreakableLineCommentSection::BreakableLineCommentSection(), clang::format::BreakableBlockComment::replaceWhitespaceBefore(), clang::format::BreakableLineCommentSection::replaceWhitespaceBefore(), and tokenAt().
1.8.6