#include "BreakableToken.h"
#include "ContinuationIndenter.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Format/Format.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
#define DEBUG_TYPE …
namespace clang {
namespace format {
static constexpr StringRef Blanks = …;
static bool IsBlank(char C) { … }
static StringRef getLineCommentIndentPrefix(StringRef Comment,
const FormatStyle &Style) { … }
static BreakableToken::Split
getCommentSplit(StringRef Text, unsigned ContentStartColumn,
unsigned ColumnLimit, unsigned TabWidth,
encoding::Encoding Encoding, const FormatStyle &Style,
bool DecorationEndsWithStar = false) { … }
static BreakableToken::Split
getStringSplit(StringRef Text, unsigned UsedColumns, unsigned ColumnLimit,
unsigned TabWidth, encoding::Encoding Encoding) { … }
bool switchesFormatting(const FormatToken &Token) { … }
unsigned
BreakableToken::getLengthAfterCompression(unsigned RemainingTokenColumns,
Split Split) const { … }
unsigned BreakableStringLiteral::getLineCount() const { … }
unsigned BreakableStringLiteral::getRangeLength(unsigned LineIndex,
unsigned Offset,
StringRef::size_type Length,
unsigned StartColumn) const { … }
unsigned
BreakableStringLiteral::getRemainingLength(unsigned LineIndex, unsigned Offset,
unsigned StartColumn) const { … }
unsigned BreakableStringLiteral::getContentStartColumn(unsigned LineIndex,
bool Break) const { … }
BreakableStringLiteral::BreakableStringLiteral(
const FormatToken &Tok, unsigned StartColumn, StringRef Prefix,
StringRef Postfix, unsigned UnbreakableTailLength, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style)
: … { … }
BreakableToken::Split BreakableStringLiteral::getSplit(
unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const { … }
void BreakableStringLiteral::insertBreak(unsigned LineIndex,
unsigned TailOffset, Split Split,
unsigned ContentIndent,
WhitespaceManager &Whitespaces) const { … }
BreakableStringLiteralUsingOperators::BreakableStringLiteralUsingOperators(
const FormatToken &Tok, QuoteStyleType QuoteStyle, bool UnindentPlus,
unsigned StartColumn, unsigned UnbreakableTailLength, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style)
: … { … }
unsigned BreakableStringLiteralUsingOperators::getRemainingLength(
unsigned LineIndex, unsigned Offset, unsigned StartColumn) const { … }
unsigned
BreakableStringLiteralUsingOperators::getContentStartColumn(unsigned LineIndex,
bool Break) const { … }
void BreakableStringLiteralUsingOperators::insertBreak(
unsigned LineIndex, unsigned TailOffset, Split Split,
unsigned ContentIndent, WhitespaceManager &Whitespaces) const { … }
void BreakableStringLiteralUsingOperators::updateAfterBroken(
WhitespaceManager &Whitespaces) const { … }
BreakableComment::BreakableComment(const FormatToken &Token,
unsigned StartColumn, bool InPPDirective,
encoding::Encoding Encoding,
const FormatStyle &Style)
: … { … }
unsigned BreakableComment::getLineCount() const { … }
BreakableToken::Split
BreakableComment::getSplit(unsigned LineIndex, unsigned TailOffset,
unsigned ColumnLimit, unsigned ContentStartColumn,
const llvm::Regex &CommentPragmasRegex) const { … }
void BreakableComment::compressWhitespace(
unsigned LineIndex, unsigned TailOffset, Split Split,
WhitespaceManager &Whitespaces) const { … }
const FormatToken &BreakableComment::tokenAt(unsigned LineIndex) const { … }
static bool mayReflowContent(StringRef Content) { … }
BreakableBlockComment::BreakableBlockComment(
const FormatToken &Token, unsigned StartColumn,
unsigned OriginalStartColumn, bool FirstInLine, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style, bool UseCRLF)
: … { … }
BreakableToken::Split BreakableBlockComment::getSplit(
unsigned LineIndex, unsigned TailOffset, unsigned ColumnLimit,
unsigned ContentStartColumn, const llvm::Regex &CommentPragmasRegex) const { … }
void BreakableBlockComment::adjustWhitespace(unsigned LineIndex,
int IndentDelta) { … }
unsigned BreakableBlockComment::getRangeLength(unsigned LineIndex,
unsigned Offset,
StringRef::size_type Length,
unsigned StartColumn) const { … }
unsigned BreakableBlockComment::getRemainingLength(unsigned LineIndex,
unsigned Offset,
unsigned StartColumn) const { … }
unsigned BreakableBlockComment::getContentStartColumn(unsigned LineIndex,
bool Break) const { … }
const llvm::StringSet<>
BreakableBlockComment::ContentIndentingJavadocAnnotations = …;
unsigned BreakableBlockComment::getContentIndent(unsigned LineIndex) const { … }
void BreakableBlockComment::insertBreak(unsigned LineIndex, unsigned TailOffset,
Split Split, unsigned ContentIndent,
WhitespaceManager &Whitespaces) const { … }
BreakableToken::Split BreakableBlockComment::getReflowSplit(
unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const { … }
bool BreakableBlockComment::introducesBreakBeforeToken() const { … }
void BreakableBlockComment::reflow(unsigned LineIndex,
WhitespaceManager &Whitespaces) const { … }
void BreakableBlockComment::adaptStartOfLine(
unsigned LineIndex, WhitespaceManager &Whitespaces) const { … }
BreakableToken::Split
BreakableBlockComment::getSplitAfterLastLine(unsigned TailOffset) const { … }
bool BreakableBlockComment::mayReflow(
unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const { … }
BreakableLineCommentSection::BreakableLineCommentSection(
const FormatToken &Token, unsigned StartColumn, bool InPPDirective,
encoding::Encoding Encoding, const FormatStyle &Style)
: … { … }
unsigned
BreakableLineCommentSection::getRangeLength(unsigned LineIndex, unsigned Offset,
StringRef::size_type Length,
unsigned StartColumn) const { … }
unsigned
BreakableLineCommentSection::getContentStartColumn(unsigned LineIndex,
bool ) const { … }
void BreakableLineCommentSection::insertBreak(
unsigned LineIndex, unsigned TailOffset, Split Split,
unsigned ContentIndent, WhitespaceManager &Whitespaces) const { … }
BreakableComment::Split BreakableLineCommentSection::getReflowSplit(
unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const { … }
void BreakableLineCommentSection::reflow(unsigned LineIndex,
WhitespaceManager &Whitespaces) const { … }
void BreakableLineCommentSection::adaptStartOfLine(
unsigned LineIndex, WhitespaceManager &Whitespaces) const { … }
void BreakableLineCommentSection::updateNextToken(LineState &State) const { … }
bool BreakableLineCommentSection::mayReflow(
unsigned LineIndex, const llvm::Regex &CommentPragmasRegex) const { … }
}
}