Lines Matching refs:Style
272 static void mapping(IO &IO, FormatStyle &Style) { in mapping()
274 IO.mapOptional("Language", Style.Language); in mapping()
283 if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && in mapping()
284 Style == PredefinedStyle) { in mapping()
293 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
296 if (!getPredefinedStyle(BasedOnStyle, Language, &Style)) { in mapping()
300 Style.Language = OldLanguage; in mapping()
306 IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlines); in mapping()
307 IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); in mapping()
309 Style.IndentWrappedFunctionNames); in mapping()
310 IO.mapOptional("PointerBindsToType", Style.PointerAlignment); in mapping()
312 Style.SpaceBeforeParens); in mapping()
315 IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); in mapping()
316 IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); in mapping()
318 Style.AlignConsecutiveAssignments); in mapping()
320 Style.AlignConsecutiveDeclarations); in mapping()
321 IO.mapOptional("AlignEscapedNewlines", Style.AlignEscapedNewlines); in mapping()
322 IO.mapOptional("AlignOperands", Style.AlignOperands); in mapping()
323 IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); in mapping()
325 Style.AllowAllParametersOfDeclarationOnNextLine); in mapping()
327 Style.AllowShortBlocksOnASingleLine); in mapping()
329 Style.AllowShortCaseLabelsOnASingleLine); in mapping()
331 Style.AllowShortFunctionsOnASingleLine); in mapping()
333 Style.AllowShortIfStatementsOnASingleLine); in mapping()
335 Style.AllowShortLoopsOnASingleLine); in mapping()
337 Style.AlwaysBreakAfterDefinitionReturnType); in mapping()
339 Style.AlwaysBreakAfterReturnType); in mapping()
343 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
344 Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
345 if (Style.AlwaysBreakAfterDefinitionReturnType == FormatStyle::DRTBS_All) in mapping()
346 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
347 else if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
349 Style.AlwaysBreakAfterReturnType = in mapping()
354 Style.AlwaysBreakBeforeMultilineStrings); in mapping()
356 Style.AlwaysBreakTemplateDeclarations); in mapping()
357 IO.mapOptional("BinPackArguments", Style.BinPackArguments); in mapping()
358 IO.mapOptional("BinPackParameters", Style.BinPackParameters); in mapping()
359 IO.mapOptional("BraceWrapping", Style.BraceWrapping); in mapping()
361 Style.BreakBeforeBinaryOperators); in mapping()
362 IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); in mapping()
368 Style.BreakInheritanceList); in mapping()
373 Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) in mapping()
374 Style.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in mapping()
377 Style.BreakBeforeTernaryOperators); in mapping()
383 Style.BreakConstructorInitializers); in mapping()
388 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon) in mapping()
389 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in mapping()
392 Style.BreakAfterJavaFieldAnnotations); in mapping()
393 IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); in mapping()
394 IO.mapOptional("ColumnLimit", Style.ColumnLimit); in mapping()
395 IO.mapOptional("CommentPragmas", Style.CommentPragmas); in mapping()
396 IO.mapOptional("CompactNamespaces", Style.CompactNamespaces); in mapping()
398 Style.ConstructorInitializerAllOnOneLineOrOnePerLine); in mapping()
400 Style.ConstructorInitializerIndentWidth); in mapping()
401 IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); in mapping()
402 IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); in mapping()
403 IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); in mapping()
404 IO.mapOptional("DisableFormat", Style.DisableFormat); in mapping()
406 Style.ExperimentalAutoDetectBinPacking); in mapping()
407 IO.mapOptional("FixNamespaceComments", Style.FixNamespaceComments); in mapping()
408 IO.mapOptional("ForEachMacros", Style.ForEachMacros); in mapping()
409 IO.mapOptional("IncludeBlocks", Style.IncludeStyle.IncludeBlocks); in mapping()
410 IO.mapOptional("IncludeCategories", Style.IncludeStyle.IncludeCategories); in mapping()
411 IO.mapOptional("IncludeIsMainRegex", Style.IncludeStyle.IncludeIsMainRegex); in mapping()
412 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); in mapping()
413 IO.mapOptional("IndentPPDirectives", Style.IndentPPDirectives); in mapping()
414 IO.mapOptional("IndentWidth", Style.IndentWidth); in mapping()
416 Style.IndentWrappedFunctionNames); in mapping()
417 IO.mapOptional("JavaImportGroups", Style.JavaImportGroups); in mapping()
418 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes); in mapping()
419 IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports); in mapping()
421 Style.KeepEmptyLinesAtTheStartOfBlocks); in mapping()
422 IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin); in mapping()
423 IO.mapOptional("MacroBlockEnd", Style.MacroBlockEnd); in mapping()
424 IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); in mapping()
425 IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); in mapping()
426 IO.mapOptional("ObjCBinPackProtocolList", Style.ObjCBinPackProtocolList); in mapping()
427 IO.mapOptional("ObjCBlockIndentWidth", Style.ObjCBlockIndentWidth); in mapping()
428 IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty); in mapping()
430 Style.ObjCSpaceBeforeProtocolList); in mapping()
431 IO.mapOptional("PenaltyBreakAssignment", Style.PenaltyBreakAssignment); in mapping()
433 Style.PenaltyBreakBeforeFirstCallParameter); in mapping()
434 IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); in mapping()
436 Style.PenaltyBreakFirstLessLess); in mapping()
437 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); in mapping()
439 Style.PenaltyBreakTemplateDeclaration); in mapping()
440 IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); in mapping()
442 Style.PenaltyReturnTypeOnItsOwnLine); in mapping()
443 IO.mapOptional("PointerAlignment", Style.PointerAlignment); in mapping()
444 IO.mapOptional("RawStringFormats", Style.RawStringFormats); in mapping()
445 IO.mapOptional("ReflowComments", Style.ReflowComments); in mapping()
446 IO.mapOptional("SortIncludes", Style.SortIncludes); in mapping()
447 IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations); in mapping()
448 IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); in mapping()
450 Style.SpaceAfterTemplateKeyword); in mapping()
452 Style.SpaceBeforeAssignmentOperators); in mapping()
454 Style.SpaceBeforeCpp11BracedList); in mapping()
456 Style.SpaceBeforeCtorInitializerColon); in mapping()
458 Style.SpaceBeforeInheritanceColon); in mapping()
459 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); in mapping()
461 Style.SpaceBeforeRangeBasedForLoopColon); in mapping()
462 IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses); in mapping()
464 Style.SpacesBeforeTrailingComments); in mapping()
465 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles); in mapping()
467 Style.SpacesInContainerLiterals); in mapping()
469 Style.SpacesInCStyleCastParentheses); in mapping()
470 IO.mapOptional("SpacesInParentheses", Style.SpacesInParentheses); in mapping()
471 IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); in mapping()
472 IO.mapOptional("Standard", Style.Standard); in mapping()
473 IO.mapOptional("StatementMacros", Style.StatementMacros); in mapping()
474 IO.mapOptional("TabWidth", Style.TabWidth); in mapping()
475 IO.mapOptional("UseTab", Style.UseTab); in mapping()
569 static FormatStyle expandPresets(const FormatStyle &Style) { in expandPresets() argument
570 if (Style.BreakBeforeBraces == FormatStyle::BS_Custom) in expandPresets()
571 return Style; in expandPresets()
572 FormatStyle Expanded = Style; in expandPresets()
576 switch (Style.BreakBeforeBraces) { in expandPresets()
908 FormatStyle Style = getLLVMStyle(); in getWebKitStyle() local
909 Style.AccessModifierOffset = -4; in getWebKitStyle()
910 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
911 Style.AlignOperands = false; in getWebKitStyle()
912 Style.AlignTrailingComments = false; in getWebKitStyle()
913 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
914 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
915 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getWebKitStyle()
916 Style.Cpp11BracedListStyle = false; in getWebKitStyle()
917 Style.ColumnLimit = 0; in getWebKitStyle()
918 Style.FixNamespaceComments = false; in getWebKitStyle()
919 Style.IndentWidth = 4; in getWebKitStyle()
920 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
921 Style.ObjCBlockIndentWidth = 4; in getWebKitStyle()
922 Style.ObjCSpaceAfterProperty = true; in getWebKitStyle()
923 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
924 Style.SpaceBeforeCpp11BracedList = true; in getWebKitStyle()
925 return Style; in getWebKitStyle()
929 FormatStyle Style = getLLVMStyle(); in getGNUStyle() local
930 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
931 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
932 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
933 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
934 Style.BreakBeforeTernaryOperators = true; in getGNUStyle()
935 Style.Cpp11BracedListStyle = false; in getGNUStyle()
936 Style.ColumnLimit = 79; in getGNUStyle()
937 Style.FixNamespaceComments = false; in getGNUStyle()
938 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
939 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
940 return Style; in getGNUStyle()
952 FormatStyle *Style) { in getPredefinedStyle() argument
954 *Style = getLLVMStyle(); in getPredefinedStyle()
956 *Style = getChromiumStyle(Language); in getPredefinedStyle()
958 *Style = getMozillaStyle(); in getPredefinedStyle()
960 *Style = getGoogleStyle(Language); in getPredefinedStyle()
962 *Style = getWebKitStyle(); in getPredefinedStyle()
964 *Style = getGNUStyle(); in getPredefinedStyle()
966 *Style = getNoStyle(); in getPredefinedStyle()
971 Style->Language = Language; in getPredefinedStyle()
975 std::error_code parseConfiguration(StringRef Text, FormatStyle *Style) { in parseConfiguration() argument
976 assert(Style); in parseConfiguration()
977 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
981 Style->StyleSet.Clear(); in parseConfiguration()
988 Input.setContext(Style); in parseConfiguration()
1025 *Style = *StyleSet.Get(Language); in parseConfiguration()
1029 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText() argument
1035 FormatStyle NonConstStyle = expandPresets(Style); in configurationAsText()
1047 FormatStyle Style = It->second; in Get() local
1048 Style.StyleSet = *this; in Get()
1049 return Style; in Get()
1052 void FormatStyle::FormatStyleSet::Add(FormatStyle Style) { in Add() argument
1053 assert(Style.Language != LK_None && in Add()
1056 !Style.StyleSet.Styles && in Add()
1060 (*Styles)[Style.Language] = std::move(Style); in Add()
1076 JavaScriptRequoter(const Environment &Env, const FormatStyle &Style) in JavaScriptRequoter() argument
1077 : TokenAnalyzer(Env, Style) {} in JavaScriptRequoter()
1104 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
1106 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
1111 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
1163 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter() argument
1165 : TokenAnalyzer(Env, Style), Status(Status) {} in Formatter()
1180 Env.getSourceManager(), Style, in analyze()
1182 ContinuationIndenter Indenter(Style, Tokens.getKeywords(), in analyze()
1186 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, in analyze()
1261 if (Style.DerivePointerAlignment) in deriveLocalStyle()
1262 Style.PointerAlignment = countVariableAlignments(AnnotatedLines) <= 0 in deriveLocalStyle()
1265 if (Style.Standard == FormatStyle::LS_Auto) in deriveLocalStyle()
1266 Style.Standard = hasCpp03IncompatibleFormat(AnnotatedLines) in deriveLocalStyle()
1281 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner() argument
1282 : TokenAnalyzer(Env, Style), in Cleaner()
1352 if (Style.BraceWrapping.AfterNamespace) { in checkEmptyNamespace()
1499 ObjCHeaderStyleGuesser(const Environment &Env, const FormatStyle &Style) in ObjCHeaderStyleGuesser() argument
1500 : TokenAnalyzer(Env, Style), IsObjC(false) {} in ObjCHeaderStyleGuesser()
1506 assert(Style.Language == FormatStyle::LK_Cpp); in analyze()
1691 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes() argument
1731 Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Preserve) in sortCppIncludes()
1738 if (Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
1766 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes() argument
1784 tooling::IncludeCategoryManager Categories(Style.IncludeStyle, FileName); in sortCppIncludes()
1802 (Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Merge || in sortCppIncludes()
1803 Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
1816 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces, in sortCppIncludes()
1828 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces, Cursor); in sortCppIncludes()
1834 static unsigned findJavaImportGroup(const FormatStyle &Style, in findJavaImportGroup() argument
1838 for (unsigned I = 0; I < Style.JavaImportGroups.size(); I++) { in findJavaImportGroup()
1839 std::string GroupPrefix = Style.JavaImportGroups[I]; in findJavaImportGroup()
1854 static void sortJavaImports(const FormatStyle &Style, in sortJavaImports() argument
1869 findJavaImportGroup(Style, Imports[i].Identifier)); in sortJavaImports()
1923 tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code, in sortJavaImports() argument
1971 sortJavaImports(Style, ImportsInBlock, Ranges, FileName, Replaces); in sortJavaImports()
1984 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes() argument
1988 if (!Style.SortIncludes) in sortIncludes()
1992 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript && in sortIncludes()
1995 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
1996 return sortJavaScriptImports(Style, Code, Ranges, FileName); in sortIncludes()
1997 if (Style.Language == FormatStyle::LanguageKind::LK_Java) in sortIncludes()
1998 return sortJavaImports(Style, Code, Ranges, FileName, Replaces); in sortIncludes()
1999 sortCppIncludes(Style, Code, Ranges, FileName, Replaces, Cursor); in sortIncludes()
2007 const FormatStyle &Style) { in processReplacements() argument
2018 ProcessFunc(Style, *NewCode, ChangedRanges, FileName); in processReplacements()
2025 const FormatStyle &Style) { in formatReplacements() argument
2028 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
2031 return sortIncludes(Style, Code, Ranges, FileName); in formatReplacements()
2034 processReplacements(SortIncludes, Code, Replaces, Style); in formatReplacements()
2040 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements() argument
2043 return reformat(Style, Code, Ranges, FileName); in formatReplacements()
2045 return processReplacements(Reformat, Code, *SortedReplaces, Style); in formatReplacements()
2063 const FormatStyle &Style) { in fixCppIncludeInsertions() argument
2064 if (!Style.isCpp()) in fixCppIncludeInsertions()
2090 tooling::HeaderIncludes Includes(FileName, Code, Style.IncludeStyle); in fixCppIncludeInsertions()
2135 const FormatStyle &Style) { in cleanupAroundReplacements() argument
2138 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
2141 return cleanup(Style, Code, Ranges, FileName); in cleanupAroundReplacements()
2145 fixCppIncludeInsertions(Code, Replaces, Style); in cleanupAroundReplacements()
2146 return processReplacements(Cleanup, Code, NewReplaces, Style); in cleanupAroundReplacements()
2151 reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
2155 FormatStyle Expanded = expandPresets(Style); in reformat()
2168 if (Style.Language == FormatStyle::LK_Cpp) { in reformat()
2169 if (Style.FixNamespaceComments) in reformat()
2174 if (Style.SortUsingDeclarations) in reformat()
2180 if (Style.Language == FormatStyle::LK_JavaScript && in reformat()
2181 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) in reformat()
2217 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
2221 return internal::reformat(Style, Code, Ranges, in reformat()
2228 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup() argument
2232 if (Style.Language != FormatStyle::LK_Cpp) in cleanup()
2234 return Cleaner(Environment(Code, FileName, Ranges), Style).process().first; in cleanup()
2237 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
2241 auto Result = reformat(Style, Code, Ranges, FileName, &Status); in reformat()
2247 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, in fixNamespaceEndComments() argument
2251 return NamespaceEndCommentsFixer(Environment(Code, FileName, Ranges), Style) in fixNamespaceEndComments()
2256 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, in sortUsingDeclarations() argument
2260 return UsingDeclarationsSorter(Environment(Code, FileName, Ranges), Style) in sortUsingDeclarations()
2265 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts() argument
2268 LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
2269 LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
2270 LangOpts.CPlusPlus17 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
2271 LangOpts.CPlusPlus2a = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
2273 bool AlternativeOperators = Style.isCpp(); in getFormattingLangOpts()
2342 FormatStyle Style = getLLVMStyle(); in getStyle() local
2343 Style.Language = guessLanguage(FileName, Code); in getStyle()
2346 if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle)) in getStyle()
2351 if (std::error_code ec = parseConfiguration(StyleName, &Style)) in getStyle()
2353 return Style; in getStyle()
2357 if (!getPredefinedStyle(StyleName, Style.Language, &Style)) in getStyle()
2359 return Style; in getStyle()
2401 parseConfiguration(Text.get()->getBuffer(), &Style)) { in getStyle()
2413 return Style; in getStyle()
2418 getLanguageName(Style.Language) + ": " + in getStyle()