Lines Matching defs:Style

34 static bool shouldIndentWrappedSelectorName(const FormatStyle &Style,
36 return Style.IndentWrappedFunctionNames || LineType == LT_ObjCMethodDecl;
133 const FormatStyle &Style) {
136 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeComma) {
139 if (Style.Language == FormatStyle::LK_Proto && Current.is(TT_SelectorName))
143 Style.BreakConstructorInitializers !=
146 Style.BreakInheritanceList != FormatStyle::BILS_BeforeComma));
150 const FormatStyle &Style) {
153 return Style.Language == FormatStyle::LK_TextProto ||
154 (Style.Language == FormatStyle::LK_Proto &&
188 getCanonicalRawStringDelimiter(const FormatStyle &Style,
190 for (const auto &Format : Style.RawStringFormats)
235 ContinuationIndenter::ContinuationIndenter(const FormatStyle &Style,
241 : Style(Style), Keywords(Keywords), SourceMgr(SourceMgr),
244 CommentPragmasRegex(Style.CommentPragmas), RawStringFormats(Style) {}
259 if (Style.IndentPPDirectives == FormatStyle::PPDIS_AfterHash &&
276 if (Style.Language == FormatStyle::LK_TextProto) {
296 Current.closesBlockOrBlockTypeList(Style))) {
325 Style.LambdaBodyIndentation == FormatStyle::LBI_Signature) {
332 if (Style.BreakAfterReturnType == FormatStyle::RTBS_None &&
337 if (Style.BreakAfterReturnType == FormatStyle::RTBS_ExceptShortType) {
350 (!Style.BraceWrapping.BeforeLambdaBody ||
375 if (Style.BraceWrapping.BeforeLambdaBody && Current.CanBreakBefore &&
382 (Style.BreakBeforeInlineASMColon == FormatStyle::BBIAS_Always ||
383 (Style.BreakBeforeInlineASMColon == FormatStyle::BBIAS_OnlyMultiline &&
384 Style.ColumnLimit > 0)))) {
388 (Current.closesBlockOrBlockTypeList(Style) ||
390 Current.isBlockIndentedInitRBrace(Style)))) {
395 if (Style.Language == FormatStyle::LK_ObjC &&
396 Style.ObjCBreakBeforeNestedBlockParam &&
407 if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
409 State.Line->First->isNot(TT_AttributeSquare) && Style.isCpp() &&
414 (Previous.NestingLevel == 1 || Style.BinPackParameters)) ||
415 (Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
417 (!Style.BreakBeforeTernaryOperators &&
424 ((Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
426 (!Style.BreakBeforeTernaryOperators && Previous.is(TT_ConditionalExpr) &&
433 opensProtoMessageField(Previous, Style)) &&
434 Style.ColumnLimit > 0 &&
441 Style.BreakConstructorInitializers == FormatStyle::BCIS_AfterColon
449 (Style.AllowShortFunctionsOnASingleLine != FormatStyle::SFS_All ||
450 Style.BreakConstructorInitializers != FormatStyle::BCIS_BeforeColon ||
451 Style.ColumnLimit != 0)) {
461 (Style.ObjCBreakBeforeNestedBlockParam ||
467 if (Current.isMemberAccess() && Style.ColumnLimit != 0 &&
468 State.Column + getLengthToNextOperator(Current) > Style.ColumnLimit &&
482 !(State.Column <= NewLineColumn && Style.isJavaScript()) &&
497 if (Style.AlwaysBreakBeforeMultilineStrings &&
498 (NewLineColumn == State.FirstIndent + Style.ContinuationIndentWidth ||
554 switch (Style.BreakBeforeConceptDeclarations) {
564 switch (Style.RequiresClausePosition) {
572 return Style.BreakTemplateDeclarations != FormatStyle::BTDS_No &&
573 (Style.BreakTemplateDeclarations != FormatStyle::BTDS_Leave ||
586 if (Style.isJavaScript() && Previous.is(tok::r_paren) &&
599 (!Style.isCSharp() ||
600 Style.BreakAfterReturnType > FormatStyle::RTBS_ExceptShortType) &&
603 !Style.isJavaScript() && Previous.isNot(tok::kw_template) &&
611 if (Style.ColumnLimit != 0 && Previous.is(BK_Block) &&
680 Style.LambdaBodyIndentation == FormatStyle::LBI_Signature &&
681 Style.isCpp() && [&Current] {
742 if (Style.IndentPPDirectives == FormatStyle::PPDIS_AfterHash &&
753 if (Style.UseTab != FormatStyle::UT_Never)
765 if (Style.BreakInheritanceList == FormatStyle::BILS_BeforeComma &&
769 if (Style.BreakInheritanceList == FormatStyle::BILS_AfterColon &&
776 State.FirstIndent + Style.ContinuationIndentWidth, CurrentState.Indent);
793 Style.Cpp11BracedListStyle;
802 return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak;
806 if ((Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak ||
807 Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent) &&
827 if (Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign &&
838 if (CurrentState.AvoidBinPacking && startsNextParameter(Current, Style))
845 if (Current.is(TT_LambdaArrow) && Style.Language == FormatStyle::LK_Java)
874 Style.BreakBeforeBinaryOperators != FormatStyle::BOS_None) ||
875 (P->is(TT_ConditionalExpr) && Style.BreakBeforeTernaryOperators);
883 Style.AlignOperands != FormatStyle::OAS_DontAlign)) ||
904 Style.BreakConstructorInitializers ==
917 if (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None)
967 (State.Column <= Style.ColumnLimit / 3 ||
969 Penalty += Style.PenaltyBreakFirstLessLess;
988 Style.PenaltyIndentedWhitespace * (State.Column - State.FirstIndent);
1002 (!Style.isJavaScript() || Current.NestingLevel != 0 ||
1017 (shouldIndentWrappedSelectorName(Style, State.Line->Type)
1019 State.FirstIndent + Style.ContinuationIndentWidth)
1042 Style.ContinuationIndentWidth;
1066 unsigned MaxEmptyLinesToKeep = Style.MaxEmptyLinesToKeep + 1;
1099 (!Style.isCpp() && Current.is(tok::r_brace) && State.Stack.size() > 1 &&
1101 (Style.Language == FormatStyle::LK_ObjC && Current.is(tok::r_brace) &&
1102 State.Stack.size() > 1 && !Style.ObjCBreakBeforeNestedBlockParam);
1110 if (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
1154 (!Style.BraceWrapping.BeforeLambdaBody ||
1163 opensProtoMessageField(*PreviousNonComment, Style))) {
1169 Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent;
1179 Style.BreakConstructorInitializers == FormatStyle::BCIS_AfterColon;
1181 Style.PackConstructorInitializers == FormatStyle::PCIS_NextLine ||
1182 Style.PackConstructorInitializers == FormatStyle::PCIS_NextLineOnly;
1185 (!Style.AllowAllParametersOfDeclarationOnNextLine &&
1187 (!Style.AllowAllArgumentsOnNextLine &&
1223 Style.ContinuationIndentWidth;
1230 if (Style.Language == FormatStyle::LK_Java &&
1233 CurrentState.Indent + Style.ContinuationIndentWidth);
1238 if (Style.isVerilog() && PreviousNonComment &&
1243 if (Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths &&
1245 return (Style.IndentWidth * State.Line->First->IndentLevel) +
1246 Style.IndentWidth;
1250 (Style.isVerilog() && Keywords.isVerilogBegin(*NextNonComment))) {
1252 (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
1264 (Current.is(tok::greater) && (Style.isProto() || Style.isTableGen()))) &&
1266 if (Current.closesBlockOrBlockTypeList(Style))
1294 if (Style.isTableGen() && Current.is(TT_TableGenDAGArgCloser) &&
1298 if (Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent &&
1315 (!Style.isVerilog() || Current.Next->is(tok::colon)) &&
1317 (Style.isProto() && Current.Next->isOneOf(tok::less, tok::l_brace)))) {
1348 if (Style.AlignOperands != FormatStyle::OAS_DontAlign)
1349 Indent -= Style.ContinuationIndentWidth;
1350 if (Style.BreakBeforeTernaryOperators && CurrentState.UnindentOperator)
1359 if (Style.IndentRequiresClause)
1360 return CurrentState.Indent + Style.IndentWidth;
1361 switch (Style.RequiresClausePosition) {
1371 return State.FirstIndent + Style.ConstructorInitializerIndentWidth;
1381 (!Style.IndentWrappedFunctionNames &&
1388 if (shouldIndentWrappedSelectorName(Style, State.Line->Type)) {
1390 State.FirstIndent + Style.ContinuationIndentWidth);
1400 // In either case, we want to respect Style.IndentWrappedFunctionNames.
1417 } else if (Style.isCSharp()) { // C# allows `["key"] = value` inside object
1429 return CurrentState.Indent + Style.ContinuationIndentWidth;
1450 Style.BreakConstructorInitializers == FormatStyle::BCIS_AfterColon) {
1454 Style.BreakInheritanceList == FormatStyle::BILS_AfterColon) {
1478 return CurrentState.Indent + Style.ContinuationIndentWidth;
1485 const FormatStyle &Style) {
1492 return Style.BraceWrapping.BeforeLambdaBody && Current.is(TT_LambdaLSquare);
1535 if (Style.BreakBeforeTernaryOperators && Current.is(tok::question))
1537 if (!Style.BreakBeforeTernaryOperators && Current.isNot(tok::colon)) {
1554 Style.BreakConstructorInitializers != FormatStyle::BCIS_AfterColon) {
1560 CurrentState.Indent = State.Column + (Style.BreakConstructorInitializers ==
1565 if (Style.PackConstructorInitializers > FormatStyle::PCIS_BinPack) {
1568 Style.ColumnLimit > 0 &&
1569 Style.PackConstructorInitializers != FormatStyle::PCIS_NextLine &&
1570 Style.PackConstructorInitializers != FormatStyle::PCIS_NextLineOnly;
1576 Style.BreakConstructorInitializers == FormatStyle::BCIS_AfterColon) {
1578 State.FirstIndent + Style.ConstructorInitializerIndentWidth;
1580 if (Style.PackConstructorInitializers > FormatStyle::PCIS_BinPack)
1587 State.FirstIndent + Style.ConstructorInitializerIndentWidth;
1594 Style.RequiresExpressionIndentation == FormatStyle::REI_Keyword) {
1620 !Newline && hasNestedBlockInlined(Previous, Current, Style);
1652 if (Style.isVerilog() && State.NextToken &&
1655 State.FirstIndent += Style.IndentWidth;
1691 Style.AlignOperands != FormatStyle::OAS_DontAlign) ||
1713 (Style.AlignOperands != FormatStyle::OAS_DontAlign ||
1716 (Style.Language != FormatStyle::LK_Java && PrecedenceLevel > 0)) &&
1717 (Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign ||
1719 (!Style.isTableGen() ||
1732 Style.ContinuationIndentWidth;
1742 if (Style.AlignOperands == FormatStyle::OAS_AlignAfterOperator)
1745 if (Style.AlignOperands != FormatStyle::OAS_DontAlign)
1759 Style.AlignAfterOpenBracket != FormatStyle::BAS_DontAlign) {
1777 NewParenState.Indent += Style.ContinuationIndentWidth;
1797 if (State.NextToken->ClosesRequiresClause && Style.IndentRequiresClause) {
1800 State.Stack.back().LastSpace -= Style.IndentWidth;
1830 opensProtoMessageField(Current, Style)) {
1831 if (Current.opensBlockOrBlockTypeList(Style)) {
1832 NewIndent = Style.IndentWidth +
1836 CurrentState.LastSpace + Style.BracedInitializerIndentWidth.value_or(
1837 Style.ContinuationIndentWidth);
1839 NewIndent = CurrentState.LastSpace + Style.ContinuationIndentWidth;
1846 Style.isProto() || !Style.BinPackArguments ||
1855 Style.ContinuationIndentWidth +
1858 if (Style.isTableGen() && Current.is(TT_TableGenDAGArgOpenerToBreak) &&
1859 Style.TableGenBreakInsideDAGArg == FormatStyle::DAS_BreakElements) {
1886 (Style.ObjCBinPackProtocolList == FormatStyle::BPS_Auto &&
1887 Style.BinPackParameters) ||
1888 Style.ObjCBinPackProtocolList == FormatStyle::BPS_Always;
1891 (State.Line->Type != LT_ObjCDecl && Style.BinPackParameters) ||
1900 (Style.isJavaScript() && EndsInComma) ||
1902 (!State.Line->MustBeDeclaration && !Style.BinPackArguments) ||
1903 (Style.ExperimentalAutoDetectBinPacking &&
1908 Style.ObjCBreakBeforeNestedBlockParam) {
1909 if (Style.ColumnLimit) {
1930 if (Style.isJavaScript() && EndsInComma)
1949 if (Style.BraceWrapping.BeforeLambdaBody && Current.Next &&
2004 Style.ColumnLimit) {
2019 if (Style.LambdaBodyIndentation == FormatStyle::LBI_OuterScope &&
2028 ? Style.ObjCBlockIndentWidth
2029 : Style.IndentWidth);
2036 bool NoLineBreak = Style.BraceWrapping.BeforeLambdaBody && !NewLine &&
2065 getCanonicalRawStringDelimiter(Style, RawStringStyle.Language);
2126 ? CurrentIndent + Style.IndentWidth
2188 *NewCode, FirstStartColumn, Style.TabWidth, Encoding);
2194 StartColumn + NewPrefixSize > Style.ColumnLimit
2195 ? StartColumn + NewPrefixSize - Style.ColumnLimit
2204 return Fixes.second + PrefixExcessCharacters * Style.PenaltyExcessCharacter;
2219 return Style.PenaltyExcessCharacter * (ColumnsUsed - getColumnLimit(State));
2272 Penalty += Style.PenaltyExcessCharacter * ExcessCharacters;
2323 if (Style.isJson() || Style.isJavaScript() || !Style.BreakStringLiterals ||
2348 if (Style.isVerilog() && Current.Previous &&
2362 if (Style.isVerilog() || Style.Language == FormatStyle::LK_Java ||
2363 Style.isJavaScript() || Style.isCSharp()) {
2365 if (Style.isJavaScript() && Text.starts_with("'") &&
2368 } else if (Style.isCSharp() && Text.starts_with("@\"") &&
2379 UnbreakableTailLength, State.Line->InPPDirective, Encoding, Style);
2398 State.Line->InPPDirective, Encoding, Style);
2401 if (!Style.ReflowComments ||
2410 State.Line->InPPDirective, Encoding, Style, Whitespaces.useCRLF());
2422 if (!Style.ReflowComments ||
2428 Current, StartColumn, /*InPPDirective=*/false, Encoding, Style);
2445 ColumnLimit = Style.ColumnLimit;
2458 ? Style.PenaltyBreakString
2459 : Style.PenaltyBreakComment;
2518 Penalty += Style.PenaltyExcessCharacter *
2582 Style.PenaltyExcessCharacter;
2724 Style.PenaltyExcessCharacter;
2777 Penalty += Style.PenaltyExcessCharacter *
2819 return Style.ColumnLimit - (State.Line->InPPDirective ? 2 : 0);
2837 if (Style.ColumnLimit != 0 && Style.BreakStringLiterals &&
2839 Style.ColumnLimit) {