class UnwrappedLineFormatter

Declaration

class UnwrappedLineFormatter { /* full declaration omitted */ };

Declared at: clang/lib/Format/UnwrappedLineFormatter.h:28

Member Variables

private std::map<std::pair<const SmallVectorImpl< AnnotatedLine*>*, unsigned int>, unsigned int> PenaltyCache
private clang::format::ContinuationIndenter* Indenter
private clang::format::WhitespaceManager* Whitespaces
private const clang::format::FormatStyle& Style
private const clang::format::AdditionalKeywords& Keywords
private const clang::SourceManager& SourceMgr
private clang::format::FormattingAttemptStatus* Status

Method Overview

  • public UnwrappedLineFormatter(clang::format::ContinuationIndenter * Indenter, clang::format::WhitespaceManager * Whitespaces, const clang::format::FormatStyle & Style, const clang::format::AdditionalKeywords & Keywords, const clang::SourceManager & SourceMgr, clang::format::FormattingAttemptStatus * Status)
  • public unsigned int format(const SmallVectorImpl<clang::format::AnnotatedLine *> & Lines, bool DryRun = false, int AdditionalIndent = 0, bool FixBadIndentation = false, unsigned int FirstStartColumn = 0, unsigned int NextStartColumn = 0, unsigned int LastStartColumn = 0)
  • private void formatFirstToken(const clang::format::AnnotatedLine & Line, const clang::format::AnnotatedLine * PreviousLine, const clang::format::AnnotatedLine * PrevPrevLine, const SmallVectorImpl<clang::format::AnnotatedLine *> & Lines, unsigned int Indent, unsigned int NewlineIndent)
  • private unsigned int getColumnLimit(bool InPPDirective, const clang::format::AnnotatedLine * NextLine) const

Methods

UnwrappedLineFormatter(
    clang::format::ContinuationIndenter* Indenter,
    clang::format::WhitespaceManager* Whitespaces,
    const clang::format::FormatStyle& Style,
    const clang::format::AdditionalKeywords&
        Keywords,
    const clang::SourceManager& SourceMgr,
    clang::format::FormattingAttemptStatus*
        Status)

Declared at: clang/lib/Format/UnwrappedLineFormatter.h:30

Parameters

clang::format::ContinuationIndenter* Indenter
clang::format::WhitespaceManager* Whitespaces
const clang::format::FormatStyle& Style
const clang::format::AdditionalKeywords& Keywords
const clang::SourceManager& SourceMgr
clang::format::FormattingAttemptStatus* Status

unsigned int format(
    const SmallVectorImpl<
        clang::format::AnnotatedLine*>& Lines,
    bool DryRun = false,
    int AdditionalIndent = 0,
    bool FixBadIndentation = false,
    unsigned int FirstStartColumn = 0,
    unsigned int NextStartColumn = 0,
    unsigned int LastStartColumn = 0)

Description

Format the current block and return the penalty.

Declared at: clang/lib/Format/UnwrappedLineFormatter.h:40

Parameters

const SmallVectorImpl< clang::format::AnnotatedLine*>& Lines
bool DryRun = false
int AdditionalIndent = 0
bool FixBadIndentation = false
unsigned int FirstStartColumn = 0
unsigned int NextStartColumn = 0
unsigned int LastStartColumn = 0

void formatFirstToken(
    const clang::format::AnnotatedLine& Line,
    const clang::format::AnnotatedLine*
        PreviousLine,
    const clang::format::AnnotatedLine*
        PrevPrevLine,
    const SmallVectorImpl<
        clang::format::AnnotatedLine*>& Lines,
    unsigned int Indent,
    unsigned int NewlineIndent)

Description

Add a new line and the required indent before the first Token of the \c UnwrappedLine if there was no structural parsing error.

Declared at: clang/lib/Format/UnwrappedLineFormatter.h:48

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::AnnotatedLine* PreviousLine
const clang::format::AnnotatedLine* PrevPrevLine
const SmallVectorImpl< clang::format::AnnotatedLine*>& Lines
unsigned int Indent
unsigned int NewlineIndent

unsigned int getColumnLimit(
    bool InPPDirective,
    const clang::format::AnnotatedLine* NextLine)
    const

Description

Returns the column limit for a line, taking into account whether we need an escaped newline due to a continued preprocessor directive.

Declared at: clang/lib/Format/UnwrappedLineFormatter.h:56

Parameters

bool InPPDirective
const clang::format::AnnotatedLine* NextLine