#include "TokenAnnotator.h"
#include "FormatToken.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TokenKinds.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE …
namespace clang {
namespace format {
static bool mustBreakAfterAttributes(const FormatToken &Tok,
const FormatStyle &Style) { … }
namespace {
static bool startsWithInitStatement(const AnnotatedLine &Line) { … }
static bool canBeObjCSelectorComponent(const FormatToken &Tok) { … }
static bool isLambdaParameterList(const FormatToken *Left) { … }
static bool isKeywordWithCondition(const FormatToken &Tok) { … }
static bool isCppAttribute(bool IsCpp, const FormatToken &Tok) { … }
class AnnotatingParser { … };
static const int PrecedenceUnaryOperator = …;
static const int PrecedenceArrowAndPeriod = …;
class ExpressionParser { … };
}
void TokenAnnotator::setCommentLineLevels(
SmallVectorImpl<AnnotatedLine *> &Lines) const { … }
static unsigned maxNestingDepth(const AnnotatedLine &Line) { … }
static FormatToken *getFunctionName(const AnnotatedLine &Line,
FormatToken *&OpeningParen) { … }
static bool isCtorOrDtorName(const FormatToken *Tok) { … }
void TokenAnnotator::annotate(AnnotatedLine &Line) { … }
static bool isFunctionDeclarationName(const LangOptions &LangOpts,
const FormatToken &Current,
const AnnotatedLine &Line,
FormatToken *&ClosingParen) { … }
bool TokenAnnotator::mustBreakForReturnType(const AnnotatedLine &Line) const { … }
void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const { … }
void TokenAnnotator::calculateUnbreakableTailLengths(
AnnotatedLine &Line) const { … }
void TokenAnnotator::calculateArrayInitializerColumnList(
AnnotatedLine &Line) const { … }
FormatToken *TokenAnnotator::calculateInitializerColumnList(
AnnotatedLine &Line, FormatToken *CurrentToken, unsigned Depth) const { … }
unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
const FormatToken &Tok,
bool InFunctionDecl) const { … }
bool TokenAnnotator::spaceRequiredBeforeParens(const FormatToken &Right) const { … }
bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
const FormatToken &Left,
const FormatToken &Right) const { … }
bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
const FormatToken &Right) const { … }
static bool isAllmanBrace(const FormatToken &Tok) { … }
static bool IsFunctionArgument(const FormatToken &Tok) { … }
static bool
isItAnEmptyLambdaAllowed(const FormatToken &Tok,
FormatStyle::ShortLambdaStyle ShortLambdaOption) { … }
static bool isAllmanLambdaBrace(const FormatToken &Tok) { … }
bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
const FormatToken &Right) const { … }
bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
const FormatToken &Right) const { … }
void TokenAnnotator::printDebugInfo(const AnnotatedLine &Line) const { … }
FormatStyle::PointerAlignmentStyle
TokenAnnotator::getTokenReferenceAlignment(const FormatToken &Reference) const { … }
FormatStyle::PointerAlignmentStyle
TokenAnnotator::getTokenPointerOrReferenceAlignment(
const FormatToken &PointerOrReference) const { … }
}
}