clang  5.0.0
Public Member Functions | List of all members
clang::format::BreakableBlockComment Class Reference

#include "/usr/local/google/work/llvm-www-releases/5.0.0/docsbuild/llvm.src/tools/clang/lib/Format/BreakableToken.h"

Inheritance diagram for clang::format::BreakableBlockComment:
[legend]
Collaboration diagram for clang::format::BreakableBlockComment:
[legend]

Public Member Functions

 BreakableBlockComment (const FormatToken &Token, unsigned StartColumn, unsigned OriginalStartColumn, bool FirstInLine, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style)
 
unsigned getLineLengthAfterSplit (unsigned LineIndex, unsigned TailOffset, StringRef::size_type Length) const override
 Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset with length Length. More...
 
void insertBreak (unsigned LineIndex, unsigned TailOffset, Split Split, WhitespaceManager &Whitespaces) override
 Emits the previously retrieved Split via Whitespaces. More...
 
Split getSplitBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, llvm::Regex &CommentPragmasRegex) const override
 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...
 
unsigned getLineLengthAfterSplitBefore (unsigned LineIndex, unsigned TailOffset, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore) const override
 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...
 
void replaceWhitespaceBefore (unsigned LineIndex, unsigned PreviousEndColumn, unsigned ColumnLimit, Split SplitBefore, WhitespaceManager &Whitespaces) override
 Replaces the whitespace between LineIndex-1 and LineIndex. More...
 
bool mayReflow (unsigned LineIndex, llvm::Regex &CommentPragmasRegex) const override
 
- Public Member Functions inherited from clang::format::BreakableComment
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 ()
 
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 void updateNextToken (LineState &State) const
 Updates the next token of State to the next token after this one. More...
 

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...
 
- Protected Member Functions inherited from clang::format::BreakableComment
 BreakableComment (const FormatToken &Token, unsigned StartColumn, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style)
 Creates a breakable token for a comment. More...
 
Split getReflowSplit (StringRef Text, StringRef ReflowPrefix, unsigned PreviousEndColumn, unsigned ColumnLimit) const
 
const FormatTokentokenAt (unsigned LineIndex) const
 
- Protected Member Functions inherited from clang::format::BreakableToken
 BreakableToken (const FormatToken &Tok, bool InPPDirective, encoding::Encoding Encoding, const FormatStyle &Style)
 
- Protected Attributes inherited from clang::format::BreakableComment
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 FormatTokenTok
 
const bool InPPDirective
 
const encoding::Encoding Encoding
 
const FormatStyleStyle
 

Detailed Description

Definition at line 285 of file BreakableToken.h.

Constructor & Destructor Documentation

clang::format::BreakableBlockComment::BreakableBlockComment ( const FormatToken Token,
unsigned  StartColumn,
unsigned  OriginalStartColumn,
bool  FirstInLine,
bool  InPPDirective,
encoding::Encoding  Encoding,
const FormatStyle Style 
)

Member Function Documentation

unsigned clang::format::BreakableBlockComment::getLineLengthAfterSplit ( unsigned  LineIndex,
unsigned  TailOffset,
StringRef::size_type  Length 
) const
overridevirtual

Returns the number of columns required to format the piece of line at LineIndex, from byte offset TailOffset with length Length.

Note that previous breaks are not taken into account. TailOffset is always specified from the start of the (original) line. Length can be set to StringRef::npos, which means "to the end of line".

Implements clang::format::BreakableToken.

Definition at line 480 of file BreakableToken.cpp.

References clang::format::encoding::columnWidthWithTabs(), clang::format::BreakableComment::Content, clang::format::BreakableToken::Encoding, clang::format::BreakableComment::Lines, clang::format::BreakableToken::Style, and clang::format::FormatStyle::TabWidth.

Referenced by getLineLengthAfterSplitBefore().

unsigned clang::format::BreakableBlockComment::getLineLengthAfterSplitBefore ( unsigned  LineIndex,
unsigned  TailOffset,
unsigned  PreviousEndColumn,
unsigned  ColumnLimit,
Split  SplitBefore 
) const
overridevirtual

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.

Reimplemented from clang::format::BreakableToken.

Definition at line 557 of file BreakableToken.cpp.

References clang::format::Blanks, and getLineLengthAfterSplit().

BreakableToken::Split clang::format::BreakableBlockComment::getSplitBefore ( unsigned  LineIndex,
unsigned  PreviousEndColumn,
unsigned  ColumnLimit,
llvm::Regex &  CommentPragmasRegex 
) const
overridevirtual

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.

PreviousEndColumn is the end column of the previous line after formatting.

A result having offset == StringRef::npos means that no piece of the line needs to be reformatted before any breaks are made.

Reimplemented from clang::format::BreakableToken.

Definition at line 529 of file BreakableToken.cpp.

References clang::format::Blanks, clang::format::BreakableComment::Content, clang::format::BreakableComment::getReflowSplit(), mayReflow(), and clang::format::BreakableComment::ReflowPrefix.

void clang::format::BreakableBlockComment::insertBreak ( unsigned  LineIndex,
unsigned  TailOffset,
Split  Split,
WhitespaceManager Whitespaces 
)
overridevirtual
bool clang::format::BreakableBlockComment::mayReflow ( unsigned  LineIndex,
llvm::Regex &  CommentPragmasRegex 
) const
overridevirtual
void clang::format::BreakableBlockComment::replaceWhitespaceBefore ( unsigned  LineIndex,
unsigned  PreviousEndColumn,
unsigned  ColumnLimit,
Split  SplitBefore,
WhitespaceManager Whitespaces 
)
overridevirtual

The documentation for this class was generated from the following files: