class TokenAnnotator

Declaration

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

Description

Determines extra information about the tokens comprising an\c UnwrappedLine.

Declared at: clang/lib/Format/TokenAnnotator.h:156

Member Variables

private const clang::format::FormatStyle& Style
private const clang::format::AdditionalKeywords& Keywords

Method Overview

  • public TokenAnnotator(const clang::format::FormatStyle & Style, const clang::format::AdditionalKeywords & Keywords)
  • public void annotate(clang::format::AnnotatedLine & Line) const
  • private void calculateArrayInitializerColumnList(clang::format::AnnotatedLine & Line) const
  • public void calculateFormattingInformation(clang::format::AnnotatedLine & Line) const
  • private clang::format::FormatToken * calculateInitializerColumnList(clang::format::AnnotatedLine & Line, clang::format::FormatToken * CurrentToken, unsigned int Depth) const
  • private void calculateUnbreakableTailLengths(clang::format::AnnotatedLine & Line) const
  • private bool canBreakBefore(const clang::format::AnnotatedLine & Line, const clang::format::FormatToken & Right) const
  • private FormatStyle::PointerAlignmentStyle getTokenPointerOrReferenceAlignment(const clang::format::FormatToken & PointerOrReference) const
  • private FormatStyle::PointerAlignmentStyle getTokenReferenceAlignment(const clang::format::FormatToken & PointerOrReference) const
  • private bool mustBreakBefore(const clang::format::AnnotatedLine & Line, const clang::format::FormatToken & Right) const
  • private bool mustBreakForReturnType(const clang::format::AnnotatedLine & Line) const
  • private void printDebugInfo(const clang::format::AnnotatedLine & Line) const
  • public void setCommentLineLevels(SmallVectorImpl<clang::format::AnnotatedLine *> & Lines) const
  • private bool spaceRequiredBefore(const clang::format::AnnotatedLine & Line, const clang::format::FormatToken & Right) const
  • private bool spaceRequiredBeforeParens(const clang::format::FormatToken & Right) const
  • private bool spaceRequiredBetween(const clang::format::AnnotatedLine & Line, const clang::format::FormatToken & Left, const clang::format::FormatToken & Right) const
  • private unsigned int splitPenalty(const clang::format::AnnotatedLine & Line, const clang::format::FormatToken & Tok, bool InFunctionDecl) const

Methods

TokenAnnotator(
    const clang::format::FormatStyle& Style,
    const clang::format::AdditionalKeywords&
        Keywords)

Declared at: clang/lib/Format/TokenAnnotator.h:158

Parameters

const clang::format::FormatStyle& Style
const clang::format::AdditionalKeywords& Keywords

void annotate(
    clang::format::AnnotatedLine& Line) const

Declared at: clang/lib/Format/TokenAnnotator.h:166

Parameters

clang::format::AnnotatedLine& Line

void calculateArrayInitializerColumnList(
    clang::format::AnnotatedLine& Line) const

Declared at: clang/lib/Format/TokenAnnotator.h:194

Parameters

clang::format::AnnotatedLine& Line

void calculateFormattingInformation(
    clang::format::AnnotatedLine& Line) const

Declared at: clang/lib/Format/TokenAnnotator.h:167

Parameters

clang::format::AnnotatedLine& Line

clang::format::FormatToken*
calculateInitializerColumnList(
    clang::format::AnnotatedLine& Line,
    clang::format::FormatToken* CurrentToken,
    unsigned int Depth) const

Declared at: clang/lib/Format/TokenAnnotator.h:196

Parameters

clang::format::AnnotatedLine& Line
clang::format::FormatToken* CurrentToken
unsigned int Depth

void calculateUnbreakableTailLengths(
    clang::format::AnnotatedLine& Line) const

Declared at: clang/lib/Format/TokenAnnotator.h:192

Parameters

clang::format::AnnotatedLine& Line

bool canBreakBefore(
    const clang::format::AnnotatedLine& Line,
    const clang::format::FormatToken& Right) const

Declared at: clang/lib/Format/TokenAnnotator.h:185

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::FormatToken& Right

FormatStyle::PointerAlignmentStyle
getTokenPointerOrReferenceAlignment(
    const clang::format::FormatToken&
        PointerOrReference) const

Declared at: clang/lib/Format/TokenAnnotator.h:202

Parameters

const clang::format::FormatToken& PointerOrReference

FormatStyle::PointerAlignmentStyle
getTokenReferenceAlignment(
    const clang::format::FormatToken&
        PointerOrReference) const

Declared at: clang/lib/Format/TokenAnnotator.h:200

Parameters

const clang::format::FormatToken& PointerOrReference

bool mustBreakBefore(
    const clang::format::AnnotatedLine& Line,
    const clang::format::FormatToken& Right) const

Declared at: clang/lib/Format/TokenAnnotator.h:182

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::FormatToken& Right

bool mustBreakForReturnType(
    const clang::format::AnnotatedLine& Line)
    const

Declared at: clang/lib/Format/TokenAnnotator.h:188

Parameters

const clang::format::AnnotatedLine& Line

void printDebugInfo(
    const clang::format::AnnotatedLine& Line)
    const

Declared at: clang/lib/Format/TokenAnnotator.h:190

Parameters

const clang::format::AnnotatedLine& Line

void setCommentLineLevels(
    SmallVectorImpl<
        clang::format::AnnotatedLine*>& Lines)
    const

Description

Adapts the indent levels of comment lines to the indent of the subsequent line.

Declared at: clang/lib/Format/TokenAnnotator.h:164

Parameters

SmallVectorImpl<clang::format::AnnotatedLine*>& Lines

bool spaceRequiredBefore(
    const clang::format::AnnotatedLine& Line,
    const clang::format::FormatToken& Right) const

Declared at: clang/lib/Format/TokenAnnotator.h:179

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::FormatToken& Right

bool spaceRequiredBeforeParens(
    const clang::format::FormatToken& Right) const

Declared at: clang/lib/Format/TokenAnnotator.h:174

Parameters

const clang::format::FormatToken& Right

bool spaceRequiredBetween(
    const clang::format::AnnotatedLine& Line,
    const clang::format::FormatToken& Left,
    const clang::format::FormatToken& Right) const

Declared at: clang/lib/Format/TokenAnnotator.h:176

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::FormatToken& Left
const clang::format::FormatToken& Right

unsigned int splitPenalty(
    const clang::format::AnnotatedLine& Line,
    const clang::format::FormatToken& Tok,
    bool InFunctionDecl) const

Description

Calculate the penalty for splitting before \c Tok.

Declared at: clang/lib/Format/TokenAnnotator.h:171

Parameters

const clang::format::AnnotatedLine& Line
const clang::format::FormatToken& Tok
bool InFunctionDecl