#include "UnwrappedLineFormatter.h"
#include "FormatToken.h"
#include "NamespaceEndCommentsFixer.h"
#include "WhitespaceManager.h"
#include "llvm/Support/Debug.h"
#include <queue>
#define DEBUG_TYPE …
namespace clang {
namespace format {
namespace {
bool startsExternCBlock(const AnnotatedLine &Line) { … }
bool isRecordLBrace(const FormatToken &Tok) { … }
class LevelIndentTracker { … };
const FormatToken *getMatchingNamespaceToken(
const AnnotatedLine *Line,
const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines) { … }
StringRef getNamespaceTokenText(const AnnotatedLine *Line) { … }
StringRef getMatchingNamespaceTokenText(
const AnnotatedLine *Line,
const SmallVectorImpl<AnnotatedLine *> &AnnotatedLines) { … }
class LineJoiner { … };
static void markFinalized(FormatToken *Tok) { … }
#ifndef NDEBUG
static void printLineState(const LineState &State) {
llvm::dbgs() << "State: ";
for (const ParenState &P : State.Stack) {
llvm::dbgs() << (P.Tok ? P.Tok->TokenText : "F") << "|" << P.Indent << "|"
<< P.LastSpace << "|" << P.NestedBlockIndent << " ";
}
llvm::dbgs() << State.NextToken->TokenText << "\n";
}
#endif
class LineFormatter { … };
class NoColumnLimitLineFormatter : public LineFormatter { … };
class NoLineBreakFormatter : public LineFormatter { … };
class OptimizingLineFormatter : public LineFormatter { … };
}
unsigned UnwrappedLineFormatter::format(
const SmallVectorImpl<AnnotatedLine *> &Lines, bool DryRun,
int AdditionalIndent, bool FixBadIndentation, unsigned FirstStartColumn,
unsigned NextStartColumn, unsigned LastStartColumn) { … }
static auto computeNewlines(const AnnotatedLine &Line,
const AnnotatedLine *PreviousLine,
const AnnotatedLine *PrevPrevLine,
const SmallVectorImpl<AnnotatedLine *> &Lines,
const FormatStyle &Style) { … }
void UnwrappedLineFormatter::formatFirstToken(
const AnnotatedLine &Line, const AnnotatedLine *PreviousLine,
const AnnotatedLine *PrevPrevLine,
const SmallVectorImpl<AnnotatedLine *> &Lines, unsigned Indent,
unsigned NewlineIndent) { … }
unsigned
UnwrappedLineFormatter::getColumnLimit(bool InPPDirective,
const AnnotatedLine *NextLine) const { … }
}
}