reference, declaration → definition definition → references, declarations, derived classes, virtual overrides reference to multiple definitions → definitions unreferenced |
246 FormatTok = nullptr; 275 pushToken(FormatTok); 329 tok::TokenKind kind = FormatTok->Tok.getKind(); 330 if (FormatTok->Type == TT_MacroBlockBegin) { 332 } else if (FormatTok->Type == TT_MacroBlockEnd) { 344 if (!FormatTok->is(TT_MacroBlockBegin) && tryToParseBracedList()) 361 FormatTok = Tokens->setPosition(StoredPosition); 397 FormatToken *Tok = FormatTok; 515 FormatTok = Tokens->setPosition(StoredPosition); 535 assert(FormatTok->isOneOf(tok::l_brace, TT_MacroBlockBegin) && 537 const bool MacroBlock = FormatTok->is(TT_MacroBlockBegin); 538 FormatTok->BlockKind = BK_Block; 545 if (MacroBlock && FormatTok->is(tok::l_paren)) 565 if (MacroBlock ? !FormatTok->is(TT_MacroBlockEnd) 566 : !FormatTok->is(tok::r_brace)) { 568 FormatTok->BlockKind = BK_Block; 577 if (MacroBlock && FormatTok->is(tok::l_paren)) 580 if (MunchSemi && FormatTok->Tok.is(tok::semi)) 644 FormatTok->BlockKind = BK_Block; 654 flushComments(isOnNewLine(*FormatTok)); 661 assert(FormatTok->Tok.is(tok::hash) && "'#' expected"); 662 ScopedMacroState MacroState(*Line, Tokens, FormatTok); 666 if (!FormatTok->Tok.getIdentifierInfo()) { 671 switch (FormatTok->Tok.getIdentifierInfo()->getPPKeywordID()) { 749 bool IfNDef = FormatTok->is(tok::pp_ifndef); 752 if (!IfDef && (FormatTok->is(tok::kw_false) || FormatTok->TokenText == "0")) 752 if (!IfDef && (FormatTok->is(tok::kw_false) || FormatTok->TokenText == "0")) 754 if (IfDef && !IfNDef && FormatTok->TokenText == "SWIG") 757 FormatToken *IfCondition = FormatTok; 807 if (!FormatTok->Tok.getIdentifierInfo()) { 815 IncludeGuardToken->TokenText == FormatTok->TokenText) { 827 if (FormatTok->Tok.getKind() == tok::l_paren && 828 FormatTok->WhitespaceRange.getBegin() == 829 FormatTok->WhitespaceRange.getEnd()) { 934 FormatToken *Previous = FormatTok; 936 FormatToken *Next = FormatTok; 974 assert(!FormatTok->is(tok::l_brace)); 976 FormatTok->is(tok::pp_include)) { 978 if (FormatTok->is(tok::string_literal)) 983 switch (FormatTok->Tok.getKind()) { 986 if (FormatTok->is(tok::l_brace)) { 987 FormatTok->Type = TT_InlineASMBrace; 989 while (FormatTok && FormatTok->isNot(tok::eof)) { 989 while (FormatTok && FormatTok->isNot(tok::eof)) { 990 if (FormatTok->is(tok::r_brace)) { 991 FormatTok->Type = TT_InlineASMBrace; 996 FormatTok->Finalized = true; 1034 if (FormatTok->is(tok::colon)) { 1052 if (FormatTok->Tok.is(tok::string_literal)) { 1054 if (FormatTok->Tok.is(tok::l_brace)) { 1077 if (FormatTok->Tok.is(tok::kw_namespace)) { 1083 if (FormatTok->is(TT_ForEachMacro)) { 1087 if (FormatTok->is(TT_MacroBlockBegin)) { 1092 if (FormatTok->is(Keywords.kw_import)) { 1099 if (FormatTok->is(tok::kw_public)) 1101 if (!FormatTok->is(tok::string_literal)) 1104 if (FormatTok->is(tok::semi)) 1111 FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals, 1114 if (FormatTok->is(tok::colon)) { 1120 if (Style.isCpp() && FormatTok->is(TT_StatementMacro)) { 1124 if (Style.isCpp() && FormatTok->is(TT_NamespaceMacro)) { 1134 const FormatToken *Previous = FormatTok->Previous; 1135 switch (FormatTok->Tok.getKind()) { 1138 if (FormatTok->Tok.is(tok::l_brace)) { 1143 FormatTok->is(Keywords.kw_interface)) { 1147 switch (FormatTok->Tok.getObjCKeywordID()) { 1169 if (FormatTok->Tok.is(tok::l_brace)) { 1179 if (FormatTok->Tok.is(tok::l_paren)) 1182 if (FormatTok->Tok.is(tok::l_brace)) { 1218 if (FormatTok->isOneOf(Keywords.kw_NS_ENUM, Keywords.kw_NS_OPTIONS, 1233 if (FormatTok->is(tok::semi)) 1242 if (Style.Language == FormatStyle::LK_Java && FormatTok && 1243 FormatTok->is(tok::kw_class)) 1245 if (Style.Language == FormatStyle::LK_JavaScript && FormatTok && 1246 FormatTok->Tok.getIdentifierInfo()) 1263 if (FormatTok->isBinaryOperator()) 1268 if (FormatTok->Tok.isAnyIdentifier() || 1269 FormatTok->isSimpleTypeSpecifier()) 1271 if (FormatTok->is(tok::l_paren)) 1273 if (FormatTok->is(tok::l_brace)) 1284 FormatTok->Type = TT_FunctionLBrace; 1299 if (FormatTok->is(TT_MacroBlockEnd)) { 1310 FormatTok->is(Keywords.kw_function) && 1318 FormatTok->is(Keywords.kw_interface)) { 1326 FormatTok = Tokens->setPosition(StoredPosition); 1337 if (Style.isCpp() && FormatTok->is(TT_StatementMacro)) { 1343 StringRef Text = FormatTok->TokenText; 1354 if (FormatTok->Tok.is(tok::colon) && !Line->MustBeDeclaration) { 1361 bool FunctionLike = FormatTok->is(tok::l_paren); 1367 ? FormatTok->NewlinesBefore > 0 1371 tokenCanStartNewLine(FormatTok->Tok) && Text == Text.upper()) { 1382 if (FormatTok->is(TT_JsFatArrow)) { 1384 if (FormatTok->is(tok::l_brace)) 1390 if (FormatTok->Tok.is(tok::l_brace)) { 1394 FormatTok->Tok.is(tok::less)) { 1418 assert(FormatTok->is(tok::l_square)); 1419 FormatToken &LSquare = *FormatTok; 1425 while (FormatTok->isNot(tok::l_brace)) { 1426 if (FormatTok->isSimpleTypeSpecifier()) { 1430 switch (FormatTok->Tok.getKind()) { 1494 FormatTok->Type = TT_LambdaArrow; 1502 FormatTok->Type = TT_LambdaLBrace; 1509 const FormatToken *Previous = FormatTok->Previous; 1513 FormatTok->isCppStructuredBinding(Style) || Previous->closesScope() || 1519 if (FormatTok->is(tok::l_square)) { 1527 assert(FormatTok->is(Keywords.kw_function) || 1528 FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)); 1529 if (FormatTok->is(Keywords.kw_async)) 1535 if (FormatTok->is(tok::star)) { 1536 FormatTok->Type = TT_OverloadedOperator; 1541 if (FormatTok->is(tok::identifier)) 1544 if (FormatTok->isNot(tok::l_paren)) 1550 if (FormatTok->is(tok::colon)) { 1556 if (FormatTok->is(tok::l_brace)) 1559 while (!FormatTok->isOneOf(tok::l_brace, tok::semi) && !eof()) 1563 if (FormatTok->is(tok::semi)) 1570 if (FormatTok->BlockKind == BK_Unknown) 1572 assert(FormatTok->BlockKind != BK_Unknown); 1573 if (FormatTok->BlockKind == BK_Block) 1588 if (FormatTok->is(Keywords.kw_function) || 1589 FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function)) { 1593 if (FormatTok->is(TT_JsFatArrow)) { 1597 if (FormatTok->is(tok::l_brace)) { 1602 if (FormatTok->is(tok::l_brace)) { 1609 if (FormatTok->Tok.getKind() == ClosingBraceKind) { 1613 switch (FormatTok->Tok.getKind()) { 1616 if (FormatTok->is(tok::l_brace)) { 1628 if (FormatTok->is(tok::l_brace)) 1636 FormatTok->BlockKind = BK_BracedInit; 1675 assert(FormatTok->Tok.is(tok::l_paren) && "'(' expected."); 1678 switch (FormatTok->Tok.getKind()) { 1681 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_brace)) 1699 if (FormatTok->Tok.is(tok::l_brace)) { 1712 (FormatTok->is(Keywords.kw_function) || 1713 FormatTok->startsSequence(Keywords.kw_async, Keywords.kw_function))) 1727 assert(FormatTok->Tok.is(tok::l_square) && "'[' expected."); 1732 switch (FormatTok->Tok.getKind()) { 1752 if (FormatTok->Tok.is(tok::l_brace)) { 1765 assert(FormatTok->Tok.is(tok::kw_if) && "'if' expected"); 1767 if (FormatTok->Tok.isOneOf(tok::kw_constexpr, tok::identifier)) 1769 if (FormatTok->Tok.is(tok::l_paren)) 1772 if (FormatTok->Tok.is(tok::l_brace)) { 1785 if (FormatTok->Tok.is(tok::kw_else)) { 1787 if (FormatTok->Tok.is(tok::l_brace)) { 1791 } else if (FormatTok->Tok.is(tok::kw_if)) { 1797 if (FormatTok->is(tok::eof)) 1807 assert(FormatTok->isOneOf(tok::kw_try, tok::kw___try) && "'try' expected"); 1810 if (FormatTok->is(tok::colon)) { 1813 while (FormatTok->is(tok::identifier)) { 1815 if (FormatTok->is(tok::l_paren)) 1817 if (FormatTok->is(tok::comma)) 1822 if (Style.Language == FormatStyle::LK_Java && FormatTok->is(tok::l_paren)) { 1825 if (FormatTok->is(tok::l_brace)) { 1833 } else if (!FormatTok->is(tok::kw_catch)) { 1843 if (FormatTok->is(tok::at)) 1845 if (!(FormatTok->isOneOf(tok::kw_catch, Keywords.kw___except, 1849 FormatTok->is(Keywords.kw_finally)) || 1850 (FormatTok->Tok.isObjCAtKeyword(tok::objc_catch) || 1851 FormatTok->Tok.isObjCAtKeyword(tok::objc_finally)))) 1854 while (FormatTok->isNot(tok::l_brace)) { 1855 if (FormatTok->is(tok::l_paren)) { 1859 if (FormatTok->isOneOf(tok::semi, tok::r_brace, tok::eof)) 1876 assert(FormatTok->isOneOf(tok::kw_namespace, TT_NamespaceMacro) && 1879 const FormatToken &InitialToken = *FormatTok; 1884 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::kw_inline, 1886 if (FormatTok->is(tok::l_square)) 1892 if (FormatTok->Tok.is(tok::l_brace)) { 1902 if (FormatTok->Tok.is(tok::semi)) 1910 assert(FormatTok->is(tok::kw_new) && "'new' expected"); 1918 if (FormatTok->isOneOf(tok::semi, tok::l_brace, tok::r_brace)) 1922 if (FormatTok->is(tok::l_paren)) { 1926 if (FormatTok->is(tok::l_brace)) 1935 assert(FormatTok->isOneOf(tok::kw_for, tok::kw_while, TT_ForEachMacro) && 1940 FormatTok->is(Keywords.kw_await)) 1942 if (FormatTok->Tok.is(tok::l_paren)) 1944 if (FormatTok->Tok.is(tok::l_brace)) { 1957 assert(FormatTok->Tok.is(tok::kw_do) && "'do' expected"); 1959 if (FormatTok->Tok.is(tok::l_brace)) { 1972 if (!FormatTok->Tok.is(tok::kw_while)) { 1988 if (CommentsBeforeNextToken.empty() && FormatTok->Tok.is(tok::l_brace)) { 1993 if (FormatTok->Tok.is(tok::kw_break)) { 2001 if (FormatTok->is(tok::semi)) 2006 if (FormatTok->isNot(tok::l_brace)) { 2013 assert(FormatTok->Tok.is(tok::kw_case) && "'case' expected"); 2017 } while (!eof() && !FormatTok->Tok.is(tok::colon)); 2022 assert(FormatTok->Tok.is(tok::kw_switch) && "'switch' expected"); 2024 if (FormatTok->Tok.is(tok::l_paren)) 2026 if (FormatTok->Tok.is(tok::l_brace)) { 2041 if (FormatTok->isOneOf(Keywords.kw_slots, Keywords.kw_qslots)) 2044 if (FormatTok->Tok.is(tok::colon)) 2051 if (FormatTok->Tok.is(tok::kw_enum)) 2058 FormatTok->isOneOf(tok::colon, tok::question)) 2062 if (Style.Language == FormatStyle::LK_Proto && FormatTok->is(tok::equal)) 2066 if (FormatTok->Tok.is(tok::kw_class) || FormatTok->Tok.is(tok::kw_struct)) 2066 if (FormatTok->Tok.is(tok::kw_class) || FormatTok->Tok.is(tok::kw_struct)) 2069 while (FormatTok->Tok.getIdentifierInfo() || 2070 FormatTok->isOneOf(tok::colon, tok::coloncolon, tok::less, 2074 if (FormatTok->is(tok::l_paren)) 2076 if (FormatTok->is(tok::identifier)) { 2080 if (Style.isCpp() && FormatTok->is(tok::identifier)) 2086 if (FormatTok->isNot(tok::l_brace)) 2088 FormatTok->BlockKind = BK_Block; 2104 if (FormatTok->is(tok::semi)) 2133 FormatTok = Tokens->setPosition(StoredPosition); 2149 while (FormatTok) { 2150 if (FormatTok->is(tok::l_brace)) { 2154 } else if (FormatTok->is(tok::l_paren)) { 2156 } else if (FormatTok->is(tok::comma)) { 2159 } else if (FormatTok->is(tok::semi)) { 2163 } else if (FormatTok->is(tok::r_brace)) { 2179 const FormatToken &InitialToken = *FormatTok; 2184 while (FormatTok->isOneOf(tok::identifier, tok::coloncolon, tok::hashhash, 2189 FormatTok->isOneOf(tok::period, tok::comma))) { 2191 FormatTok->isOneOf(Keywords.kw_extends, Keywords.kw_implements)) { 2196 if (FormatTok->is(tok::l_brace)) { 2202 FormatTok->is(tok::identifier) && 2203 FormatTok->TokenText != FormatTok->TokenText.upper(); 2203 FormatTok->TokenText != FormatTok->TokenText.upper(); 2206 if (!IsNonMacroIdentifier && FormatTok->Tok.is(tok::l_paren)) 2220 if (FormatTok->isOneOf(tok::colon, tok::less)) { 2222 if (FormatTok->is(tok::l_brace)) { 2227 if (FormatTok->Tok.is(tok::semi)) 2232 if (FormatTok->Tok.is(tok::l_brace)) { 2249 assert(FormatTok->Tok.isOneOf(tok::l_paren, tok::identifier) && 2252 if (FormatTok->Tok.is(tok::semi)) { 2256 } else if (FormatTok->Tok.is(tok::l_brace)) { 2269 assert(FormatTok->Tok.is(tok::less) && "'<' expected."); 2273 if (FormatTok->isOneOf(tok::semi, tok::l_brace) || 2274 FormatTok->Tok.isObjCAtKeyword(tok::objc_end)) 2276 } while (!eof() && FormatTok->Tok.isNot(tok::greater)); 2282 if (FormatTok->Tok.isObjCAtKeyword(tok::objc_end)) { 2287 if (FormatTok->is(tok::l_brace)) { 2291 } else if (FormatTok->is(tok::r_brace)) { 2295 } else if (FormatTok->isOneOf(tok::minus, tok::plus)) { 2305 assert(FormatTok->Tok.getObjCKeywordID() == tok::objc_interface || 2306 FormatTok->Tok.getObjCKeywordID() == tok::objc_implementation); 2312 if (FormatTok->Tok.is(tok::less)) { 2324 if (FormatTok->isOneOf(tok::semi, tok::l_brace) || 2325 FormatTok->Tok.isObjCAtKeyword(tok::objc_end)) 2327 if (FormatTok->Tok.is(tok::less)) 2329 else if (FormatTok->Tok.is(tok::greater)) { 2336 if (FormatTok->Tok.is(tok::colon)) { 2339 } else if (FormatTok->Tok.is(tok::l_paren)) 2343 if (FormatTok->Tok.is(tok::less)) 2346 if (FormatTok->Tok.is(tok::l_brace)) { 2362 assert(FormatTok->Tok.getObjCKeywordID() == tok::objc_protocol); 2365 if (FormatTok->is(tok::l_paren)) 2376 if (FormatTok->Tok.is(tok::less)) 2380 if (FormatTok->Tok.is(tok::semi)) { 2392 bool IsImport = FormatTok->is(Keywords.kw_import); 2393 assert(IsImport || FormatTok->is(tok::kw_export)); 2397 if (FormatTok->is(tok::kw_default)) 2403 if (FormatTok->is(Keywords.kw_async)) 2405 if (FormatTok->is(Keywords.kw_function)) { 2414 if (!IsImport && !FormatTok->isOneOf(tok::l_brace, tok::star) && 2415 !FormatTok->isStringLiteral()) 2419 if (FormatTok->is(tok::semi)) 2426 if (FormatTok->is(tok::l_brace)) { 2427 FormatTok->BlockKind = BK_Block; 2438 if (FormatTok->is(tok::l_paren)) 2440 if (FormatTok->is(tok::semi)) 2489 FormatTok->Previous = nullptr; 2492 bool UnwrappedLineParser::eof() const { return FormatTok->Tok.is(tok::eof); } 2634 flushComments(isOnNewLine(*FormatTok)); 2635 pushToken(FormatTok); 2636 FormatToken *Previous = FormatTok; 2641 FormatTok->Previous = Previous; 2702 FormatTok = Tokens->getNextToken(); 2703 assert(FormatTok); 2704 while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) && 2705 (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) { 2705 (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) { 2706 distributeComments(Comments, FormatTok); 2722 flushComments(isOnNewLine(*FormatTok)); 2725 while (FormatTok->Type == TT_ConflictStart || 2726 FormatTok->Type == TT_ConflictEnd || 2727 FormatTok->Type == TT_ConflictAlternative) { 2728 if (FormatTok->Type == TT_ConflictStart) { 2730 } else if (FormatTok->Type == TT_ConflictAlternative) { 2732 } else if (FormatTok->Type == TT_ConflictEnd) { 2735 FormatTok = Tokens->getNextToken(); 2736 FormatTok->MustBreakBefore = true; 2744 if (!FormatTok->Tok.is(tok::comment)) { 2745 distributeComments(Comments, FormatTok); 2750 Comments.push_back(FormatTok);