diff options
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 2f9f98424bc..6518b246a88 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -618,7 +618,7 @@ public: SmallVectorImpl<AnnotatedLine *>::const_iterator E) { // We can never merge stuff if there are trailing line comments. const AnnotatedLine *TheLine = *I; - if (TheLine->Last->Type == TT_LineComment) + if (TheLine->Last->is(TT_LineComment)) return 0; if (Style.ColumnLimit > 0 && Indent > Style.ColumnLimit) @@ -642,7 +642,7 @@ public: (Style.AllowShortFunctionsOnASingleLine == FormatStyle::SFS_Inline && TheLine->Level != 0); - if (TheLine->Last->Type == TT_FunctionLBrace && + if (TheLine->Last->is(TT_FunctionLBrace) && TheLine->First != TheLine->Last) { return MergeShortFunctions ? tryMergeSimpleBlock(I, E, Limit) : 0; } @@ -651,7 +651,7 @@ public: ? tryMergeSimpleBlock(I, E, Limit) : 0; } - if (I[1]->First->Type == TT_FunctionLBrace && + if (I[1]->First->is(TT_FunctionLBrace) && Style.BreakBeforeBraces != FormatStyle::BS_Attach) { // Check for Limit <= 2 to account for the " {". if (Limit <= 2 || (Style.ColumnLimit == 0 && containsMustBreak(TheLine))) @@ -725,8 +725,7 @@ private: if (1 + I[1]->Last->TotalLength > Limit) return 0; if (I[1]->First->isOneOf(tok::semi, tok::kw_if, tok::kw_for, - tok::kw_while) || - I[1]->First->Type == TT_LineComment) + tok::kw_while, TT_LineComment)) return 0; // Only inline simple if's (no nested if or else). if (I + 2 != E && Line.First->is(tok::kw_if) && @@ -813,7 +812,7 @@ private: // Second, check that the next line does not contain any braces - if it // does, readability declines when putting it into a single line. - if (I[1]->Last->Type == TT_LineComment) + if (I[1]->Last->is(TT_LineComment)) return 0; do { if (Tok->is(tok::l_brace) && Tok->BlockKind != BK_BracedInit) @@ -1655,7 +1654,7 @@ private: } } - if (FormatTok->Type == TT_ImplicitStringLiteral) + if (FormatTok->is(TT_ImplicitStringLiteral)) break; WhitespaceLength += FormatTok->Tok.getLength(); @@ -2027,7 +2026,7 @@ private: continue; FormatToken *Tok = AnnotatedLines[i]->First->Next; while (Tok->Next) { - if (Tok->Type == TT_PointerOrReference) { + if (Tok->is(TT_PointerOrReference)) { bool SpacesBefore = Tok->WhitespaceRange.getBegin() != Tok->WhitespaceRange.getEnd(); bool SpacesAfter = Tok->Next->WhitespaceRange.getBegin() != @@ -2039,11 +2038,10 @@ private: } if (Tok->WhitespaceRange.getBegin() == Tok->WhitespaceRange.getEnd()) { - if (Tok->is(tok::coloncolon) && - Tok->Previous->Type == TT_TemplateOpener) + if (Tok->is(tok::coloncolon) && Tok->Previous->is(TT_TemplateOpener)) HasCpp03IncompatibleFormat = true; - if (Tok->Type == TT_TemplateCloser && - Tok->Previous->Type == TT_TemplateCloser) + if (Tok->is(TT_TemplateCloser) && + Tok->Previous->is(TT_TemplateCloser)) HasCpp03IncompatibleFormat = true; } |