Lines Matching refs:FormatStyle
54 using clang::format::FormatStyle;
56 LLVM_YAML_IS_SEQUENCE_VECTOR(clang::format::FormatStyle::RawStringFormat)
60 template <> struct ScalarEnumerationTraits<FormatStyle::LanguageKind> {
61 static void enumeration(IO &IO, FormatStyle::LanguageKind &Value) { in enumeration()
62 IO.enumCase(Value, "Cpp", FormatStyle::LK_Cpp); in enumeration()
63 IO.enumCase(Value, "Java", FormatStyle::LK_Java); in enumeration()
64 IO.enumCase(Value, "JavaScript", FormatStyle::LK_JavaScript); in enumeration()
65 IO.enumCase(Value, "ObjC", FormatStyle::LK_ObjC); in enumeration()
66 IO.enumCase(Value, "Proto", FormatStyle::LK_Proto); in enumeration()
67 IO.enumCase(Value, "TableGen", FormatStyle::LK_TableGen); in enumeration()
68 IO.enumCase(Value, "TextProto", FormatStyle::LK_TextProto); in enumeration()
69 IO.enumCase(Value, "CSharp", FormatStyle::LK_CSharp); in enumeration()
70 IO.enumCase(Value, "Json", FormatStyle::LK_Json); in enumeration()
74 template <> struct ScalarEnumerationTraits<FormatStyle::LanguageStandard> {
75 static void enumeration(IO &IO, FormatStyle::LanguageStandard &Value) { in enumeration()
76 IO.enumCase(Value, "c++03", FormatStyle::LS_Cpp03); in enumeration()
77 IO.enumCase(Value, "C++03", FormatStyle::LS_Cpp03); // Legacy alias in enumeration()
78 IO.enumCase(Value, "Cpp03", FormatStyle::LS_Cpp03); // Legacy alias in enumeration()
80 IO.enumCase(Value, "c++11", FormatStyle::LS_Cpp11); in enumeration()
81 IO.enumCase(Value, "C++11", FormatStyle::LS_Cpp11); // Legacy alias in enumeration()
83 IO.enumCase(Value, "c++14", FormatStyle::LS_Cpp14); in enumeration()
84 IO.enumCase(Value, "c++17", FormatStyle::LS_Cpp17); in enumeration()
85 IO.enumCase(Value, "c++20", FormatStyle::LS_Cpp20); in enumeration()
87 IO.enumCase(Value, "Latest", FormatStyle::LS_Latest); in enumeration()
88 IO.enumCase(Value, "Cpp11", FormatStyle::LS_Latest); // Legacy alias in enumeration()
89 IO.enumCase(Value, "Auto", FormatStyle::LS_Auto); in enumeration()
94 struct ScalarEnumerationTraits<FormatStyle::LambdaBodyIndentationKind> {
96 FormatStyle::LambdaBodyIndentationKind &Value) { in enumeration()
97 IO.enumCase(Value, "Signature", FormatStyle::LBI_Signature); in enumeration()
98 IO.enumCase(Value, "OuterScope", FormatStyle::LBI_OuterScope); in enumeration()
102 template <> struct ScalarEnumerationTraits<FormatStyle::UseTabStyle> {
103 static void enumeration(IO &IO, FormatStyle::UseTabStyle &Value) { in enumeration()
104 IO.enumCase(Value, "Never", FormatStyle::UT_Never); in enumeration()
105 IO.enumCase(Value, "false", FormatStyle::UT_Never); in enumeration()
106 IO.enumCase(Value, "Always", FormatStyle::UT_Always); in enumeration()
107 IO.enumCase(Value, "true", FormatStyle::UT_Always); in enumeration()
108 IO.enumCase(Value, "ForIndentation", FormatStyle::UT_ForIndentation); in enumeration()
110 FormatStyle::UT_ForContinuationAndIndentation); in enumeration()
111 IO.enumCase(Value, "AlignWithSpaces", FormatStyle::UT_AlignWithSpaces); in enumeration()
115 template <> struct ScalarEnumerationTraits<FormatStyle::JavaScriptQuoteStyle> {
116 static void enumeration(IO &IO, FormatStyle::JavaScriptQuoteStyle &Value) { in enumeration()
117 IO.enumCase(Value, "Leave", FormatStyle::JSQS_Leave); in enumeration()
118 IO.enumCase(Value, "Single", FormatStyle::JSQS_Single); in enumeration()
119 IO.enumCase(Value, "Double", FormatStyle::JSQS_Double); in enumeration()
123 template <> struct ScalarEnumerationTraits<FormatStyle::ShortBlockStyle> {
124 static void enumeration(IO &IO, FormatStyle::ShortBlockStyle &Value) { in enumeration()
125 IO.enumCase(Value, "Never", FormatStyle::SBS_Never); in enumeration()
126 IO.enumCase(Value, "false", FormatStyle::SBS_Never); in enumeration()
127 IO.enumCase(Value, "Always", FormatStyle::SBS_Always); in enumeration()
128 IO.enumCase(Value, "true", FormatStyle::SBS_Always); in enumeration()
129 IO.enumCase(Value, "Empty", FormatStyle::SBS_Empty); in enumeration()
134 struct ScalarEnumerationTraits<FormatStyle::QualifierAlignmentStyle> {
135 static void enumeration(IO &IO, FormatStyle::QualifierAlignmentStyle &Value) { in enumeration()
136 IO.enumCase(Value, "Leave", FormatStyle::QAS_Leave); in enumeration()
137 IO.enumCase(Value, "Left", FormatStyle::QAS_Left); in enumeration()
138 IO.enumCase(Value, "Right", FormatStyle::QAS_Right); in enumeration()
139 IO.enumCase(Value, "Custom", FormatStyle::QAS_Custom); in enumeration()
143 template <> struct ScalarEnumerationTraits<FormatStyle::ShortFunctionStyle> {
144 static void enumeration(IO &IO, FormatStyle::ShortFunctionStyle &Value) { in enumeration()
145 IO.enumCase(Value, "None", FormatStyle::SFS_None); in enumeration()
146 IO.enumCase(Value, "false", FormatStyle::SFS_None); in enumeration()
147 IO.enumCase(Value, "All", FormatStyle::SFS_All); in enumeration()
148 IO.enumCase(Value, "true", FormatStyle::SFS_All); in enumeration()
149 IO.enumCase(Value, "Inline", FormatStyle::SFS_Inline); in enumeration()
150 IO.enumCase(Value, "InlineOnly", FormatStyle::SFS_InlineOnly); in enumeration()
151 IO.enumCase(Value, "Empty", FormatStyle::SFS_Empty); in enumeration()
155 template <> struct MappingTraits<FormatStyle::AlignConsecutiveStyle> {
156 static void enumInput(IO &IO, FormatStyle::AlignConsecutiveStyle &Value) { in enumInput()
158 FormatStyle::AlignConsecutiveStyle( in enumInput()
163 FormatStyle::AlignConsecutiveStyle( in enumInput()
168 FormatStyle::AlignConsecutiveStyle( in enumInput()
173 FormatStyle::AlignConsecutiveStyle({/*Enabled=*/true, in enumInput()
179 FormatStyle::AlignConsecutiveStyle({/*Enabled=*/true, in enumInput()
187 FormatStyle::AlignConsecutiveStyle( in enumInput()
192 FormatStyle::AlignConsecutiveStyle( in enumInput()
198 static void mapping(IO &IO, FormatStyle::AlignConsecutiveStyle &Value) { in mapping()
208 struct ScalarEnumerationTraits<FormatStyle::ArrayInitializerAlignmentStyle> {
210 FormatStyle::ArrayInitializerAlignmentStyle &Value) { in enumeration()
211 IO.enumCase(Value, "None", FormatStyle::AIAS_None); in enumeration()
212 IO.enumCase(Value, "Left", FormatStyle::AIAS_Left); in enumeration()
213 IO.enumCase(Value, "Right", FormatStyle::AIAS_Right); in enumeration()
217 template <> struct ScalarEnumerationTraits<FormatStyle::ShortIfStyle> {
218 static void enumeration(IO &IO, FormatStyle::ShortIfStyle &Value) { in enumeration()
219 IO.enumCase(Value, "Never", FormatStyle::SIS_Never); in enumeration()
220 IO.enumCase(Value, "WithoutElse", FormatStyle::SIS_WithoutElse); in enumeration()
221 IO.enumCase(Value, "OnlyFirstIf", FormatStyle::SIS_OnlyFirstIf); in enumeration()
222 IO.enumCase(Value, "AllIfsAndElse", FormatStyle::SIS_AllIfsAndElse); in enumeration()
225 IO.enumCase(Value, "Always", FormatStyle::SIS_OnlyFirstIf); in enumeration()
226 IO.enumCase(Value, "false", FormatStyle::SIS_Never); in enumeration()
227 IO.enumCase(Value, "true", FormatStyle::SIS_WithoutElse); in enumeration()
231 template <> struct ScalarEnumerationTraits<FormatStyle::ShortLambdaStyle> {
232 static void enumeration(IO &IO, FormatStyle::ShortLambdaStyle &Value) { in enumeration()
233 IO.enumCase(Value, "None", FormatStyle::SLS_None); in enumeration()
234 IO.enumCase(Value, "false", FormatStyle::SLS_None); in enumeration()
235 IO.enumCase(Value, "Empty", FormatStyle::SLS_Empty); in enumeration()
236 IO.enumCase(Value, "Inline", FormatStyle::SLS_Inline); in enumeration()
237 IO.enumCase(Value, "All", FormatStyle::SLS_All); in enumeration()
238 IO.enumCase(Value, "true", FormatStyle::SLS_All); in enumeration()
242 template <> struct ScalarEnumerationTraits<FormatStyle::BinPackStyle> {
243 static void enumeration(IO &IO, FormatStyle::BinPackStyle &Value) { in enumeration()
244 IO.enumCase(Value, "Auto", FormatStyle::BPS_Auto); in enumeration()
245 IO.enumCase(Value, "Always", FormatStyle::BPS_Always); in enumeration()
246 IO.enumCase(Value, "Never", FormatStyle::BPS_Never); in enumeration()
250 template <> struct ScalarEnumerationTraits<FormatStyle::TrailingCommaStyle> {
251 static void enumeration(IO &IO, FormatStyle::TrailingCommaStyle &Value) { in enumeration()
252 IO.enumCase(Value, "None", FormatStyle::TCS_None); in enumeration()
253 IO.enumCase(Value, "Wrapped", FormatStyle::TCS_Wrapped); in enumeration()
257 template <> struct ScalarEnumerationTraits<FormatStyle::BinaryOperatorStyle> {
258 static void enumeration(IO &IO, FormatStyle::BinaryOperatorStyle &Value) { in enumeration()
259 IO.enumCase(Value, "All", FormatStyle::BOS_All); in enumeration()
260 IO.enumCase(Value, "true", FormatStyle::BOS_All); in enumeration()
261 IO.enumCase(Value, "None", FormatStyle::BOS_None); in enumeration()
262 IO.enumCase(Value, "false", FormatStyle::BOS_None); in enumeration()
263 IO.enumCase(Value, "NonAssignment", FormatStyle::BOS_NonAssignment); in enumeration()
267 template <> struct ScalarEnumerationTraits<FormatStyle::BraceBreakingStyle> {
268 static void enumeration(IO &IO, FormatStyle::BraceBreakingStyle &Value) { in enumeration()
269 IO.enumCase(Value, "Attach", FormatStyle::BS_Attach); in enumeration()
270 IO.enumCase(Value, "Linux", FormatStyle::BS_Linux); in enumeration()
271 IO.enumCase(Value, "Mozilla", FormatStyle::BS_Mozilla); in enumeration()
272 IO.enumCase(Value, "Stroustrup", FormatStyle::BS_Stroustrup); in enumeration()
273 IO.enumCase(Value, "Allman", FormatStyle::BS_Allman); in enumeration()
274 IO.enumCase(Value, "Whitesmiths", FormatStyle::BS_Whitesmiths); in enumeration()
275 IO.enumCase(Value, "GNU", FormatStyle::BS_GNU); in enumeration()
276 IO.enumCase(Value, "WebKit", FormatStyle::BS_WebKit); in enumeration()
277 IO.enumCase(Value, "Custom", FormatStyle::BS_Custom); in enumeration()
283 FormatStyle::BraceWrappingAfterControlStatementStyle> {
286 FormatStyle::BraceWrappingAfterControlStatementStyle &Value) { in enumeration()
287 IO.enumCase(Value, "Never", FormatStyle::BWACS_Never); in enumeration()
288 IO.enumCase(Value, "MultiLine", FormatStyle::BWACS_MultiLine); in enumeration()
289 IO.enumCase(Value, "Always", FormatStyle::BWACS_Always); in enumeration()
292 IO.enumCase(Value, "false", FormatStyle::BWACS_Never); in enumeration()
293 IO.enumCase(Value, "true", FormatStyle::BWACS_Always); in enumeration()
299 FormatStyle::BreakBeforeConceptDeclarationsStyle> {
301 enumeration(IO &IO, FormatStyle::BreakBeforeConceptDeclarationsStyle &Value) { in enumeration()
302 IO.enumCase(Value, "Never", FormatStyle::BBCDS_Never); in enumeration()
303 IO.enumCase(Value, "Allowed", FormatStyle::BBCDS_Allowed); in enumeration()
304 IO.enumCase(Value, "Always", FormatStyle::BBCDS_Always); in enumeration()
307 IO.enumCase(Value, "true", FormatStyle::BBCDS_Always); in enumeration()
308 IO.enumCase(Value, "false", FormatStyle::BBCDS_Allowed); in enumeration()
313 struct ScalarEnumerationTraits<FormatStyle::BreakConstructorInitializersStyle> {
315 enumeration(IO &IO, FormatStyle::BreakConstructorInitializersStyle &Value) { in enumeration()
316 IO.enumCase(Value, "BeforeColon", FormatStyle::BCIS_BeforeColon); in enumeration()
317 IO.enumCase(Value, "BeforeComma", FormatStyle::BCIS_BeforeComma); in enumeration()
318 IO.enumCase(Value, "AfterColon", FormatStyle::BCIS_AfterColon); in enumeration()
323 struct ScalarEnumerationTraits<FormatStyle::BreakInheritanceListStyle> {
325 FormatStyle::BreakInheritanceListStyle &Value) { in enumeration()
326 IO.enumCase(Value, "BeforeColon", FormatStyle::BILS_BeforeColon); in enumeration()
327 IO.enumCase(Value, "BeforeComma", FormatStyle::BILS_BeforeComma); in enumeration()
328 IO.enumCase(Value, "AfterColon", FormatStyle::BILS_AfterColon); in enumeration()
329 IO.enumCase(Value, "AfterComma", FormatStyle::BILS_AfterComma); in enumeration()
334 struct ScalarEnumerationTraits<FormatStyle::PackConstructorInitializersStyle> {
336 enumeration(IO &IO, FormatStyle::PackConstructorInitializersStyle &Value) { in enumeration()
337 IO.enumCase(Value, "Never", FormatStyle::PCIS_Never); in enumeration()
338 IO.enumCase(Value, "BinPack", FormatStyle::PCIS_BinPack); in enumeration()
339 IO.enumCase(Value, "CurrentLine", FormatStyle::PCIS_CurrentLine); in enumeration()
340 IO.enumCase(Value, "NextLine", FormatStyle::PCIS_NextLine); in enumeration()
345 struct ScalarEnumerationTraits<FormatStyle::EmptyLineAfterAccessModifierStyle> {
347 enumeration(IO &IO, FormatStyle::EmptyLineAfterAccessModifierStyle &Value) { in enumeration()
348 IO.enumCase(Value, "Never", FormatStyle::ELAAMS_Never); in enumeration()
349 IO.enumCase(Value, "Leave", FormatStyle::ELAAMS_Leave); in enumeration()
350 IO.enumCase(Value, "Always", FormatStyle::ELAAMS_Always); in enumeration()
356 FormatStyle::EmptyLineBeforeAccessModifierStyle> {
358 enumeration(IO &IO, FormatStyle::EmptyLineBeforeAccessModifierStyle &Value) { in enumeration()
359 IO.enumCase(Value, "Never", FormatStyle::ELBAMS_Never); in enumeration()
360 IO.enumCase(Value, "Leave", FormatStyle::ELBAMS_Leave); in enumeration()
361 IO.enumCase(Value, "LogicalBlock", FormatStyle::ELBAMS_LogicalBlock); in enumeration()
362 IO.enumCase(Value, "Always", FormatStyle::ELBAMS_Always); in enumeration()
367 struct ScalarEnumerationTraits<FormatStyle::PPDirectiveIndentStyle> {
368 static void enumeration(IO &IO, FormatStyle::PPDirectiveIndentStyle &Value) { in enumeration()
369 IO.enumCase(Value, "None", FormatStyle::PPDIS_None); in enumeration()
370 IO.enumCase(Value, "AfterHash", FormatStyle::PPDIS_AfterHash); in enumeration()
371 IO.enumCase(Value, "BeforeHash", FormatStyle::PPDIS_BeforeHash); in enumeration()
376 struct ScalarEnumerationTraits<FormatStyle::IndentExternBlockStyle> {
377 static void enumeration(IO &IO, FormatStyle::IndentExternBlockStyle &Value) { in enumeration()
378 IO.enumCase(Value, "AfterExternBlock", FormatStyle::IEBS_AfterExternBlock); in enumeration()
379 IO.enumCase(Value, "Indent", FormatStyle::IEBS_Indent); in enumeration()
380 IO.enumCase(Value, "NoIndent", FormatStyle::IEBS_NoIndent); in enumeration()
381 IO.enumCase(Value, "true", FormatStyle::IEBS_Indent); in enumeration()
382 IO.enumCase(Value, "false", FormatStyle::IEBS_NoIndent); in enumeration()
387 struct ScalarEnumerationTraits<FormatStyle::ReturnTypeBreakingStyle> {
388 static void enumeration(IO &IO, FormatStyle::ReturnTypeBreakingStyle &Value) { in enumeration()
389 IO.enumCase(Value, "None", FormatStyle::RTBS_None); in enumeration()
390 IO.enumCase(Value, "All", FormatStyle::RTBS_All); in enumeration()
391 IO.enumCase(Value, "TopLevel", FormatStyle::RTBS_TopLevel); in enumeration()
393 FormatStyle::RTBS_TopLevelDefinitions); in enumeration()
394 IO.enumCase(Value, "AllDefinitions", FormatStyle::RTBS_AllDefinitions); in enumeration()
399 struct ScalarEnumerationTraits<FormatStyle::BreakTemplateDeclarationsStyle> {
401 FormatStyle::BreakTemplateDeclarationsStyle &Value) { in enumeration()
402 IO.enumCase(Value, "No", FormatStyle::BTDS_No); in enumeration()
403 IO.enumCase(Value, "MultiLine", FormatStyle::BTDS_MultiLine); in enumeration()
404 IO.enumCase(Value, "Yes", FormatStyle::BTDS_Yes); in enumeration()
407 IO.enumCase(Value, "false", FormatStyle::BTDS_MultiLine); in enumeration()
408 IO.enumCase(Value, "true", FormatStyle::BTDS_Yes); in enumeration()
413 struct ScalarEnumerationTraits<FormatStyle::DefinitionReturnTypeBreakingStyle> {
415 enumeration(IO &IO, FormatStyle::DefinitionReturnTypeBreakingStyle &Value) { in enumeration()
416 IO.enumCase(Value, "None", FormatStyle::DRTBS_None); in enumeration()
417 IO.enumCase(Value, "All", FormatStyle::DRTBS_All); in enumeration()
418 IO.enumCase(Value, "TopLevel", FormatStyle::DRTBS_TopLevel); in enumeration()
421 IO.enumCase(Value, "false", FormatStyle::DRTBS_None); in enumeration()
422 IO.enumCase(Value, "true", FormatStyle::DRTBS_All); in enumeration()
427 struct ScalarEnumerationTraits<FormatStyle::NamespaceIndentationKind> {
429 FormatStyle::NamespaceIndentationKind &Value) { in enumeration()
430 IO.enumCase(Value, "None", FormatStyle::NI_None); in enumeration()
431 IO.enumCase(Value, "Inner", FormatStyle::NI_Inner); in enumeration()
432 IO.enumCase(Value, "All", FormatStyle::NI_All); in enumeration()
436 template <> struct ScalarEnumerationTraits<FormatStyle::BracketAlignmentStyle> {
437 static void enumeration(IO &IO, FormatStyle::BracketAlignmentStyle &Value) { in enumeration()
438 IO.enumCase(Value, "Align", FormatStyle::BAS_Align); in enumeration()
439 IO.enumCase(Value, "DontAlign", FormatStyle::BAS_DontAlign); in enumeration()
440 IO.enumCase(Value, "AlwaysBreak", FormatStyle::BAS_AlwaysBreak); in enumeration()
441 IO.enumCase(Value, "BlockIndent", FormatStyle::BAS_BlockIndent); in enumeration()
444 IO.enumCase(Value, "true", FormatStyle::BAS_Align); in enumeration()
445 IO.enumCase(Value, "false", FormatStyle::BAS_DontAlign); in enumeration()
450 struct ScalarEnumerationTraits<FormatStyle::EscapedNewlineAlignmentStyle> {
452 FormatStyle::EscapedNewlineAlignmentStyle &Value) { in enumeration()
453 IO.enumCase(Value, "DontAlign", FormatStyle::ENAS_DontAlign); in enumeration()
454 IO.enumCase(Value, "Left", FormatStyle::ENAS_Left); in enumeration()
455 IO.enumCase(Value, "Right", FormatStyle::ENAS_Right); in enumeration()
458 IO.enumCase(Value, "true", FormatStyle::ENAS_Left); in enumeration()
459 IO.enumCase(Value, "false", FormatStyle::ENAS_Right); in enumeration()
463 template <> struct ScalarEnumerationTraits<FormatStyle::OperandAlignmentStyle> {
464 static void enumeration(IO &IO, FormatStyle::OperandAlignmentStyle &Value) { in enumeration()
465 IO.enumCase(Value, "DontAlign", FormatStyle::OAS_DontAlign); in enumeration()
466 IO.enumCase(Value, "Align", FormatStyle::OAS_Align); in enumeration()
468 FormatStyle::OAS_AlignAfterOperator); in enumeration()
471 IO.enumCase(Value, "true", FormatStyle::OAS_Align); in enumeration()
472 IO.enumCase(Value, "false", FormatStyle::OAS_DontAlign); 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::SeparateDefinitionStyle> {
490 static void enumeration(IO &IO, FormatStyle::SeparateDefinitionStyle &Value) { in enumeration()
491 IO.enumCase(Value, "Leave", FormatStyle::SDS_Leave); in enumeration()
492 IO.enumCase(Value, "Always", FormatStyle::SDS_Always); in enumeration()
493 IO.enumCase(Value, "Never", FormatStyle::SDS_Never); in enumeration()
498 struct ScalarEnumerationTraits<FormatStyle::SpaceAroundPointerQualifiersStyle> {
500 enumeration(IO &IO, FormatStyle::SpaceAroundPointerQualifiersStyle &Value) { in enumeration()
501 IO.enumCase(Value, "Default", FormatStyle::SAPQ_Default); in enumeration()
502 IO.enumCase(Value, "Before", FormatStyle::SAPQ_Before); in enumeration()
503 IO.enumCase(Value, "After", FormatStyle::SAPQ_After); in enumeration()
504 IO.enumCase(Value, "Both", FormatStyle::SAPQ_Both); in enumeration()
509 struct ScalarEnumerationTraits<FormatStyle::ReferenceAlignmentStyle> {
510 static void enumeration(IO &IO, FormatStyle::ReferenceAlignmentStyle &Value) { in enumeration()
511 IO.enumCase(Value, "Pointer", FormatStyle::RAS_Pointer); in enumeration()
512 IO.enumCase(Value, "Middle", FormatStyle::RAS_Middle); in enumeration()
513 IO.enumCase(Value, "Left", FormatStyle::RAS_Left); in enumeration()
514 IO.enumCase(Value, "Right", FormatStyle::RAS_Right); in enumeration()
519 struct ScalarEnumerationTraits<FormatStyle::RequiresClausePositionStyle> {
521 FormatStyle::RequiresClausePositionStyle &Value) { in enumeration()
522 IO.enumCase(Value, "OwnLine", FormatStyle::RCPS_OwnLine); in enumeration()
523 IO.enumCase(Value, "WithPreceding", FormatStyle::RCPS_WithPreceding); in enumeration()
524 IO.enumCase(Value, "WithFollowing", FormatStyle::RCPS_WithFollowing); in enumeration()
525 IO.enumCase(Value, "SingleLine", FormatStyle::RCPS_SingleLine); in enumeration()
530 struct ScalarEnumerationTraits<FormatStyle::SpaceBeforeParensStyle> {
531 static void enumeration(IO &IO, FormatStyle::SpaceBeforeParensStyle &Value) { in enumeration()
532 IO.enumCase(Value, "Never", FormatStyle::SBPO_Never); in enumeration()
534 FormatStyle::SBPO_ControlStatements); in enumeration()
536 FormatStyle::SBPO_ControlStatementsExceptControlMacros); in enumeration()
538 FormatStyle::SBPO_NonEmptyParentheses); in enumeration()
539 IO.enumCase(Value, "Always", FormatStyle::SBPO_Always); in enumeration()
540 IO.enumCase(Value, "Custom", FormatStyle::SBPO_Custom); in enumeration()
543 IO.enumCase(Value, "false", FormatStyle::SBPO_Never); in enumeration()
544 IO.enumCase(Value, "true", FormatStyle::SBPO_ControlStatements); in enumeration()
546 FormatStyle::SBPO_ControlStatementsExceptControlMacros); in enumeration()
551 struct ScalarEnumerationTraits<FormatStyle::BitFieldColonSpacingStyle> {
553 FormatStyle::BitFieldColonSpacingStyle &Value) { in enumeration()
554 IO.enumCase(Value, "Both", FormatStyle::BFCS_Both); in enumeration()
555 IO.enumCase(Value, "None", FormatStyle::BFCS_None); in enumeration()
556 IO.enumCase(Value, "Before", FormatStyle::BFCS_Before); in enumeration()
557 IO.enumCase(Value, "After", FormatStyle::BFCS_After); in enumeration()
561 template <> struct ScalarEnumerationTraits<FormatStyle::SortIncludesOptions> {
562 static void enumeration(IO &IO, FormatStyle::SortIncludesOptions &Value) { in enumeration()
563 IO.enumCase(Value, "Never", FormatStyle::SI_Never); in enumeration()
564 IO.enumCase(Value, "CaseInsensitive", FormatStyle::SI_CaseInsensitive); in enumeration()
565 IO.enumCase(Value, "CaseSensitive", FormatStyle::SI_CaseSensitive); in enumeration()
568 IO.enumCase(Value, "false", FormatStyle::SI_Never); in enumeration()
569 IO.enumCase(Value, "true", FormatStyle::SI_CaseSensitive); in enumeration()
574 struct ScalarEnumerationTraits<FormatStyle::SortJavaStaticImportOptions> {
576 FormatStyle::SortJavaStaticImportOptions &Value) { in enumeration()
577 IO.enumCase(Value, "Before", FormatStyle::SJSIO_Before); in enumeration()
578 IO.enumCase(Value, "After", FormatStyle::SJSIO_After); in enumeration()
582 template <> struct ScalarEnumerationTraits<FormatStyle::SpacesInAnglesStyle> {
583 static void enumeration(IO &IO, FormatStyle::SpacesInAnglesStyle &Value) { in enumeration()
584 IO.enumCase(Value, "Never", FormatStyle::SIAS_Never); in enumeration()
585 IO.enumCase(Value, "Always", FormatStyle::SIAS_Always); in enumeration()
586 IO.enumCase(Value, "Leave", FormatStyle::SIAS_Leave); in enumeration()
589 IO.enumCase(Value, "false", FormatStyle::SIAS_Never); in enumeration()
590 IO.enumCase(Value, "true", FormatStyle::SIAS_Always); in enumeration()
594 template <> struct MappingTraits<FormatStyle> {
595 static void mapping(IO &IO, FormatStyle &Style) { in mapping()
603 FormatStyle PredefinedStyle; in mapping()
614 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
615 FormatStyle::LanguageKind Language = in mapping()
616 ((FormatStyle *)IO.getContext())->Language; in mapping()
676 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
677 Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
679 FormatStyle::DRTBS_All) { in mapping()
680 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
682 FormatStyle::DRTBS_TopLevel) { in mapping()
684 FormatStyle::RTBS_TopLevelDefinitions; in mapping()
709 Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) { in mapping()
710 Style.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in mapping()
725 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon) { in mapping()
726 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in mapping()
737 if (Style.QualifierAlignment == FormatStyle::QAS_Right) in mapping()
739 else if (Style.QualifierAlignment == FormatStyle::QAS_Left) in mapping()
741 else if (Style.QualifierAlignment == FormatStyle::QAS_Custom) in mapping()
779 if (Style.PackConstructorInitializers == FormatStyle::PCIS_BinPack && in mapping()
782 ? FormatStyle::PCIS_NextLine in mapping()
783 : FormatStyle::PCIS_CurrentLine; in mapping()
786 FormatStyle::PCIS_NextLine) { in mapping()
788 Style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in mapping()
790 Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; in mapping()
910 template <> struct MappingTraits<FormatStyle::BraceWrappingFlags> {
911 static void mapping(IO &IO, FormatStyle::BraceWrappingFlags &Wrapping) { in mapping()
933 template <> struct MappingTraits<FormatStyle::SpaceBeforeParensCustom> {
934 static void mapping(IO &IO, FormatStyle::SpaceBeforeParensCustom &Spacing) { in mapping()
951 template <> struct MappingTraits<FormatStyle::RawStringFormat> {
952 static void mapping(IO &IO, FormatStyle::RawStringFormat &Format) { in mapping()
961 template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
962 static void mapping(IO &IO, FormatStyle::SpacesInLineComment &Space) { in mapping()
979 template <> struct DocumentListTraits<std::vector<FormatStyle>> {
980 static size_t size(IO &IO, std::vector<FormatStyle> &Seq) { in size()
983 static FormatStyle &element(IO &IO, std::vector<FormatStyle> &Seq, in element()
987 FormatStyle Template; in element()
988 if (!Seq.empty() && Seq[0].Language == FormatStyle::LK_None) { in element()
991 Template = *((const FormatStyle *)IO.getContext()); in element()
992 Template.Language = FormatStyle::LK_None; in element()
1044 static void expandPresetsBraceWrapping(FormatStyle &Expanded) { in expandPresetsBraceWrapping()
1045 if (Expanded.BreakBeforeBraces == FormatStyle::BS_Custom) in expandPresetsBraceWrapping()
1049 /*AfterControlStatement=*/FormatStyle::BWACS_Never, in expandPresetsBraceWrapping()
1066 case FormatStyle::BS_Linux: in expandPresetsBraceWrapping()
1071 case FormatStyle::BS_Mozilla: in expandPresetsBraceWrapping()
1078 Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in expandPresetsBraceWrapping()
1082 case FormatStyle::BS_Stroustrup: in expandPresetsBraceWrapping()
1087 case FormatStyle::BS_Allman: in expandPresetsBraceWrapping()
1090 Expanded.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in expandPresetsBraceWrapping()
1098 Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in expandPresetsBraceWrapping()
1103 case FormatStyle::BS_Whitesmiths: in expandPresetsBraceWrapping()
1106 Expanded.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in expandPresetsBraceWrapping()
1113 Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in expandPresetsBraceWrapping()
1118 case FormatStyle::BS_GNU: in expandPresetsBraceWrapping()
1122 /*AfterControlStatement=*/FormatStyle::BWACS_Always, in expandPresetsBraceWrapping()
1138 Expanded.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in expandPresetsBraceWrapping()
1140 case FormatStyle::BS_WebKit: in expandPresetsBraceWrapping()
1148 static void expandPresetsSpaceBeforeParens(FormatStyle &Expanded) { in expandPresetsSpaceBeforeParens()
1149 if (Expanded.SpaceBeforeParens == FormatStyle::SBPO_Custom) in expandPresetsSpaceBeforeParens()
1155 case FormatStyle::SBPO_Never: in expandPresetsSpaceBeforeParens()
1157 case FormatStyle::SBPO_ControlStatements: in expandPresetsSpaceBeforeParens()
1162 case FormatStyle::SBPO_ControlStatementsExceptControlMacros: in expandPresetsSpaceBeforeParens()
1165 case FormatStyle::SBPO_NonEmptyParentheses: in expandPresetsSpaceBeforeParens()
1168 case FormatStyle::SBPO_Always: in expandPresetsSpaceBeforeParens()
1175 FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { in getLLVMStyle()
1176 FormatStyle LLVMStyle; in getLLVMStyle()
1180 LLVMStyle.AlignEscapedNewlines = FormatStyle::ENAS_Right; in getLLVMStyle()
1181 LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; in getLLVMStyle()
1182 LLVMStyle.AlignArrayOfStructures = FormatStyle::AIAS_None; in getLLVMStyle()
1183 LLVMStyle.AlignOperands = FormatStyle::OAS_Align; in getLLVMStyle()
1197 LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All; in getLLVMStyle()
1198 LLVMStyle.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; in getLLVMStyle()
1200 LLVMStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getLLVMStyle()
1201 LLVMStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_All; in getLLVMStyle()
1203 LLVMStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in getLLVMStyle()
1204 LLVMStyle.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getLLVMStyle()
1206 LLVMStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_MultiLine; in getLLVMStyle()
1210 LLVMStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_None; in getLLVMStyle()
1211 LLVMStyle.BreakBeforeConceptDeclarations = FormatStyle::BBCDS_Always; in getLLVMStyle()
1213 LLVMStyle.BreakBeforeBraces = FormatStyle::BS_Attach; in getLLVMStyle()
1216 /*AfterControlStatement=*/FormatStyle::BWACS_Never, in getLLVMStyle()
1232 LLVMStyle.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in getLLVMStyle()
1234 LLVMStyle.BreakConstructorInitializers = FormatStyle::BCIS_BeforeColon; in getLLVMStyle()
1235 LLVMStyle.BreakInheritanceList = FormatStyle::BILS_BeforeColon; in getLLVMStyle()
1245 LLVMStyle.QualifierAlignment = FormatStyle::QAS_Leave; in getLLVMStyle()
1249 LLVMStyle.EmptyLineAfterAccessModifier = FormatStyle::ELAAMS_Never; in getLLVMStyle()
1250 LLVMStyle.EmptyLineBeforeAccessModifier = FormatStyle::ELBAMS_LogicalBlock; in getLLVMStyle()
1252 LLVMStyle.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in getLLVMStyle()
1268 LLVMStyle.IndentPPDirectives = FormatStyle::PPDIS_None; in getLLVMStyle()
1274 LLVMStyle.InsertTrailingCommas = FormatStyle::TCS_None; in getLLVMStyle()
1275 LLVMStyle.JavaScriptQuotes = FormatStyle::JSQS_Leave; in getLLVMStyle()
1278 LLVMStyle.LambdaBodyIndentation = FormatStyle::LBI_Signature; in getLLVMStyle()
1281 LLVMStyle.NamespaceIndentation = FormatStyle::NI_None; in getLLVMStyle()
1282 LLVMStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Auto; in getLLVMStyle()
1287 LLVMStyle.PointerAlignment = FormatStyle::PAS_Right; in getLLVMStyle()
1288 LLVMStyle.ReferenceAlignment = FormatStyle::RAS_Pointer; in getLLVMStyle()
1289 LLVMStyle.RequiresClausePosition = FormatStyle::RCPS_OwnLine; in getLLVMStyle()
1290 LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave; in getLLVMStyle()
1293 LLVMStyle.Standard = FormatStyle::LS_Latest; in getLLVMStyle()
1295 LLVMStyle.UseTab = FormatStyle::UT_Never; in getLLVMStyle()
1308 LLVMStyle.SpaceAroundPointerQualifiers = FormatStyle::SAPQ_Default; in getLLVMStyle()
1312 LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements; in getLLVMStyle()
1321 LLVMStyle.BitFieldColonSpacing = FormatStyle::BFCS_Both; in getLLVMStyle()
1322 LLVMStyle.SpacesInAngles = FormatStyle::SIAS_Never; in getLLVMStyle()
1337 LLVMStyle.SortIncludes = FormatStyle::SI_CaseSensitive; in getLLVMStyle()
1338 LLVMStyle.SortJavaStaticImport = FormatStyle::SJSIO_Before; in getLLVMStyle()
1350 if (Language == FormatStyle::LK_TableGen) in getLLVMStyle()
1358 FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { in getGoogleStyle()
1359 if (Language == FormatStyle::LK_TextProto) { in getGoogleStyle()
1360 FormatStyle GoogleStyle = getGoogleStyle(FormatStyle::LK_Proto); in getGoogleStyle()
1361 GoogleStyle.Language = FormatStyle::LK_TextProto; in getGoogleStyle()
1366 FormatStyle GoogleStyle = getLLVMStyle(Language); in getGoogleStyle()
1369 GoogleStyle.AlignEscapedNewlines = FormatStyle::ENAS_Left; in getGoogleStyle()
1371 FormatStyle::SIS_WithoutElse; in getGoogleStyle()
1374 GoogleStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; in getGoogleStyle()
1384 GoogleStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Never; in getGoogleStyle()
1387 GoogleStyle.PackConstructorInitializers = FormatStyle::PCIS_NextLine; in getGoogleStyle()
1388 GoogleStyle.PointerAlignment = FormatStyle::PAS_Left; in getGoogleStyle()
1391 FormatStyle::LK_Cpp, in getGoogleStyle()
1408 FormatStyle::LK_TextProto, in getGoogleStyle()
1433 GoogleStyle.Standard = FormatStyle::LS_Auto; in getGoogleStyle()
1438 if (Language == FormatStyle::LK_Java) { in getGoogleStyle()
1439 GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getGoogleStyle()
1440 GoogleStyle.AlignOperands = FormatStyle::OAS_DontAlign; in getGoogleStyle()
1442 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1443 GoogleStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getGoogleStyle()
1445 GoogleStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; in getGoogleStyle()
1449 } else if (Language == FormatStyle::LK_JavaScript) { in getGoogleStyle()
1450 GoogleStyle.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; in getGoogleStyle()
1451 GoogleStyle.AlignOperands = FormatStyle::OAS_DontAlign; in getGoogleStyle()
1452 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1454 GoogleStyle.AllowShortLambdasOnASingleLine = FormatStyle::SLS_Empty; in getGoogleStyle()
1464 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; in getGoogleStyle()
1466 GoogleStyle.JavaScriptQuotes = FormatStyle::JSQS_Single; in getGoogleStyle()
1468 } else if (Language == FormatStyle::LK_Proto) { in getGoogleStyle()
1469 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1479 } else if (Language == FormatStyle::LK_ObjC) { in getGoogleStyle()
1487 } else if (Language == FormatStyle::LK_CSharp) { in getGoogleStyle()
1488 GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Empty; in getGoogleStyle()
1489 GoogleStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getGoogleStyle()
1492 GoogleStyle.NamespaceIndentation = FormatStyle::NI_All; in getGoogleStyle()
1498 FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) { in getChromiumStyle()
1499 FormatStyle ChromiumStyle = getGoogleStyle(Language); in getChromiumStyle()
1521 if (Language == FormatStyle::LK_Java) { in getChromiumStyle()
1523 FormatStyle::SIS_WithoutElse; in getChromiumStyle()
1541 ChromiumStyle.SortIncludes = FormatStyle::SI_CaseSensitive; in getChromiumStyle()
1542 } else if (Language == FormatStyle::LK_JavaScript) { in getChromiumStyle()
1543 ChromiumStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getChromiumStyle()
1547 ChromiumStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; in getChromiumStyle()
1548 ChromiumStyle.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getChromiumStyle()
1552 if (Language == FormatStyle::LK_ObjC) in getChromiumStyle()
1558 FormatStyle getMozillaStyle() { in getMozillaStyle()
1559 FormatStyle MozillaStyle = getLLVMStyle(); in getMozillaStyle()
1561 MozillaStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; in getMozillaStyle()
1562 MozillaStyle.AlwaysBreakAfterReturnType = FormatStyle::RTBS_TopLevel; in getMozillaStyle()
1564 FormatStyle::DRTBS_TopLevel; in getMozillaStyle()
1565 MozillaStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; in getMozillaStyle()
1568 MozillaStyle.BreakBeforeBraces = FormatStyle::BS_Mozilla; in getMozillaStyle()
1569 MozillaStyle.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getMozillaStyle()
1570 MozillaStyle.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in getMozillaStyle()
1579 MozillaStyle.PointerAlignment = FormatStyle::PAS_Left; in getMozillaStyle()
1584 FormatStyle getWebKitStyle() { in getWebKitStyle()
1585 FormatStyle Style = getLLVMStyle(); in getWebKitStyle()
1587 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
1588 Style.AlignOperands = FormatStyle::OAS_DontAlign; in getWebKitStyle()
1590 Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Empty; in getWebKitStyle()
1591 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
1592 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
1593 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getWebKitStyle()
1598 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
1601 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
1607 FormatStyle getGNUStyle() { in getGNUStyle()
1608 FormatStyle Style = getLLVMStyle(); in getGNUStyle()
1609 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
1610 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
1611 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
1612 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
1617 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
1618 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
1622 FormatStyle getMicrosoftStyle(FormatStyle::LanguageKind Language) { in getMicrosoftStyle()
1623 FormatStyle Style = getLLVMStyle(Language); in getMicrosoftStyle()
1627 Style.UseTab = FormatStyle::UT_Never; in getMicrosoftStyle()
1628 Style.BreakBeforeBraces = FormatStyle::BS_Custom; in getMicrosoftStyle()
1630 Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in getMicrosoftStyle()
1637 Style.IndentExternBlock = FormatStyle::IEBS_AfterExternBlock; in getMicrosoftStyle()
1643 Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; in getMicrosoftStyle()
1645 Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getMicrosoftStyle()
1647 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getMicrosoftStyle()
1648 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in getMicrosoftStyle()
1652 FormatStyle getNoStyle() { in getNoStyle()
1653 FormatStyle NoStyle = getLLVMStyle(); in getNoStyle()
1655 NoStyle.SortIncludes = FormatStyle::SI_Never; in getNoStyle()
1660 bool getPredefinedStyle(StringRef Name, FormatStyle::LanguageKind Language, in getPredefinedStyle()
1661 FormatStyle *Style) { in getPredefinedStyle()
1687 ParseError validateQualifierOrder(FormatStyle *Style) { in validateQualifierOrder()
1722 FormatStyle *Style, bool AllowUnknownOptions, in parseConfiguration()
1726 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
1727 assert(Language != FormatStyle::LK_None); in parseConfiguration()
1731 std::vector<FormatStyle> Styles; in parseConfiguration()
1746 if (Styles[i].Language == FormatStyle::LK_None && i != 0) in parseConfiguration()
1761 FormatStyle::FormatStyleSet StyleSet; in parseConfiguration()
1763 for (const FormatStyle &Style : llvm::reverse(Styles)) { in parseConfiguration()
1764 if (Style.Language != FormatStyle::LK_None) in parseConfiguration()
1770 if (Styles.empty() || Styles[0].Language != FormatStyle::LK_None) in parseConfiguration()
1772 FormatStyle DefaultStyle = Styles[0]; in parseConfiguration()
1777 if (Style->InsertTrailingCommas != FormatStyle::TCS_None && in parseConfiguration()
1782 if (Style->QualifierAlignment != FormatStyle::QAS_Leave) in parseConfiguration()
1787 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText()
1793 FormatStyle NonConstStyle = Style; in configurationAsText()
1801 llvm::Optional<FormatStyle>
1802 FormatStyle::FormatStyleSet::Get(FormatStyle::LanguageKind Language) const { in Get()
1808 FormatStyle Style = It->second; in Get()
1813 void FormatStyle::FormatStyleSet::Add(FormatStyle Style) { in Add()
1824 void FormatStyle::FormatStyleSet::Clear() { Styles.reset(); } in Clear()
1826 llvm::Optional<FormatStyle>
1827 FormatStyle::GetLanguageStyle(FormatStyle::LanguageKind Language) const { in GetLanguageStyle()
1835 BracesInserter(const Environment &Env, const FormatStyle &Style) in BracesInserter()
1879 BracesRemover(const Environment &Env, const FormatStyle &Style) in BracesRemover()
1929 JavaScriptRequoter(const Environment &Env, const FormatStyle &Style) in JavaScriptRequoter()
1957 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
1959 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
1965 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
2017 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter()
2127 ? FormatStyle::PAS_Left in deriveLocalStyle()
2128 : FormatStyle::PAS_Right; in deriveLocalStyle()
2129 Style.ReferenceAlignment = FormatStyle::RAS_Pointer; in deriveLocalStyle()
2131 if (Style.Standard == FormatStyle::LS_Auto) { in deriveLocalStyle()
2133 ? FormatStyle::LS_Latest in deriveLocalStyle()
2134 : FormatStyle::LS_Cpp03; in deriveLocalStyle()
2157 TrailingCommaInserter(const Environment &Env, const FormatStyle &Style) in TrailingCommaInserter()
2218 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner()
2441 ObjCHeaderStyleGuesser(const Environment &Env, const FormatStyle &Style) in ObjCHeaderStyleGuesser()
2448 assert(Style.Language == FormatStyle::LK_Cpp); in analyze()
2663 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes()
2678 if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) { in sortCppIncludes()
2768 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes()
2880 static unsigned findJavaImportGroup(const FormatStyle &Style, in findJavaImportGroup()
2900 static void sortJavaImports(const FormatStyle &Style, in sortJavaImports()
2919 Style.SortJavaStaticImport == FormatStyle::SJSIO_After; in sortJavaImports()
2982 tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code, in sortJavaImports()
3043 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes()
3051 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript && in sortIncludes()
3055 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
3057 if (Style.Language == FormatStyle::LanguageKind::LK_Java) in sortIncludes()
3067 const FormatStyle &Style) { in processReplacements()
3085 const FormatStyle &Style) { in formatReplacements()
3088 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3100 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3123 const FormatStyle &Style) { in fixCppIncludeInsertions()
3195 const FormatStyle &Style) { in cleanupAroundReplacements()
3198 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
3211 reformat(const FormatStyle &Style, StringRef Code, in reformat()
3215 FormatStyle Expanded = Style; in reformat()
3219 case FormatStyle::RCPS_SingleLine: in reformat()
3220 case FormatStyle::RCPS_WithPreceding: in reformat()
3231 if (Expanded.Language == FormatStyle::LK_JavaScript && isMpegTS(Code)) in reformat()
3259 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) { in reformat()
3293 if (Style.SeparateDefinitionBlocks != FormatStyle::SDS_Leave) { in reformat()
3300 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) { in reformat()
3311 Style.InsertTrailingCommas == FormatStyle::TCS_Wrapped) { in reformat()
3347 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat()
3358 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup()
3362 if (Style.Language != FormatStyle::LK_Cpp) in cleanup()
3370 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat()
3380 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, in fixNamespaceEndComments()
3390 tooling::Replacements separateDefinitionBlocks(const FormatStyle &Style, in separateDefinitionBlocks()
3400 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, in sortUsingDeclarations()
3410 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts()
3413 FormatStyle::LanguageStandard LexingStd = Style.Standard; in getFormattingLangOpts()
3414 if (LexingStd == FormatStyle::LS_Auto) in getFormattingLangOpts()
3415 LexingStd = FormatStyle::LS_Latest; in getFormattingLangOpts()
3416 if (LexingStd == FormatStyle::LS_Latest) in getFormattingLangOpts()
3417 LexingStd = FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3419 LangOpts.CPlusPlus11 = LexingStd >= FormatStyle::LS_Cpp11; in getFormattingLangOpts()
3420 LangOpts.CPlusPlus14 = LexingStd >= FormatStyle::LS_Cpp14; in getFormattingLangOpts()
3421 LangOpts.CPlusPlus17 = LexingStd >= FormatStyle::LS_Cpp17; in getFormattingLangOpts()
3422 LangOpts.CPlusPlus20 = LexingStd >= FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3423 LangOpts.Char8 = LexingStd >= FormatStyle::LS_Cpp20; in getFormattingLangOpts()
3427 LangOpts.Digraphs = LexingStd >= FormatStyle::LS_Cpp11; in getFormattingLangOpts()
3455 static FormatStyle::LanguageKind getLanguageByFileName(StringRef FileName) { in getLanguageByFileName()
3457 return FormatStyle::LK_Java; in getLanguageByFileName()
3461 return FormatStyle::LK_JavaScript; // (module) JavaScript or TypeScript. in getLanguageByFileName()
3464 return FormatStyle::LK_ObjC; in getLanguageByFileName()
3467 return FormatStyle::LK_Proto; in getLanguageByFileName()
3473 return FormatStyle::LK_TextProto; in getLanguageByFileName()
3476 return FormatStyle::LK_TableGen; in getLanguageByFileName()
3478 return FormatStyle::LK_CSharp; in getLanguageByFileName()
3480 return FormatStyle::LK_Json; in getLanguageByFileName()
3485 return FormatStyle::LK_Verilog; in getLanguageByFileName()
3487 return FormatStyle::LK_Cpp; in getLanguageByFileName()
3490 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code) { in guessLanguage()
3492 if (GuessedLanguage == FormatStyle::LK_Cpp) { in guessLanguage()
3502 return FormatStyle::LK_ObjC; in guessLanguage()
3515 FormatStyle *Style, bool AllowUnknownOptions) { in loadAndParseConfigFile()
3525 llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName, in getStyle()
3531 FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code)); in getStyle()
3533 FormatStyle FallbackStyle = getNoStyle(); in getStyle()
3604 auto applyChildFormatTexts = [&](FormatStyle *Style) { in getStyle()