Fixed typo: NoneComment -> NonComment, no other changes.
llvm-svn: 185640
This commit is contained in:
parent
e703c0194c
commit
1efe0a07bb
@ -587,7 +587,7 @@ private:
|
||||
for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i) {
|
||||
State.Stack[i].BreakBeforeParameter = true;
|
||||
}
|
||||
const FormatToken *TokenBefore = Current.getPreviousNoneComment();
|
||||
const FormatToken *TokenBefore = Current.getPreviousNonComment();
|
||||
if (TokenBefore && !TokenBefore->isOneOf(tok::comma, tok::semi) &&
|
||||
TokenBefore->Type != TT_TemplateCloser &&
|
||||
TokenBefore->Type != TT_BinaryOperator && !TokenBefore->opensScope())
|
||||
@ -714,7 +714,7 @@ private:
|
||||
State.Stack.back().Indent += 4;
|
||||
|
||||
// Insert scopes created by fake parenthesis.
|
||||
const FormatToken *Previous = Current.getPreviousNoneComment();
|
||||
const FormatToken *Previous = Current.getPreviousNonComment();
|
||||
// Don't add extra indentation for the first fake parenthesis after
|
||||
// 'return', assignements or opening <({[. The indentation for these cases
|
||||
// is special cased.
|
||||
@ -753,7 +753,7 @@ private:
|
||||
bool AvoidBinPacking;
|
||||
if (Current.is(tok::l_brace)) {
|
||||
NewIndent = Style.IndentWidth + LastSpace;
|
||||
const FormatToken *NextNoComment = Current.getNextNoneComment();
|
||||
const FormatToken *NextNoComment = Current.getNextNonComment();
|
||||
AvoidBinPacking = NextNoComment &&
|
||||
NextNoComment->Type == TT_DesignatedInitializerPeriod;
|
||||
} else {
|
||||
@ -1275,13 +1275,13 @@ public:
|
||||
|
||||
// Adapt level to the next line if this is a comment.
|
||||
// FIXME: Can/should this be done in the UnwrappedLineParser?
|
||||
const AnnotatedLine *NextNoneCommentLine = NULL;
|
||||
const AnnotatedLine *NextNonCommentLine = NULL;
|
||||
for (unsigned i = AnnotatedLines.size() - 1; i > 0; --i) {
|
||||
if (NextNoneCommentLine && AnnotatedLines[i].First->is(tok::comment) &&
|
||||
if (NextNonCommentLine && AnnotatedLines[i].First->is(tok::comment) &&
|
||||
!AnnotatedLines[i].First->Next)
|
||||
AnnotatedLines[i].Level = NextNoneCommentLine->Level;
|
||||
AnnotatedLines[i].Level = NextNonCommentLine->Level;
|
||||
else
|
||||
NextNoneCommentLine =
|
||||
NextNonCommentLine =
|
||||
AnnotatedLines[i].First->isNot(tok::r_brace) ? &AnnotatedLines[i]
|
||||
: NULL;
|
||||
}
|
||||
@ -1531,8 +1531,8 @@ private:
|
||||
|
||||
FormatToken *Tok = (I + 1)->First;
|
||||
if (Tok->is(tok::r_brace) && !Tok->MustBreakBefore &&
|
||||
(Tok->getNextNoneComment() == NULL ||
|
||||
Tok->getNextNoneComment()->is(tok::semi))) {
|
||||
(Tok->getNextNonComment() == NULL ||
|
||||
Tok->getNextNonComment()->is(tok::semi))) {
|
||||
// We merge empty blocks even if the line exceeds the column limit.
|
||||
Tok->SpacesRequiredBefore = 0;
|
||||
Tok->CanBreakBefore = true;
|
||||
@ -1556,7 +1556,7 @@ private:
|
||||
|
||||
// Last, check that the third line contains a single closing brace.
|
||||
Tok = (I + 2)->First;
|
||||
if (Tok->getNextNoneComment() != NULL || Tok->isNot(tok::r_brace) ||
|
||||
if (Tok->getNextNonComment() != NULL || Tok->isNot(tok::r_brace) ||
|
||||
Tok->MustBreakBefore)
|
||||
return;
|
||||
|
||||
|
||||
@ -248,7 +248,7 @@ struct FormatToken {
|
||||
}
|
||||
|
||||
/// \brief Returns the previous token ignoring comments.
|
||||
FormatToken *getPreviousNoneComment() const {
|
||||
FormatToken *getPreviousNonComment() const {
|
||||
FormatToken *Tok = Previous;
|
||||
while (Tok != NULL && Tok->is(tok::comment))
|
||||
Tok = Tok->Previous;
|
||||
@ -256,7 +256,7 @@ struct FormatToken {
|
||||
}
|
||||
|
||||
/// \brief Returns the next token ignoring comments.
|
||||
const FormatToken *getNextNoneComment() const {
|
||||
const FormatToken *getNextNonComment() const {
|
||||
const FormatToken *Tok = Next;
|
||||
while (Tok != NULL && Tok->is(tok::comment))
|
||||
Tok = Tok->Next;
|
||||
|
||||
@ -105,9 +105,9 @@ private:
|
||||
// '*' has to be a binary operator but determineStarAmpUsage() will
|
||||
// categorize it as an unary operator, so set the right type here.
|
||||
if (LookForDecls && CurrentToken->Next) {
|
||||
FormatToken *Prev = CurrentToken->getPreviousNoneComment();
|
||||
FormatToken *Prev = CurrentToken->getPreviousNonComment();
|
||||
if (Prev) {
|
||||
FormatToken *PrevPrev = Prev->getPreviousNoneComment();
|
||||
FormatToken *PrevPrev = Prev->getPreviousNonComment();
|
||||
FormatToken *Next = CurrentToken->Next;
|
||||
if (PrevPrev && PrevPrev->is(tok::identifier) &&
|
||||
Prev->isOneOf(tok::star, tok::amp, tok::ampamp) &&
|
||||
@ -157,7 +157,7 @@ private:
|
||||
// ')' or ']'), it could be the start of an Objective-C method
|
||||
// expression, or it could the the start of an Objective-C array literal.
|
||||
FormatToken *Left = CurrentToken->Previous;
|
||||
FormatToken *Parent = Left->getPreviousNoneComment();
|
||||
FormatToken *Parent = Left->getPreviousNonComment();
|
||||
bool StartsObjCMethodExpr =
|
||||
Contexts.back().CanBeExpression &&
|
||||
(!Parent || Parent->isOneOf(tok::colon, tok::l_square, tok::l_paren,
|
||||
@ -216,7 +216,7 @@ private:
|
||||
ScopedContextCreator ContextCreator(*this, tok::l_brace, 1);
|
||||
FormatToken *Left = CurrentToken->Previous;
|
||||
|
||||
FormatToken *Parent = Left->getPreviousNoneComment();
|
||||
FormatToken *Parent = Left->getPreviousNonComment();
|
||||
bool StartsObjCDictLiteral = Parent && Parent->is(tok::at);
|
||||
if (StartsObjCDictLiteral) {
|
||||
Contexts.back().ColonIsObjCDictLiteral = true;
|
||||
@ -608,7 +608,7 @@ private:
|
||||
} else if (Current.is(tok::r_paren)) {
|
||||
FormatToken *LeftOfParens = NULL;
|
||||
if (Current.MatchingParen)
|
||||
LeftOfParens = Current.MatchingParen->getPreviousNoneComment();
|
||||
LeftOfParens = Current.MatchingParen->getPreviousNonComment();
|
||||
bool IsCast = false;
|
||||
bool ParensAreEmpty = Current.Previous == Current.MatchingParen;
|
||||
bool ParensAreType = !Current.Previous ||
|
||||
@ -652,7 +652,7 @@ private:
|
||||
break;
|
||||
}
|
||||
} else if (Current.is(tok::period)) {
|
||||
FormatToken *PreviousNoComment = Current.getPreviousNoneComment();
|
||||
FormatToken *PreviousNoComment = Current.getPreviousNonComment();
|
||||
if (PreviousNoComment &&
|
||||
PreviousNoComment->isOneOf(tok::comma, tok::l_brace))
|
||||
Current.Type = TT_DesignatedInitializerPeriod;
|
||||
@ -689,11 +689,11 @@ private:
|
||||
|
||||
/// \brief Return the type of the given token assuming it is * or &.
|
||||
TokenType determineStarAmpUsage(const FormatToken &Tok, bool IsExpression) {
|
||||
const FormatToken *PrevToken = Tok.getPreviousNoneComment();
|
||||
const FormatToken *PrevToken = Tok.getPreviousNonComment();
|
||||
if (PrevToken == NULL)
|
||||
return TT_UnaryOperator;
|
||||
|
||||
const FormatToken *NextToken = Tok.getNextNoneComment();
|
||||
const FormatToken *NextToken = Tok.getNextNonComment();
|
||||
if (NextToken == NULL)
|
||||
return TT_Unknown;
|
||||
|
||||
@ -725,7 +725,7 @@ private:
|
||||
}
|
||||
|
||||
TokenType determinePlusMinusCaretUsage(const FormatToken &Tok) {
|
||||
const FormatToken *PrevToken = Tok.getPreviousNoneComment();
|
||||
const FormatToken *PrevToken = Tok.getPreviousNonComment();
|
||||
if (PrevToken == NULL || PrevToken->Type == TT_CastRParen)
|
||||
return TT_UnaryOperator;
|
||||
|
||||
@ -745,7 +745,7 @@ private:
|
||||
|
||||
/// \brief Determine whether ++/-- are pre- or post-increments/-decrements.
|
||||
TokenType determineIncrementUsage(const FormatToken &Tok) {
|
||||
const FormatToken *PrevToken = Tok.getPreviousNoneComment();
|
||||
const FormatToken *PrevToken = Tok.getPreviousNonComment();
|
||||
if (PrevToken == NULL || PrevToken->Type == TT_CastRParen)
|
||||
return TT_UnaryOperator;
|
||||
if (PrevToken->isOneOf(tok::r_paren, tok::r_square, tok::identifier))
|
||||
@ -940,8 +940,8 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) {
|
||||
Current->is(tok::string_literal) &&
|
||||
Current->Previous->isNot(tok::lessless) &&
|
||||
Current->Previous->Type != TT_InlineASMColon &&
|
||||
Current->getNextNoneComment() &&
|
||||
Current->getNextNoneComment()->is(tok::string_literal)) {
|
||||
Current->getNextNonComment() &&
|
||||
Current->getNextNonComment()->is(tok::string_literal)) {
|
||||
Current->MustBreakBefore = true;
|
||||
} else {
|
||||
Current->MustBreakBefore = false;
|
||||
@ -1138,7 +1138,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
||||
return !Left.isOneOf(tok::l_paren, tok::l_square, tok::at) &&
|
||||
(Left.isNot(tok::colon) || Left.Type != TT_ObjCMethodExpr);
|
||||
if (Left.isOneOf(tok::identifier, tok::greater, tok::r_square) &&
|
||||
Right.is(tok::l_brace) && Right.getNextNoneComment())
|
||||
Right.is(tok::l_brace) && Right.getNextNonComment())
|
||||
return false;
|
||||
if (Left.is(tok::period) || Right.is(tok::period))
|
||||
return false;
|
||||
@ -1174,7 +1174,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
||||
return false;
|
||||
if (Tok.is(tok::colon))
|
||||
return !Line.First->isOneOf(tok::kw_case, tok::kw_default) &&
|
||||
Tok.getNextNoneComment() != NULL && Tok.Type != TT_ObjCMethodExpr;
|
||||
Tok.getNextNonComment() != NULL && Tok.Type != TT_ObjCMethodExpr;
|
||||
if (Tok.Previous->Type == TT_UnaryOperator ||
|
||||
Tok.Previous->Type == TT_CastRParen)
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user