Lines Matching refs:Line

50   AnnotatingParser(const FormatStyle &Style, AnnotatedLine &Line,  in AnnotatingParser()  argument
52 : Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false), in AnnotatingParser()
130 !Line.startsWith(tok::kw_template)) in parseAngle()
170 (Line.startsWith(Keywords.kw_type, tok::identifier) || in parseParens()
171 Line.startsWith(tok::kw_export, Keywords.kw_type, in parseParens()
199 } else if (Line.InPPDirective && in parseParens()
214 } else if (!Line.MustBeDeclaration && !Line.InPPDirective) { in parseParens()
270 (CurrentToken->Next->is(tok::l_square) && Line.MustBeDeclaration))) in parseParens()
402 bool InsideInlineASM = Line.startsWith(tok::kw_asm); in parseSquare()
677 if (!Tok->Previous && Line.MustBeDeclaration) in consumeToken()
687 !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) || in consumeToken()
693 Line.MustBeDeclaration)) { // method/property declaration in consumeToken()
708 Line.startsWith(TT_ObjCMethodSpecifier)) { in consumeToken()
714 Line.startsWith(TT_ObjCMethodSpecifier) && in consumeToken()
740 !Line.First->isOneOf(tok::kw_enum, tok::kw_case)) { in consumeToken()
806 if (Line.MustBeDeclaration && Contexts.size() == 1 && in consumeToken()
807 !Contexts.back().IsExpression && !Line.startsWith(TT_ObjCProperty) && in consumeToken()
811 Line.MightBeFunctionDecl = true; in consumeToken()
894 if (Line.MustBeDeclaration && !Contexts.back().IsExpression && in consumeToken()
908 (Contexts.size() == 1 || Line.startsWith(tok::kw_for))) { in consumeToken()
910 Line.IsMultiVariableDeclStmt = true; in consumeToken()
1060 if (CurrentToken->is(tok::less) && Line.Last->is(tok::greater)) { in parseLine()
1067 if (Style.Language == FormatStyle::LK_Proto && Line.Level == 0 && in parseLine()
1092 if (Line.First->is(tok::kw_export) && in parseLine()
1107 if (Line.startsWith(TT_ObjCMethodSpecifier)) { in parseLine()
1205 !Line.First->isOneOf(tok::kw_template, tok::kw_using, tok::kw_return) && in modifyContext()
1209 (Line.startsWith(Keywords.kw_type, tok::identifier) || in modifyContext()
1210 Line.startsWith(tok::kw_export, Keywords.kw_type, in modifyContext()
1214 if (!Line.startsWith(TT_UnaryOperator)) { in modifyContext()
1252 if (Line.MustBeDeclaration && !Contexts.front().InCtorInitializer) in modifyContext()
1291 (!Line.MightBeFunctionDecl || Current.NestingLevel != 0)) { in determineTokenType()
1304 } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && in determineTokenType()
1322 Line.MustBeDeclaration && !Contexts.back().IsExpression) { in determineTokenType()
1405 Line.MightBeFunctionDecl && Contexts.size() == 1) { in determineTokenType()
1679 AnnotatedLine &Line; member in clang::format::__anon963563180111::AnnotatingParser
1699 AnnotatedLine &Line) in ExpressionParser() argument
1700 : Style(Style), Keywords(Keywords), Current(Line.First) {} in ExpressionParser()
1929 static unsigned maxNestingDepth(const AnnotatedLine &Line) { in maxNestingDepth() argument
1931 for (const auto *Tok = Line.First; Tok != nullptr; Tok = Tok->Next) in maxNestingDepth()
1936 void TokenAnnotator::annotate(AnnotatedLine &Line) { in annotate() argument
1937 for (SmallVectorImpl<AnnotatedLine *>::iterator I = Line.Children.begin(), in annotate()
1938 E = Line.Children.end(); in annotate()
1942 AnnotatingParser Parser(Style, Line, Keywords); in annotate()
1943 Line.Type = Parser.parseLine(); in annotate()
1949 if (maxNestingDepth(Line) > 50) in annotate()
1950 Line.Type = LT_Invalid; in annotate()
1952 if (Line.Type == LT_Invalid) in annotate()
1955 ExpressionParser ExprParser(Style, Keywords, Line); in annotate()
1958 if (Line.startsWith(TT_ObjCMethodSpecifier)) in annotate()
1959 Line.Type = LT_ObjCMethodDecl; in annotate()
1960 else if (Line.startsWith(TT_ObjCDecl)) in annotate()
1961 Line.Type = LT_ObjCDecl; in annotate()
1962 else if (Line.startsWith(TT_ObjCProperty)) in annotate()
1963 Line.Type = LT_ObjCProperty; in annotate()
1965 Line.First->SpacesRequiredBefore = 1; in annotate()
1966 Line.First->CanBreakBefore = Line.First->MustBreakBefore; in annotate()
1972 const AnnotatedLine &Line) { in isFunctionDeclarationName() argument
2026 if (Line.Last->is(tok::l_brace)) in isFunctionDeclarationName()
2050 bool TokenAnnotator::mustBreakForReturnType(const AnnotatedLine &Line) const { in mustBreakForReturnType()
2051 assert(Line.MightBeFunctionDecl); in mustBreakForReturnType()
2056 Line.Level > 0) in mustBreakForReturnType()
2067 return Line.mightBeFunctionDefinition(); in mustBreakForReturnType()
2073 void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { in calculateFormattingInformation() argument
2074 for (SmallVectorImpl<AnnotatedLine *>::iterator I = Line.Children.begin(), in calculateFormattingInformation()
2075 E = Line.Children.end(); in calculateFormattingInformation()
2080 Line.First->TotalLength = in calculateFormattingInformation()
2081 Line.First->IsMultiline ? Style.ColumnLimit in calculateFormattingInformation()
2082 : Line.FirstStartColumn + Line.First->ColumnWidth; in calculateFormattingInformation()
2083 FormatToken *Current = Line.First->Next; in calculateFormattingInformation()
2084 bool InFunctionDecl = Line.MightBeFunctionDecl; in calculateFormattingInformation()
2086 if (isFunctionDeclarationName(*Current, Line)) in calculateFormattingInformation()
2116 spaceRequiredBefore(Line, *Current)) { in calculateFormattingInformation()
2121 Current->MustBreakBefore || mustBreakBefore(Line, *Current); in calculateFormattingInformation()
2125 Current->MustBreakBefore = mustBreakForReturnType(Line); in calculateFormattingInformation()
2128 Current->MustBreakBefore || canBreakBefore(Line, *Current); in calculateFormattingInformation()
2157 Current->SplitPenalty = splitPenalty(Line, *Current, InFunctionDecl); in calculateFormattingInformation()
2169 calculateUnbreakableTailLengths(Line); in calculateFormattingInformation()
2170 unsigned IndentLevel = Line.Level; in calculateFormattingInformation()
2171 for (Current = Line.First; Current != nullptr; Current = Current->Next) { in calculateFormattingInformation()
2184 LLVM_DEBUG({ printDebugInfo(Line); }); in calculateFormattingInformation()
2187 void TokenAnnotator::calculateUnbreakableTailLengths(AnnotatedLine &Line) { in calculateUnbreakableTailLengths() argument
2189 FormatToken *Current = Line.Last; in calculateUnbreakableTailLengths()
2203 unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, in splitPenalty() argument
2250 if (Line.startsWith(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) in splitPenalty()
2307 if (Line.startsWith(TT_ObjCMethodSpecifier)) in splitPenalty()
2319 if (Line.startsWith(tok::kw_for) && Left.is(tok::equal)) in splitPenalty()
2327 return Line.MightBeFunctionDecl ? 50 : 500; in splitPenalty()
2332 if (Line.Type == LT_ObjCDecl && Left.is(tok::l_paren) && Left.Previous && in splitPenalty()
2394 bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, in spaceRequiredBetween() argument
2401 if (Style.ObjCSpaceAfterProperty && Line.Type == LT_ObjCProperty && in spaceRequiredBetween()
2417 if (Right.is(tok::less) && Line.Type == LT_ObjCDecl) { in spaceRequiredBetween()
2453 if (Left.is(tok::r_paren) && Line.MightBeFunctionDecl) { in spaceRequiredBetween()
2465 (Line.IsMultiVariableDeclStmt && in spaceRequiredBetween()
2467 (Left.NestingLevel == 1 && Line.First->is(tok::kw_for))))))); in spaceRequiredBetween()
2472 !Line.IsMultiVariableDeclStmt))) in spaceRequiredBetween()
2482 !Line.IsMultiVariableDeclStmt) && in spaceRequiredBetween()
2531 return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || in spaceRequiredBetween()
2543 Line.Type != LT_PreprocessorDirective); in spaceRequiredBetween()
2580 bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, in spaceRequiredBefore() argument
2648 if (Line.MustBeDeclaration && Left.Tok.getIdentifierInfo()) in spaceRequiredBefore()
2686 Line.First->isOneOf(Keywords.kw_import, tok::kw_export)) in spaceRequiredBefore()
2716 if (Line.Type == LT_ObjCMethodDecl) { in spaceRequiredBefore()
2725 if (Line.Type == LT_ObjCProperty && in spaceRequiredBefore()
2748 if (Line.First->isOneOf(tok::kw_case, tok::kw_default) || in spaceRequiredBefore()
2822 Line.startsWith(tok::hash)) in spaceRequiredBefore()
2828 return spaceRequiredBetween(Line, Left, Right); in spaceRequiredBefore()
2837 bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, in mustBreakBefore() argument
2848 if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2850 Line.First->isOneOf(tok::identifier, Keywords.kw_import, tok::kw_export, in mustBreakBefore()
2854 !Line.First->isOneOf(Keywords.kw_var, Keywords.kw_let)) in mustBreakBefore()
2858 if (Left.is(tok::l_brace) && Line.Level == 0 && in mustBreakBefore()
2859 (Line.startsWith(tok::kw_enum) || in mustBreakBefore()
2860 Line.startsWith(tok::kw_const, tok::kw_enum) || in mustBreakBefore()
2861 Line.startsWith(tok::kw_export, tok::kw_enum) || in mustBreakBefore()
2862 Line.startsWith(tok::kw_export, tok::kw_const, tok::kw_enum))) in mustBreakBefore()
2871 (Left.NestingLevel == 0 && Line.Level == 0 && in mustBreakBefore()
2891 if (Style.JavaScriptWrapImports || Line.Type != LT_ImportStatement) { in mustBreakBefore()
2954 return (Line.startsWith(tok::kw_enum) && Style.BraceWrapping.AfterEnum) || in mustBreakBefore()
2955 (Line.startsWith(tok::kw_typedef, tok::kw_enum) && in mustBreakBefore()
2957 (Line.startsWith(tok::kw_class) && Style.BraceWrapping.AfterClass) || in mustBreakBefore()
2958 (Line.startsWith(tok::kw_struct) && Style.BraceWrapping.AfterStruct); in mustBreakBefore()
2966 (Line.Last->is(tok::l_brace) || Style.BreakAfterJavaFieldAnnotations)) in mustBreakBefore()
3084 bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, in canBreakBefore() argument
3173 return Line.IsMultiVariableDeclStmt || in canBreakBefore()
3249 if (Left.is(tok::r_paren) && Line.Type == LT_ObjCProperty) in canBreakBefore()
3266 Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0) in canBreakBefore()
3354 void TokenAnnotator::printDebugInfo(const AnnotatedLine &Line) { in printDebugInfo() argument
3355 llvm::errs() << "AnnotatedTokens(L=" << Line.Level << "):\n"; in printDebugInfo()
3356 const FormatToken *Tok = Line.First; in printDebugInfo()
3372 assert(Tok == Line.Last); in printDebugInfo()