Lines Matching refs:FormatStyle
57 using clang::format::FormatStyle;
59 LLVM_YAML_IS_SEQUENCE_VECTOR(clang::format::FormatStyle::RawStringFormat)
64 struct ScalarEnumerationTraits<FormatStyle::BreakBeforeNoexceptSpecifierStyle> {
66 enumeration(IO &IO, FormatStyle::BreakBeforeNoexceptSpecifierStyle &Value) { in enumeration()
67 IO.enumCase(Value, "Never", FormatStyle::BBNSS_Never); in enumeration()
68 IO.enumCase(Value, "OnlyWithParen", FormatStyle::BBNSS_OnlyWithParen); in enumeration()
69 IO.enumCase(Value, "Always", FormatStyle::BBNSS_Always); in enumeration()
73 template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
74 static void enumInput(IO &IO, FormatStyle::AlignConsecutiveStyle &Value) { in enumInput()
76 FormatStyle::AlignConsecutiveStyle( in enumInput()
81 FormatStyle::AlignConsecutiveStyle( in enumInput()
86 FormatStyle::AlignConsecutiveStyle( in enumInput()
91 FormatStyle::AlignConsecutiveStyle( in enumInput()
96 FormatStyle::AlignConsecutiveStyle( in enumInput()
103 FormatStyle::AlignConsecutiveStyle( in enumInput()
108 FormatStyle::AlignConsecutiveStyle( in enumInput()
114 static void mapping(IO &IO, FormatStyle::AlignConsecutiveStyle &Value) { in mapping()
125 struct MappingTraits<FormatStyle::ShortCaseStatementsAlignmentStyle> {
127 FormatStyle::ShortCaseStatementsAlignmentStyle &Value) { in mapping()
136 struct ScalarEnumerationTraits<FormatStyle::AttributeBreakingStyle> {
137 static void enumeration(IO &IO, FormatStyle::AttributeBreakingStyle &Value) { in enumeration()
138 IO.enumCase(Value, "Always", FormatStyle::ABS_Always); in enumeration()
139 IO.enumCase(Value, "Leave", FormatStyle::ABS_Leave); in enumeration()
140 IO.enumCase(Value, "Never", FormatStyle::ABS_Never); in enumeration()
145 struct ScalarEnumerationTraits<FormatStyle::ArrayInitializerAlignmentStyle> {
147 FormatStyle::ArrayInitializerAlignmentStyle &Value) { in enumeration()
148 IO.enumCase(Value, "None", FormatStyle::AIAS_None); in enumeration()
149 IO.enumCase(Value, "Left", FormatStyle::AIAS_Left); in enumeration()
150 IO.enumCase(Value, "Right", FormatStyle::AIAS_Right); in enumeration()
154 template <> struct ScalarEnumerationTraits<FormatStyle::BinaryOperatorStyle> {
155 static void enumeration(IO &IO, FormatStyle::BinaryOperatorStyle &Value) { in enumeration()
156 IO.enumCase(Value, "All", FormatStyle::BOS_All); in enumeration()
157 IO.enumCase(Value, "true", FormatStyle::BOS_All); in enumeration()
158 IO.enumCase(Value, "None", FormatStyle::BOS_None); in enumeration()
159 IO.enumCase(Value, "false", FormatStyle::BOS_None); in enumeration()
160 IO.enumCase(Value, "NonAssignment", FormatStyle::BOS_NonAssignment); in enumeration()
164 template <> struct ScalarEnumerationTraits<FormatStyle::BinPackStyle> {
165 static void enumeration(IO &IO, FormatStyle::BinPackStyle &Value) { in enumeration()
166 IO.enumCase(Value, "Auto", FormatStyle::BPS_Auto); in enumeration()
167 IO.enumCase(Value, "Always", FormatStyle::BPS_Always); in enumeration()
168 IO.enumCase(Value, "Never", FormatStyle::BPS_Never); in enumeration()
173 struct ScalarEnumerationTraits<FormatStyle::BitFieldColonSpacingStyle> {
175 FormatStyle::BitFieldColonSpacingStyle &Value) { in enumeration()
176 IO.enumCase(Value, "Both", FormatStyle::BFCS_Both); in enumeration()
177 IO.enumCase(Value, "None", FormatStyle::BFCS_None); in enumeration()
178 IO.enumCase(Value, "Before", FormatStyle::BFCS_Before); in enumeration()
179 IO.enumCase(Value, "After", FormatStyle::BFCS_After); in enumeration()
183 template <> struct ScalarEnumerationTraits<FormatStyle::BraceBreakingStyle> {
184 static void enumeration(IO &IO, FormatStyle::BraceBreakingStyle &Value) { in enumeration()
185 IO.enumCase(Value, "Attach", FormatStyle::BS_Attach); in enumeration()
186 IO.enumCase(Value, "Linux", FormatStyle::BS_Linux); in enumeration()
187 IO.enumCase(Value, "Mozilla", FormatStyle::BS_Mozilla); in enumeration()
188 IO.enumCase(Value, "Stroustrup", FormatStyle::BS_Stroustrup); in enumeration()
189 IO.enumCase(Value, "Allman", FormatStyle::BS_Allman); in enumeration()
190 IO.enumCase(Value, "Whitesmiths", FormatStyle::BS_Whitesmiths); in enumeration()
191 IO.enumCase(Value, "GNU", FormatStyle::BS_GNU); in enumeration()
192 IO.enumCase(Value, "WebKit", FormatStyle::BS_WebKit); in enumeration()
193 IO.enumCase(Value, "Custom", FormatStyle::BS_Custom); in enumeration()
197 template <> struct MappingTraits<FormatStyle::BraceWrappingFlags> {
198 static void mapping(IO &IO, FormatStyle::BraceWrappingFlags &Wrapping) { in mapping()
220 template <> struct ScalarEnumerationTraits<FormatStyle::BracketAlignmentStyle> {
221 static void enumeration(IO &IO, FormatStyle::BracketAlignmentStyle &Value) { in enumeration()
222 IO.enumCase(Value, "Align", FormatStyle::BAS_Align); in enumeration()
223 IO.enumCase(Value, "DontAlign", FormatStyle::BAS_DontAlign); in enumeration()
224 IO.enumCase(Value, "AlwaysBreak", FormatStyle::BAS_AlwaysBreak); in enumeration()
225 IO.enumCase(Value, "BlockIndent", FormatStyle::BAS_BlockIndent); in enumeration()
228 IO.enumCase(Value, "true", FormatStyle::BAS_Align); in enumeration()
229 IO.enumCase(Value, "false", FormatStyle::BAS_DontAlign); in enumeration()
235 FormatStyle::BraceWrappingAfterControlStatementStyle> {
238 FormatStyle::BraceWrappingAfterControlStatementStyle &Value) { in enumeration()
239 IO.enumCase(Value, "Never", FormatStyle::BWACS_Never); in enumeration()
240 IO.enumCase(Value, "MultiLine", FormatStyle::BWACS_MultiLine); in enumeration()
241 IO.enumCase(Value, "Always", FormatStyle::BWACS_Always); in enumeration()
244 IO.enumCase(Value, "false", FormatStyle::BWACS_Never); in enumeration()
245 IO.enumCase(Value, "true", FormatStyle::BWACS_Always); in enumeration()
251 FormatStyle::BreakBeforeConceptDeclarationsStyle> {
253 enumeration(IO &IO, FormatStyle::BreakBeforeConceptDeclarationsStyle &Value) { in enumeration()
254 IO.enumCase(Value, "Never", FormatStyle::BBCDS_Never); in enumeration()
255 IO.enumCase(Value, "Allowed", FormatStyle::BBCDS_Allowed); in enumeration()
256 IO.enumCase(Value, "Always", FormatStyle::BBCDS_Always); in enumeration()
259 IO.enumCase(Value, "true", FormatStyle::BBCDS_Always); in enumeration()
260 IO.enumCase(Value, "false", FormatStyle::BBCDS_Allowed); in enumeration()
265 struct ScalarEnumerationTraits<FormatStyle::BreakBeforeInlineASMColonStyle> {
267 FormatStyle::BreakBeforeInlineASMColonStyle &Value) { in enumeration()
268 IO.enumCase(Value, "Never", FormatStyle::BBIAS_Never); in enumeration()
269 IO.enumCase(Value, "OnlyMultiline", FormatStyle::BBIAS_OnlyMultiline); in enumeration()
270 IO.enumCase(Value, "Always", FormatStyle::BBIAS_Always); in enumeration()
275 struct ScalarEnumerationTraits<FormatStyle::BreakConstructorInitializersStyle> {
277 enumeration(IO &IO, FormatStyle::BreakConstructorInitializersStyle &Value) { in enumeration()
278 IO.enumCase(Value, "BeforeColon", FormatStyle::BCIS_BeforeColon); in enumeration()
279 IO.enumCase(Value, "BeforeComma", FormatStyle::BCIS_BeforeComma); in enumeration()
280 IO.enumCase(Value, "AfterColon", FormatStyle::BCIS_AfterColon); in enumeration()
285 struct ScalarEnumerationTraits<FormatStyle::BreakInheritanceListStyle> {
287 FormatStyle::BreakInheritanceListStyle &Value) { in enumeration()
288 IO.enumCase(Value, "BeforeColon", FormatStyle::BILS_BeforeColon); in enumeration()
289 IO.enumCase(Value, "BeforeComma", FormatStyle::BILS_BeforeComma); in enumeration()
290 IO.enumCase(Value, "AfterColon", FormatStyle::BILS_AfterColon); in enumeration()
291 IO.enumCase(Value, "AfterComma", FormatStyle::BILS_AfterComma); in enumeration()
296 struct ScalarEnumerationTraits<FormatStyle::BreakTemplateDeclarationsStyle> {
298 FormatStyle::BreakTemplateDeclarationsStyle &Value) { in enumeration()
299 IO.enumCase(Value, "No", FormatStyle::BTDS_No); in enumeration()
300 IO.enumCase(Value, "MultiLine", FormatStyle::BTDS_MultiLine); in enumeration()
301 IO.enumCase(Value, "Yes", FormatStyle::BTDS_Yes); in enumeration()
304 IO.enumCase(Value, "false", FormatStyle::BTDS_MultiLine); in enumeration()
305 IO.enumCase(Value, "true", FormatStyle::BTDS_Yes); in enumeration()
310 struct ScalarEnumerationTraits<FormatStyle::DefinitionReturnTypeBreakingStyle> {
312 enumeration(IO &IO, FormatStyle::DefinitionReturnTypeBreakingStyle &Value) { in enumeration()
313 IO.enumCase(Value, "None", FormatStyle::DRTBS_None); in enumeration()
314 IO.enumCase(Value, "All", FormatStyle::DRTBS_All); in enumeration()
315 IO.enumCase(Value, "TopLevel", FormatStyle::DRTBS_TopLevel); in enumeration()
318 IO.enumCase(Value, "false", FormatStyle::DRTBS_None); in enumeration()
319 IO.enumCase(Value, "true", FormatStyle::DRTBS_All); in enumeration()
324 struct ScalarEnumerationTraits<FormatStyle::EscapedNewlineAlignmentStyle> {
326 FormatStyle::EscapedNewlineAlignmentStyle &Value) { in enumeration()
327 IO.enumCase(Value, "DontAlign", FormatStyle::ENAS_DontAlign); in enumeration()
328 IO.enumCase(Value, "Left", FormatStyle::ENAS_Left); in enumeration()
329 IO.enumCase(Value, "Right", FormatStyle::ENAS_Right); in enumeration()
332 IO.enumCase(Value, "true", FormatStyle::ENAS_Left); in enumeration()
333 IO.enumCase(Value, "false", FormatStyle::ENAS_Right); in enumeration()
338 struct ScalarEnumerationTraits<FormatStyle::EmptyLineAfterAccessModifierStyle> {
340 enumeration(IO &IO, FormatStyle::EmptyLineAfterAccessModifierStyle &Value) { in enumeration()
341 IO.enumCase(Value, "Never", FormatStyle::ELAAMS_Never); in enumeration()
342 IO.enumCase(Value, "Leave", FormatStyle::ELAAMS_Leave); in enumeration()
343 IO.enumCase(Value, "Always", FormatStyle::ELAAMS_Always); in enumeration()
349 FormatStyle::EmptyLineBeforeAccessModifierStyle> {
351 enumeration(IO &IO, FormatStyle::EmptyLineBeforeAccessModifierStyle &Value) { in enumeration()
352 IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never); in enumeration()
353 IO.enumCase(Value, "Leave", FormatStyle::ELBAMS_Leave); in enumeration()
354 IO.enumCase(Value, "LogicalBlock", FormatStyle::ELBAMS_LogicalBlock); in enumeration()
355 IO.enumCase(Value, "Always", FormatStyle::ELBAMS_Always); in enumeration()
360 struct ScalarEnumerationTraits<FormatStyle::IndentExternBlockStyle> {
361 static void enumeration(IO &IO, FormatStyle::IndentExternBlockStyle &Value) { in enumeration()
362 IO.enumCase(Value, "AfterExternBlock", FormatStyle::IEBS_AfterExternBlock); in enumeration()
363 IO.enumCase(Value, "Indent", FormatStyle::IEBS_Indent); in enumeration()
364 IO.enumCase(Value, "NoIndent", FormatStyle::IEBS_NoIndent); in enumeration()
365 IO.enumCase(Value, "true", FormatStyle::IEBS_Indent); in enumeration()
366 IO.enumCase(Value, "false", FormatStyle::IEBS_NoIndent); in enumeration()
370 template <> struct MappingTraits<FormatStyle::IntegerLiteralSeparatorStyle> {
371 static void mapping(IO &IO, FormatStyle::IntegerLiteralSeparatorStyle &Base) { in mapping()
381 template <> struct ScalarEnumerationTraits<FormatStyle::JavaScriptQuoteStyle> {
382 static void enumeration(IO &IO, FormatStyle::JavaScriptQuoteStyle &Value) { in enumeration()
383 IO.enumCase(Value, "Leave", FormatStyle::JSQS_Leave); in enumeration()
384 IO.enumCase(Value, "Single", FormatStyle::JSQS_Single); in enumeration()
385 IO.enumCase(Value, "Double", FormatStyle::JSQS_Double); in enumeration()
389 template <> struct ScalarEnumerationTraits<FormatStyle::LanguageKind> {
390 static void enumeration(IO &IO, FormatStyle::LanguageKind &Value) { in enumeration()
391 IO.enumCase(Value, "Cpp", FormatStyle::LK_Cpp); in enumeration()
392 IO.enumCase(Value, "Java", FormatStyle::LK_Java); in enumeration()
393 IO.enumCase(Value, "JavaScript", FormatStyle::LK_JavaScript); in enumeration()
394 IO.enumCase(Value, "ObjC", FormatStyle::LK_ObjC); in enumeration()
395 IO.enumCase(Value, "Proto", FormatStyle::LK_Proto); in enumeration()
396 IO.enumCase(Value, "TableGen", FormatStyle::LK_TableGen); in enumeration()
397 IO.enumCase(Value, "TextProto", FormatStyle::LK_TextProto); in enumeration()
398 IO.enumCase(Value, "CSharp", FormatStyle::LK_CSharp); in enumeration()
399 IO.enumCase(Value, "Json", FormatStyle::LK_Json); in enumeration()
400 IO.enumCase(Value, "Verilog", FormatStyle::LK_Verilog); in enumeration()
404 template <> struct ScalarEnumerationTraits<FormatStyle::LanguageStandard> {
405 static void enumeration(IO &IO, FormatStyle::LanguageStandard &Value) { in enumeration()
406 IO.enumCase(Value, "c++03", FormatStyle::LS_Cpp03); in enumeration()
407 IO.enumCase(Value, "C++03", FormatStyle::LS_Cpp03); // Legacy alias in enumeration()
408 IO.enumCase(Value, "Cpp03", FormatStyle::LS_Cpp03); // Legacy alias in enumeration()
410 IO.enumCase(Value, "c++11", FormatStyle::LS_Cpp11); in enumeration()
411 IO.enumCase(Value, "C++11", FormatStyle::LS_Cpp11); // Legacy alias in enumeration()
413 IO.enumCase(Value, "c++14", FormatStyle::LS_Cpp14); in enumeration()
414 IO.enumCase(Value, "c++17", FormatStyle::LS_Cpp17); in enumeration()
415 IO.enumCase(Value, "c++20", FormatStyle::LS_Cpp20); in enumeration()
417 IO.enumCase(Value, "Latest", FormatStyle::LS_Latest); in enumeration()
418 IO.enumCase(Value, "Cpp11", FormatStyle::LS_Latest); // Legacy alias in enumeration()
419 IO.enumCase(Value, "Auto", FormatStyle::LS_Auto); in enumeration()
424 struct ScalarEnumerationTraits<FormatStyle::LambdaBodyIndentationKind> {
426 FormatStyle::LambdaBodyIndentationKind &Value) { in enumeration()
427 IO.enumCase(Value, "Signature", FormatStyle::LBI_Signature); in enumeration()
428 IO.enumCase(Value, "OuterScope", FormatStyle::LBI_OuterScope); in enumeration()
432 template <> struct ScalarEnumerationTraits<FormatStyle::LineEndingStyle> {
433 static void enumeration(IO &IO, FormatStyle::LineEndingStyle &Value) { in enumeration()
434 IO.enumCase(Value, "LF", FormatStyle::LE_LF); in enumeration()
435 IO.enumCase(Value, "CRLF", FormatStyle::LE_CRLF); in enumeration()
436 IO.enumCase(Value, "DeriveLF", FormatStyle::LE_DeriveLF); in enumeration()
437 IO.enumCase(Value, "DeriveCRLF", FormatStyle::LE_DeriveCRLF); in enumeration()
442 struct ScalarEnumerationTraits<FormatStyle::NamespaceIndentationKind> {
444 FormatStyle::NamespaceIndentationKind &Value) { in enumeration()
445 IO.enumCase(Value, "None", FormatStyle::NI_None); in enumeration()
446 IO.enumCase(Value, "Inner", FormatStyle::NI_Inner); in enumeration()
447 IO.enumCase(Value, "All", FormatStyle::NI_All); in enumeration()
451 template <> struct ScalarEnumerationTraits<FormatStyle::OperandAlignmentStyle> {
452 static void enumeration(IO &IO, FormatStyle::OperandAlignmentStyle &Value) { in enumeration()
453 IO.enumCase(Value, "DontAlign", FormatStyle::OAS_DontAlign); in enumeration()
454 IO.enumCase(Value, "Align", FormatStyle::OAS_Align); in enumeration()
456 FormatStyle::OAS_AlignAfterOperator); in enumeration()
459 IO.enumCase(Value, "true", FormatStyle::OAS_Align); in enumeration()
460 IO.enumCase(Value, "false", FormatStyle::OAS_DontAlign); in enumeration()
465 struct ScalarEnumerationTraits<FormatStyle::PackConstructorInitializersStyle> {
467 enumeration(IO &IO, FormatStyle::PackConstructorInitializersStyle &Value) { in enumeration()
468 IO.enumCase(Value, "Never", FormatStyle::PCIS_Never); in enumeration()
469 IO.enumCase(Value, "BinPack", FormatStyle::PCIS_BinPack); in enumeration()
470 IO.enumCase(Value, "CurrentLine", FormatStyle::PCIS_CurrentLine); in enumeration()
471 IO.enumCase(Value, "NextLine", FormatStyle::PCIS_NextLine); in enumeration()
472 IO.enumCase(Value, "NextLineOnly", FormatStyle::PCIS_NextLineOnly); in enumeration()
476 template <> struct ScalarEnumerationTraits<FormatStyle::PointerAlignmentStyle> {
477 static void enumeration(IO &IO, FormatStyle::PointerAlignmentStyle &Value) { in enumeration()
478 IO.enumCase(Value, "Middle", FormatStyle::PAS_Middle); in enumeration()
479 IO.enumCase(Value, "Left", FormatStyle::PAS_Left); in enumeration()
480 IO.enumCase(Value, "Right", FormatStyle::PAS_Right); in enumeration()
483 IO.enumCase(Value, "true", FormatStyle::PAS_Left); in enumeration()
484 IO.enumCase(Value, "false", FormatStyle::PAS_Right); in enumeration()
489 struct ScalarEnumerationTraits<FormatStyle::PPDirectiveIndentStyle> {
490 static void enumeration(IO &IO, FormatStyle::PPDirectiveIndentStyle &Value) { in enumeration()
491 IO.enumCase(Value, "None", FormatStyle::PPDIS_None); in enumeration()
492 IO.enumCase(Value, "AfterHash", FormatStyle::PPDIS_AfterHash); in enumeration()
493 IO.enumCase(Value, "BeforeHash", FormatStyle::PPDIS_BeforeHash); in enumeration()
498 struct ScalarEnumerationTraits<FormatStyle::QualifierAlignmentStyle> {
499 static void enumeration(IO &IO, FormatStyle::QualifierAlignmentStyle &Value) { in enumeration()
500 IO.enumCase(Value, "Leave", FormatStyle::QAS_Leave); in enumeration()
501 IO.enumCase(Value, "Left", FormatStyle::QAS_Left); in enumeration()
502 IO.enumCase(Value, "Right", FormatStyle::QAS_Right); in enumeration()
503 IO.enumCase(Value, "Custom", FormatStyle::QAS_Custom); in enumeration()
507 template <> struct MappingTraits<FormatStyle::RawStringFormat> {
508 static void mapping(IO &IO, FormatStyle::RawStringFormat &Format) { in mapping()
518 struct ScalarEnumerationTraits<FormatStyle::ReferenceAlignmentStyle> {
519 static void enumeration(IO &IO, FormatStyle::ReferenceAlignmentStyle &Value) { in enumeration()
520 IO.enumCase(Value, "Pointer", FormatStyle::RAS_Pointer); in enumeration()
521 IO.enumCase(Value, "Middle", FormatStyle::RAS_Middle); in enumeration()
522 IO.enumCase(Value, "Left", FormatStyle::RAS_Left); in enumeration()
523 IO.enumCase(Value, "Right", FormatStyle::RAS_Right); in enumeration()
528 struct ScalarEnumerationTraits<FormatStyle::RemoveParenthesesStyle> {
529 static void enumeration(IO &IO, FormatStyle::RemoveParenthesesStyle &Value) { in enumeration()
530 IO.enumCase(Value, "Leave", FormatStyle::RPS_Leave); in enumeration()
532 FormatStyle::RPS_MultipleParentheses); in enumeration()
533 IO.enumCase(Value, "ReturnStatement", FormatStyle::RPS_ReturnStatement); in enumeration()
538 struct ScalarEnumerationTraits<FormatStyle::RequiresClausePositionStyle> {
540 FormatStyle::RequiresClausePositionStyle &Value) { in enumeration()
541 IO.enumCase(Value, "OwnLine", FormatStyle::RCPS_OwnLine); in enumeration()
542 IO.enumCase(Value, "WithPreceding", FormatStyle::RCPS_WithPreceding); in enumeration()
543 IO.enumCase(Value, "WithFollowing", FormatStyle::RCPS_WithFollowing); in enumeration()
544 IO.enumCase(Value, "SingleLine", FormatStyle::RCPS_SingleLine); in enumeration()
549 struct ScalarEnumerationTraits<FormatStyle::RequiresExpressionIndentationKind> {
551 enumeration(IO &IO, FormatStyle::RequiresExpressionIndentationKind &Value) { in enumeration()
552 IO.enumCase(Value, "Keyword", FormatStyle::REI_Keyword); in enumeration()
553 IO.enumCase(Value, "OuterScope", FormatStyle::REI_OuterScope); in enumeration()
558 struct ScalarEnumerationTraits<FormatStyle::ReturnTypeBreakingStyle> {
559 static void enumeration(IO &IO, FormatStyle::ReturnTypeBreakingStyle &Value) { in enumeration()
560 IO.enumCase(Value, "None", FormatStyle::RTBS_None); in enumeration()
561 IO.enumCase(Value, "All", FormatStyle::RTBS_All); in enumeration()
562 IO.enumCase(Value, "TopLevel", FormatStyle::RTBS_TopLevel); in enumeration()
564 FormatStyle::RTBS_TopLevelDefinitions); in enumeration()
565 IO.enumCase(Value, "AllDefinitions", FormatStyle::RTBS_AllDefinitions); in enumeration()
570 struct ScalarEnumerationTraits<FormatStyle::SeparateDefinitionStyle> {
571 static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value) { in enumeration()
572 IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave); in enumeration()
573 IO.enumCase(Value, "Always", FormatStyle::SDS_Always); in enumeration()
574 IO.enumCase(Value, "Never", FormatStyle::SDS_Never); in enumeration()
578 template <> struct ScalarEnumerationTraits<FormatStyle::ShortBlockStyle> {
579 static void enumeration(IO &IO, FormatStyle::ShortBlockStyle &Value) { in enumeration()
580 IO.enumCase(Value, "Never", FormatStyle::SBS_Never); in enumeration()
581 IO.enumCase(Value, "false", FormatStyle::SBS_Never); in enumeration()
582 IO.enumCase(Value, "Always", FormatStyle::SBS_Always); in enumeration()
583 IO.enumCase(Value, "true", FormatStyle::SBS_Always); in enumeration()
584 IO.enumCase(Value, "Empty", FormatStyle::SBS_Empty); in enumeration()
588 template <> struct ScalarEnumerationTraits<FormatStyle::ShortFunctionStyle> {
589 static void enumeration(IO &IO, FormatStyle::ShortFunctionStyle &Value) { in enumeration()
590 IO.enumCase(Value, "None", FormatStyle::SFS_None); in enumeration()
591 IO.enumCase(Value, "false", FormatStyle::SFS_None); in enumeration()
592 IO.enumCase(Value, "All", FormatStyle::SFS_All); in enumeration()
593 IO.enumCase(Value, "true", FormatStyle::SFS_All); in enumeration()
594 IO.enumCase(Value, "Inline", FormatStyle::SFS_Inline); in enumeration()
595 IO.enumCase(Value, "InlineOnly", FormatStyle::SFS_InlineOnly); in enumeration()
596 IO.enumCase(Value, "Empty", FormatStyle::SFS_Empty); in enumeration()
600 template <> struct ScalarEnumerationTraits<FormatStyle::ShortIfStyle> {
601 static void enumeration(IO &IO, FormatStyle::ShortIfStyle &Value) { in enumeration()
602 IO.enumCase(Value, "Never", FormatStyle::SIS_Never); in enumeration()
603 IO.enumCase(Value, "WithoutElse", FormatStyle::SIS_WithoutElse); in enumeration()
604 IO.enumCase(Value, "OnlyFirstIf", FormatStyle::SIS_OnlyFirstIf); in enumeration()
605 IO.enumCase(Value, "AllIfsAndElse", FormatStyle::SIS_AllIfsAndElse); in enumeration()
608 IO.enumCase(Value, "Always", FormatStyle::SIS_OnlyFirstIf); in enumeration()
609 IO.enumCase(Value, "false", FormatStyle::SIS_Never); in enumeration()
610 IO.enumCase(Value, "true", FormatStyle::SIS_WithoutElse); in enumeration()
614 template <> struct ScalarEnumerationTraits<FormatStyle::ShortLambdaStyle> {
615 static void enumeration(IO &IO, FormatStyle::ShortLambdaStyle &Value) { in enumeration()
616 IO.enumCase(Value, "None", FormatStyle::SLS_None); in enumeration()
617 IO.enumCase(Value, "false", FormatStyle::SLS_None); in enumeration()
618 IO.enumCase(Value, "Empty", FormatStyle::SLS_Empty); in enumeration()
619 IO.enumCase(Value, "Inline", FormatStyle::SLS_Inline); in enumeration()
620 IO.enumCase(Value, "All", FormatStyle::SLS_All); in enumeration()
621 IO.enumCase(Value, "true", FormatStyle::SLS_All); in enumeration()
625 template <> struct ScalarEnumerationTraits<FormatStyle::SortIncludesOptions> {
626 static void enumeration(IO &IO, FormatStyle::SortIncludesOptions &Value) { in enumeration()
627 IO.enumCase(Value, "Never", FormatStyle::SI_Never); in enumeration()
628 IO.enumCase(Value, "CaseInsensitive", FormatStyle::SI_CaseInsensitive); in enumeration()
629 IO.enumCase(Value, "CaseSensitive", FormatStyle::SI_CaseSensitive); in enumeration()
632 IO.enumCase(Value, "false", FormatStyle::SI_Never); in enumeration()
633 IO.enumCase(Value, "true", FormatStyle::SI_CaseSensitive); in enumeration()
638 struct ScalarEnumerationTraits<FormatStyle::SortJavaStaticImportOptions> {
640 FormatStyle::SortJavaStaticImportOptions &Value) { in enumeration()
641 IO.enumCase(Value, "Before", FormatStyle::SJSIO_Before); in enumeration()
642 IO.enumCase(Value, "After", FormatStyle::SJSIO_After); in enumeration()
647 struct ScalarEnumerationTraits<FormatStyle::SortUsingDeclarationsOptions> {
649 FormatStyle::SortUsingDeclarationsOptions &Value) { in enumeration()
650 IO.enumCase(Value, "Never", FormatStyle::SUD_Never); in enumeration()
651 IO.enumCase(Value, "Lexicographic", FormatStyle::SUD_Lexicographic); in enumeration()
653 FormatStyle::SUD_LexicographicNumeric); in enumeration()
656 IO.enumCase(Value, "false", FormatStyle::SUD_Never); in enumeration()
657 IO.enumCase(Value, "true", FormatStyle::SUD_LexicographicNumeric); in enumeration()
662 struct ScalarEnumerationTraits<FormatStyle::SpaceAroundPointerQualifiersStyle> {
664 enumeration(IO &IO, FormatStyle::SpaceAroundPointerQualifiersStyle &Value) { in enumeration()
665 IO.enumCase(Value, "Default", FormatStyle::SAPQ_Default); in enumeration()
666 IO.enumCase(Value, "Before", FormatStyle::SAPQ_Before); in enumeration()
667 IO.enumCase(Value, "After", FormatStyle::SAPQ_After); in enumeration()
668 IO.enumCase(Value, "Both", FormatStyle::SAPQ_Both); in enumeration()
672 template <> struct MappingTraits<FormatStyle::SpaceBeforeParensCustom> {
673 static void mapping(IO &IO, FormatStyle::SpaceBeforeParensCustom &Spacing) { in mapping()
692 struct ScalarEnumerationTraits<FormatStyle::SpaceBeforeParensStyle> {
693 static void enumeration(IO &IO, FormatStyle::SpaceBeforeParensStyle &Value) { in enumeration()
694 IO.enumCase(Value, "Never", FormatStyle::SBPO_Never); in enumeration()
696 FormatStyle::SBPO_ControlStatements); in enumeration()
698 FormatStyle::SBPO_ControlStatementsExceptControlMacros); in enumeration()
700 FormatStyle::SBPO_NonEmptyParentheses); in enumeration()
701 IO.enumCase(Value, "Always", FormatStyle::SBPO_Always); in enumeration()
702 IO.enumCase(Value, "Custom", FormatStyle::SBPO_Custom); in enumeration()
705 IO.enumCase(Value, "false", FormatStyle::SBPO_Never); in enumeration()
706 IO.enumCase(Value, "true", FormatStyle::SBPO_ControlStatements); in enumeration()
708 FormatStyle::SBPO_ControlStatementsExceptControlMacros); in enumeration()
712 template <> struct ScalarEnumerationTraits<FormatStyle::SpacesInAnglesStyle> {
713 static void enumeration(IO &IO, FormatStyle::SpacesInAnglesStyle &Value) { in enumeration()
714 IO.enumCase(Value, "Never", FormatStyle::SIAS_Never); in enumeration()
715 IO.enumCase(Value, "Always", FormatStyle::SIAS_Always); in enumeration()
716 IO.enumCase(Value, "Leave", FormatStyle::SIAS_Leave); in enumeration()
719 IO.enumCase(Value, "false", FormatStyle::SIAS_Never); in enumeration()
720 IO.enumCase(Value, "true", FormatStyle::SIAS_Always); in enumeration()
724 template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
725 static void mapping(IO &IO, FormatStyle::SpacesInLineComment &Space) { in mapping()
737 template <> struct MappingTraits<FormatStyle::SpacesInParensCustom> {
738 static void mapping(IO &IO, FormatStyle::SpacesInParensCustom &Spaces) { in mapping()
746 template <> struct ScalarEnumerationTraits<FormatStyle::SpacesInParensStyle> {
747 static void enumeration(IO &IO, FormatStyle::SpacesInParensStyle &Value) { in enumeration()
748 IO.enumCase(Value, "Never", FormatStyle::SIPO_Never); in enumeration()
749 IO.enumCase(Value, "Custom", FormatStyle::SIPO_Custom); in enumeration()
753 template <> struct ScalarEnumerationTraits<FormatStyle::TrailingCommaStyle> {
754 static void enumeration(IO &IO, FormatStyle::TrailingCommaStyle &Value) { in enumeration()
755 IO.enumCase(Value, "None", FormatStyle::TCS_None); in enumeration()
756 IO.enumCase(Value, "Wrapped", FormatStyle::TCS_Wrapped); in enumeration()
761 struct ScalarEnumerationTraits<FormatStyle::TrailingCommentsAlignmentKinds> {
763 FormatStyle::TrailingCommentsAlignmentKinds &Value) { in enumeration()
764 IO.enumCase(Value, "Leave", FormatStyle::TCAS_Leave); in enumeration()
765 IO.enumCase(Value, "Always", FormatStyle::TCAS_Always); in enumeration()
766 IO.enumCase(Value, "Never", FormatStyle::TCAS_Never); in enumeration()
770 template <> struct MappingTraits<FormatStyle::TrailingCommentsAlignmentStyle> {
772 FormatStyle::TrailingCommentsAlignmentStyle &Value) { in enumInput()
774 FormatStyle::TrailingCommentsAlignmentStyle( in enumInput()
775 {FormatStyle::TCAS_Leave, 0})); in enumInput()
778 FormatStyle::TrailingCommentsAlignmentStyle( in enumInput()
779 {FormatStyle::TCAS_Always, 0})); in enumInput()
782 FormatStyle::TrailingCommentsAlignmentStyle( in enumInput()
783 {FormatStyle::TCAS_Never, 0})); in enumInput()
787 FormatStyle::TrailingCommentsAlignmentStyle( in enumInput()
788 {FormatStyle::TCAS_Always, 0})); in enumInput()
790 FormatStyle::TrailingCommentsAlignmentStyle( in enumInput()
791 {FormatStyle::TCAS_Never, 0})); in enumInput()
795 FormatStyle::TrailingCommentsAlignmentStyle &Value) { in mapping()
801 template <> struct ScalarEnumerationTraits<FormatStyle::UseTabStyle> {
802 static void enumeration(IO &IO, FormatStyle::UseTabStyle &Value) { in enumeration()
803 IO.enumCase(Value, "Never", FormatStyle::UT_Never); in enumeration()
804 IO.enumCase(Value, "false", FormatStyle::UT_Never); in enumeration()
805 IO.enumCase(Value, "Always", FormatStyle::UT_Always); in enumeration()
806 IO.enumCase(Value, "true", FormatStyle::UT_Always); in enumeration()
807 IO.enumCase(Value, "ForIndentation", FormatStyle::UT_ForIndentation); in enumeration()
809 FormatStyle::UT_ForContinuationAndIndentation); in enumeration()
810 IO.enumCase(Value, "AlignWithSpaces", FormatStyle::UT_AlignWithSpaces); in enumeration()
814 template <> struct MappingTraits<FormatStyle> {
815 static void mapping(IO &IO, FormatStyle &Style) { in mapping()
824 FormatStyle PredefinedStyle; in mapping()
835 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
836 FormatStyle::LanguageKind Language = in mapping()
837 ((FormatStyle *)IO.getContext())->Language; in mapping()
1055 if (Style.QualifierAlignment == FormatStyle::QAS_Right) in mapping()
1057 else if (Style.QualifierAlignment == FormatStyle::QAS_Left) in mapping()
1059 else if (Style.QualifierAlignment == FormatStyle::QAS_Custom) in mapping()
1125 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
1126 Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
1128 FormatStyle::DRTBS_All) { in mapping()
1129 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
1131 FormatStyle::DRTBS_TopLevel) { in mapping()
1133 FormatStyle::RTBS_TopLevelDefinitions; in mapping()
1140 Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) { in mapping()
1141 Style.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in mapping()
1148 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon) { in mapping()
1149 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in mapping()
1153 if (Style.PackConstructorInitializers == FormatStyle::PCIS_BinPack && in mapping()
1156 ? FormatStyle::PCIS_NextLine in mapping()
1157 : FormatStyle::PCIS_CurrentLine; in mapping()
1160 FormatStyle::PCIS_NextLine) { in mapping()
1162 Style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in mapping()
1164 Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; in mapping()
1167 if (Style.LineEnding == FormatStyle::LE_DeriveLF) { in mapping()
1169 Style.LineEnding = UseCRLF ? FormatStyle::LE_CRLF : FormatStyle::LE_LF; in mapping()
1171 Style.LineEnding = FormatStyle::LE_DeriveCRLF; in mapping()
1174 if (Style.SpacesInParens != FormatStyle::SIPO_Custom && in mapping()
1195 Style.SpacesInParens = FormatStyle::SIPO_Custom; in mapping()
1205 template <> struct DocumentListTraits<std::vector<FormatStyle>> {
1206 static size_t size(IO &IO, std::vector<FormatStyle> &Seq) { in size()
1209 static FormatStyle &element(IO &IO, std::vector<FormatStyle> &Seq, in element()
1213 FormatStyle Template; in element()
1214 if (!Seq.empty() && Seq[0].Language == FormatStyle::LK_None) { in element()
1217 Template = *((const FormatStyle *)IO.getContext()); in element()
1218 Template.Language = FormatStyle::LK_None; in element()
1270 static void expandPresetsBraceWrapping(FormatStyle &Expanded) { in expandPresetsBraceWrapping()
1271 if (Expanded.BreakBeforeBraces == FormatStyle::BS_Custom) in expandPresetsBraceWrapping()
1275 /*AfterControlStatement=*/FormatStyle::BWACS_Never, in expandPresetsBraceWrapping()
1292 case FormatStyle::BS_Linux: in expandPresetsBraceWrapping()
1297 case FormatStyle::BS_Mozilla: in expandPresetsBraceWrapping()
1307 case FormatStyle::BS_Stroustrup: in expandPresetsBraceWrapping()
1312 case FormatStyle::BS_Allman: in expandPresetsBraceWrapping()
1315 Expanded.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in expandPresetsBraceWrapping()
1327 case FormatStyle::BS_Whitesmiths: in expandPresetsBraceWrapping()
1330 Expanded.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in expandPresetsBraceWrapping()
1341 case FormatStyle::BS_GNU: in expandPresetsBraceWrapping()
1345 /*AfterControlStatement=*/FormatStyle::BWACS_Always, in expandPresetsBraceWrapping()
1362 case FormatStyle::BS_WebKit: in expandPresetsBraceWrapping()
1370 static void expandPresetsSpaceBeforeParens(FormatStyle &Expanded) { in expandPresetsSpaceBeforeParens()
1371 if (Expanded.SpaceBeforeParens == FormatStyle::SBPO_Custom) in expandPresetsSpaceBeforeParens()
1378 case FormatStyle::SBPO_ControlStatements: in expandPresetsSpaceBeforeParens()
1383 case FormatStyle::SBPO_ControlStatementsExceptControlMacros: in expandPresetsSpaceBeforeParens()
1386 case FormatStyle::SBPO_NonEmptyParentheses: in expandPresetsSpaceBeforeParens()
1394 static void expandPresetsSpacesInParens(FormatStyle &Expanded) { in expandPresetsSpacesInParens()
1395 if (Expanded.SpacesInParens == FormatStyle::SIPO_Custom) in expandPresetsSpacesInParens()
1397 assert(Expanded.SpacesInParens == FormatStyle::SIPO_Never); in expandPresetsSpacesInParens()
1402 FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { in getLLVMStyle()
1403 FormatStyle LLVMStyle; in getLLVMStyle()
1407 LLVMStyle.AlignEscapedNewlines = FormatStyle::ENAS_Right; in getLLVMStyle()
1408 LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; in getLLVMStyle()
1409 LLVMStyle.AlignArrayOfStructures = FormatStyle::AIAS_None; in getLLVMStyle()
1410 LLVMStyle.AlignOperands = FormatStyle::OAS_Align; in getLLVMStyle()
1423 LLVMStyle.AlignTrailingComments.Kind = FormatStyle::TCAS_Always; in getLLVMStyle()
1427 LLVMStyle.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; in getLLVMStyle()
1431 LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All; in getLLVMStyle()
1432 LLVMStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getLLVMStyle()
1433 LLVMStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All; in getLLVMStyle()
1435 LLVMStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in getLLVMStyle()
1436 LLVMStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getLLVMStyle()
1438 LLVMStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_MultiLine; in getLLVMStyle()
1440 LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both; in getLLVMStyle()
1446 /*AfterControlStatement=*/FormatStyle::BWACS_Never, in getLLVMStyle()
1463 LLVMStyle.BreakAfterAttributes = FormatStyle::ABS_Leave; in getLLVMStyle()
1466 LLVMStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_None; in getLLVMStyle()
1467 LLVMStyle.BreakBeforeBraces = FormatStyle::BS_Attach; in getLLVMStyle()
1468 LLVMStyle.BreakBeforeConceptDeclarations = FormatStyle::BBCDS_Always; in getLLVMStyle()
1469 LLVMStyle.BreakBeforeInlineASMColon = FormatStyle::BBIAS_OnlyMultiline; in getLLVMStyle()
1470 LLVMStyle.AllowBreakBeforeNoexceptSpecifier = FormatStyle::BBNSS_Never; in getLLVMStyle()
1472 LLVMStyle.BreakConstructorInitializers = FormatStyle::BCIS_BeforeColon; in getLLVMStyle()
1473 LLVMStyle.BreakInheritanceList = FormatStyle::BILS_BeforeColon; in getLLVMStyle()
1483 LLVMStyle.EmptyLineAfterAccessModifier = FormatStyle::ELAAMS_Never; in getLLVMStyle()
1484 LLVMStyle.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_LogicalBlock; in getLLVMStyle()
1500 LLVMStyle.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in getLLVMStyle()
1502 LLVMStyle.IndentPPDirectives = FormatStyle::PPDIS_None; in getLLVMStyle()
1508 LLVMStyle.InsertTrailingCommas = FormatStyle::TCS_None; in getLLVMStyle()
1513 LLVMStyle.JavaScriptQuotes = FormatStyle::JSQS_Leave; in getLLVMStyle()
1517 LLVMStyle.LambdaBodyIndentation = FormatStyle::LBI_Signature; in getLLVMStyle()
1518 LLVMStyle.LineEnding = FormatStyle::LE_DeriveLF; in getLLVMStyle()
1520 LLVMStyle.NamespaceIndentation = FormatStyle::NI_None; in getLLVMStyle()
1521 LLVMStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Auto; in getLLVMStyle()
1526 LLVMStyle.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in getLLVMStyle()
1527 LLVMStyle.PointerAlignment = FormatStyle::PAS_Right; in getLLVMStyle()
1529 LLVMStyle.QualifierAlignment = FormatStyle::QAS_Leave; in getLLVMStyle()
1530 LLVMStyle.ReferenceAlignment = FormatStyle::RAS_Pointer; in getLLVMStyle()
1533 LLVMStyle.RemoveParentheses = FormatStyle::RPS_Leave; in getLLVMStyle()
1535 LLVMStyle.RequiresClausePosition = FormatStyle::RCPS_OwnLine; in getLLVMStyle()
1536 LLVMStyle.RequiresExpressionIndentation = FormatStyle::REI_OuterScope; in getLLVMStyle()
1537 LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave; in getLLVMStyle()
1540 LLVMStyle.SortIncludes = FormatStyle::SI_CaseSensitive; in getLLVMStyle()
1541 LLVMStyle.SortJavaStaticImport = FormatStyle::SJSIO_Before; in getLLVMStyle()
1542 LLVMStyle.SortUsingDeclarations = FormatStyle::SUD_LexicographicNumeric; in getLLVMStyle()
1546 LLVMStyle.SpaceAroundPointerQualifiers = FormatStyle::SAPQ_Default; in getLLVMStyle()
1551 LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements; in getLLVMStyle()
1562 LLVMStyle.SpacesInAngles = FormatStyle::SIAS_Never; in getLLVMStyle()
1565 LLVMStyle.SpacesInParens = FormatStyle::SIPO_Never; in getLLVMStyle()
1567 LLVMStyle.Standard = FormatStyle::LS_Latest; in getLLVMStyle()
1572 LLVMStyle.UseTab = FormatStyle::UT_Never; in getLLVMStyle()
1594 case FormatStyle::LK_TableGen: in getLLVMStyle()
1597 case FormatStyle::LK_Json: in getLLVMStyle()
1600 case FormatStyle::LK_Verilog: in getLLVMStyle()
1611 FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { in getGoogleStyle()
1612 if (Language == FormatStyle::LK_TextProto) { in getGoogleStyle()
1613 FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto); in getGoogleStyle()
1614 GoogleStyle.Language = FormatStyle::LK_TextProto; in getGoogleStyle()
1619 FormatStyle GoogleStyle = getLLVMStyle(Language); in getGoogleStyle()
1622 GoogleStyle.AlignEscapedNewlines = FormatStyle::ENAS_Left; in getGoogleStyle()
1624 FormatStyle::SIS_WithoutElse; in getGoogleStyle()
1627 GoogleStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; in getGoogleStyle()
1637 GoogleStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Never; in getGoogleStyle()
1640 GoogleStyle.PackConstructorInitializers = FormatStyle::PCIS_NextLine; in getGoogleStyle()
1641 GoogleStyle.PointerAlignment = FormatStyle::PAS_Left; in getGoogleStyle()
1644 FormatStyle::LK_Cpp, in getGoogleStyle()
1661 FormatStyle::LK_TextProto, in getGoogleStyle()
1687 GoogleStyle.Standard = FormatStyle::LS_Auto; in getGoogleStyle()
1692 if (Language == FormatStyle::LK_Java) { in getGoogleStyle()
1693 GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getGoogleStyle()
1694 GoogleStyle.AlignOperands = FormatStyle::OAS_DontAlign; in getGoogleStyle()
1696 GoogleStyle.AlignTrailingComments.Kind = FormatStyle::TCAS_Never; in getGoogleStyle()
1697 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1698 GoogleStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getGoogleStyle()
1700 GoogleStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; in getGoogleStyle()
1704 } else if (Language == FormatStyle::LK_JavaScript) { in getGoogleStyle()
1705 GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; in getGoogleStyle()
1706 GoogleStyle.AlignOperands = FormatStyle::OAS_DontAlign; in getGoogleStyle()
1707 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1709 GoogleStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_Empty; in getGoogleStyle()
1719 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; in getGoogleStyle()
1721 GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single; in getGoogleStyle()
1723 } else if (Language == FormatStyle::LK_Proto) { in getGoogleStyle()
1724 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1734 } else if (Language == FormatStyle::LK_ObjC) { in getGoogleStyle()
1742 } else if (Language == FormatStyle::LK_CSharp) { in getGoogleStyle()
1743 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1744 GoogleStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getGoogleStyle()
1747 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; in getGoogleStyle()
1753 FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) { in getChromiumStyle()
1754 FormatStyle ChromiumStyle = getGoogleStyle(Language); in getChromiumStyle()
1776 if (Language == FormatStyle::LK_Java) { in getChromiumStyle()
1778 FormatStyle::SIS_WithoutElse; in getChromiumStyle()
1796 ChromiumStyle.SortIncludes = FormatStyle::SI_CaseSensitive; in getChromiumStyle()
1797 } else if (Language == FormatStyle::LK_JavaScript) { in getChromiumStyle()
1798 ChromiumStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getChromiumStyle()
1802 ChromiumStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; in getChromiumStyle()
1803 ChromiumStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getChromiumStyle()
1807 if (Language == FormatStyle::LK_ObjC) in getChromiumStyle()
1813 FormatStyle getMozillaStyle() { in getMozillaStyle()
1814 FormatStyle MozillaStyle = getLLVMStyle(); in getMozillaStyle()
1816 MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; in getMozillaStyle()
1817 MozillaStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_TopLevel; in getMozillaStyle()
1819 FormatStyle::DRTBS_TopLevel; in getMozillaStyle()
1820 MozillaStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; in getMozillaStyle()
1823 MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; in getMozillaStyle()
1824 MozillaStyle.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getMozillaStyle()
1825 MozillaStyle.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in getMozillaStyle()
1834 MozillaStyle.PointerAlignment = FormatStyle::PAS_Left; in getMozillaStyle()
1839 FormatStyle getWebKitStyle() { in getWebKitStyle()
1840 FormatStyle Style = getLLVMStyle(); in getWebKitStyle()
1842 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
1843 Style.AlignOperands = FormatStyle::OAS_DontAlign; in getWebKitStyle()
1845 Style.AlignTrailingComments.Kind = FormatStyle::TCAS_Never; in getWebKitStyle()
1846 Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Empty; in getWebKitStyle()
1847 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
1848 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
1849 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getWebKitStyle()
1854 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
1857 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
1863 FormatStyle getGNUStyle() { in getGNUStyle()
1864 FormatStyle Style = getLLVMStyle(); in getGNUStyle()
1865 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
1866 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
1867 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
1868 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
1873 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
1874 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
1878 FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language) { in getMicrosoftStyle()
1879 FormatStyle Style = getLLVMStyle(Language); in getMicrosoftStyle()
1883 Style.UseTab = FormatStyle::UT_Never; in getMicrosoftStyle()
1884 Style.BreakBeforeBraces = FormatStyle::BS_Custom; in getMicrosoftStyle()
1886 Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in getMicrosoftStyle()
1898 Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; in getMicrosoftStyle()
1900 Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getMicrosoftStyle()
1902 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getMicrosoftStyle()
1903 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in getMicrosoftStyle()
1907 FormatStyle getClangFormatStyle() { in getClangFormatStyle()
1908 FormatStyle Style = getLLVMStyle(); in getClangFormatStyle()
1911 Style.LineEnding = FormatStyle::LE_LF; in getClangFormatStyle()
1913 Style.RemoveParentheses = FormatStyle::RPS_ReturnStatement; in getClangFormatStyle()
1917 FormatStyle getNoStyle() { in getNoStyle()
1918 FormatStyle NoStyle = getLLVMStyle(); in getNoStyle()
1920 NoStyle.SortIncludes = FormatStyle::SI_Never; in getNoStyle()
1921 NoStyle.SortUsingDeclarations = FormatStyle::SUD_Never; in getNoStyle()
1925 bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language, in getPredefinedStyle()
1926 FormatStyle *Style) { in getPredefinedStyle()
1954 ParseError validateQualifierOrder(FormatStyle *Style) { in validateQualifierOrder()
1987 FormatStyle *Style, bool AllowUnknownOptions, in parseConfiguration()
1991 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
1992 assert(Language != FormatStyle::LK_None); in parseConfiguration()
1996 std::vector<FormatStyle> Styles; in parseConfiguration()
2011 if (Styles[i].Language == FormatStyle::LK_None && i != 0) in parseConfiguration()
2026 FormatStyle::FormatStyleSet StyleSet; in parseConfiguration()
2028 for (const FormatStyle &Style : llvm::reverse(Styles)) { in parseConfiguration()
2029 if (Style.Language != FormatStyle::LK_None) in parseConfiguration()
2035 if (Styles.empty() || Styles[0].Language != FormatStyle::LK_None) in parseConfiguration()
2037 FormatStyle DefaultStyle = Styles[0]; in parseConfiguration()
2042 if (Style->InsertTrailingCommas != FormatStyle::TCS_None && in parseConfiguration()
2047 if (Style->QualifierAlignment != FormatStyle::QAS_Leave) in parseConfiguration()
2052 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText()
2058 FormatStyle NonConstStyle = Style; in configurationAsText()
2067 std::optional<FormatStyle>
2068 FormatStyle::FormatStyleSet::Get(FormatStyle::LanguageKind Language) const { in Get()
2074 FormatStyle Style = It->second; in Get()
2079 void FormatStyle::FormatStyleSet::Add(FormatStyle Style) { in Add()
2090 void FormatStyle::FormatStyleSet::Clear() { Styles.reset(); } in Clear()
2092 std::optional<FormatStyle>
2093 FormatStyle::GetLanguageStyle(FormatStyle::LanguageKind Language) const { in GetLanguageStyle()
2101 ParensRemover(const Environment &Env, const FormatStyle &Style) in ParensRemover()
2145 BracesInserter(const Environment &Env, const FormatStyle &Style) in BracesInserter()
2198 BracesRemover(const Environment &Env, const FormatStyle &Style) in BracesRemover()
2249 SemiRemover(const Environment &Env, const FormatStyle &Style) in SemiRemover()
2300 JavaScriptRequoter(const Environment &Env, const FormatStyle &Style) in JavaScriptRequoter()
2328 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
2330 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
2336 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
2388 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter()
2405 Style.LineEnding > FormatStyle::LE_CRLF in analyze()
2408 Style.LineEnding == FormatStyle::LE_DeriveCRLF) in analyze()
2409 : Style.LineEnding == FormatStyle::LE_CRLF); in analyze()
2499 Style.PointerAlignment = FormatStyle::PAS_Right; in deriveLocalStyle()
2501 Style.PointerAlignment = FormatStyle::PAS_Left; in deriveLocalStyle()
2502 Style.ReferenceAlignment = FormatStyle::RAS_Pointer; in deriveLocalStyle()
2504 if (Style.Standard == FormatStyle::LS_Auto) { in deriveLocalStyle()
2506 ? FormatStyle::LS_Latest in deriveLocalStyle()
2507 : FormatStyle::LS_Cpp03; in deriveLocalStyle()
2530 TrailingCommaInserter(const Environment &Env, const FormatStyle &Style) in TrailingCommaInserter()
2591 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner()
2814 ObjCHeaderStyleGuesser(const Environment &Env, const FormatStyle &Style) in ObjCHeaderStyleGuesser()
2821 assert(Style.Language == FormatStyle::LK_Cpp); in analyze()
3042 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes()
3057 if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) { in sortCppIncludes()
3140 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes()
3248 static unsigned findJavaImportGroup(const FormatStyle &Style, in findJavaImportGroup()
3268 static void sortJavaImports(const FormatStyle &Style, in sortJavaImports()
3287 Style.SortJavaStaticImport == FormatStyle::SJSIO_After; in sortJavaImports()
3350 tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code, in sortJavaImports()
3411 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes()
3419 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript && in sortIncludes()
3423 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
3425 if (Style.Language == FormatStyle::LanguageKind::LK_Java) in sortIncludes()
3435 const FormatStyle &Style) { in processReplacements()
3453 const FormatStyle &Style) { in formatReplacements()
3456 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3468 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3491 const FormatStyle &Style) { in fixCppIncludeInsertions()
3564 const FormatStyle &Style) { in cleanupAroundReplacements()
3567 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
3580 reformat(const FormatStyle &Style, StringRef Code, in reformat()
3584 FormatStyle Expanded = Style; in reformat()
3590 Expanded.RemoveParentheses = FormatStyle::RPS_Leave; in reformat()
3593 case FormatStyle::RCPS_SingleLine: in reformat()
3594 case FormatStyle::RCPS_WithPreceding: in reformat()
3605 if (Expanded.Language == FormatStyle::LK_JavaScript && isMpegTS(Code)) in reformat()
3643 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) in reformat()
3646 if (Style.RemoveParentheses != FormatStyle::RPS_Leave) { in reformat()
3647 FormatStyle S = Expanded; in reformat()
3655 FormatStyle S = Expanded; in reformat()
3663 FormatStyle S = Expanded; in reformat()
3671 FormatStyle S = Expanded; in reformat()
3684 if (Style.SortUsingDeclarations != FormatStyle::SUD_Never) { in reformat()
3691 if (Style.SeparateDefinitionBlocks != FormatStyle::SDS_Leave) { in reformat()
3697 if (Style.Language == FormatStyle::LK_ObjC && in reformat()
3705 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) { in reformat()
3716 Style.InsertTrailingCommas == FormatStyle::TCS_Wrapped) { in reformat()
3744 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) { in reformat()
3766 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat()
3777 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup()
3781 if (Style.Language != FormatStyle::LK_Cpp) in cleanup()
3789 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat()
3799 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, in fixNamespaceEndComments()
3809 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, in sortUsingDeclarations()
3819 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts()
3822 FormatStyle::LanguageStandard LexingStd = Style.Standard; in getFormattingLangOpts()
3823 if (LexingStd == FormatStyle::LS_Auto) in getFormattingLangOpts()
3824 LexingStd = FormatStyle::LS_Latest; in getFormattingLangOpts()
3825 if (LexingStd == FormatStyle::LS_Latest) in getFormattingLangOpts()
3826 LexingStd = FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3828 LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; in getFormattingLangOpts()
3829 LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; in getFormattingLangOpts()
3830 LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; in getFormattingLangOpts()
3831 LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3832 LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3836 LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; in getFormattingLangOpts()
3864 static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) { in getLanguageByFileName()
3866 return FormatStyle::LK_Java; in getLanguageByFileName()
3870 return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript. in getLanguageByFileName()
3873 return FormatStyle::LK_ObjC; in getLanguageByFileName()
3876 return FormatStyle::LK_Proto; in getLanguageByFileName()
3882 return FormatStyle::LK_TextProto; in getLanguageByFileName()
3885 return FormatStyle::LK_TableGen; in getLanguageByFileName()
3887 return FormatStyle::LK_CSharp; in getLanguageByFileName()
3889 return FormatStyle::LK_Json; in getLanguageByFileName()
3894 return FormatStyle::LK_Verilog; in getLanguageByFileName()
3896 return FormatStyle::LK_Cpp; in getLanguageByFileName()
3899 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) { in guessLanguage()
3901 if (GuessedLanguage == FormatStyle::LK_Cpp) { in guessLanguage()
3911 return FormatStyle::LK_ObjC; in guessLanguage()
3924 FormatStyle *Style, bool AllowUnknownOptions) { in loadAndParseConfigFile()
3934 llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName, in getStyle()
3938 FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code)); in getStyle()
3939 FormatStyle FallbackStyle = getNoStyle(); in getStyle()
4008 auto applyChildFormatTexts = [&](FormatStyle *Style) { in getStyle()