Lines Matching refs:Style
201 static void mapping(IO &IO, FormatStyle &Style) { in mapping()
203 IO.mapOptional("Language", Style.Language); in mapping()
212 if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && in mapping()
213 Style == PredefinedStyle) { in mapping()
222 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
225 if (!getPredefinedStyle(BasedOnStyle, Language, &Style)) { in mapping()
229 Style.Language = OldLanguage; in mapping()
235 IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); in mapping()
237 Style.IndentWrappedFunctionNames); in mapping()
238 IO.mapOptional("PointerBindsToType", Style.PointerAlignment); in mapping()
240 Style.SpaceBeforeParens); in mapping()
243 IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); in mapping()
244 IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); in mapping()
246 Style.AlignConsecutiveAssignments); in mapping()
248 Style.AlignConsecutiveDeclarations); in mapping()
249 IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlinesLeft); in mapping()
250 IO.mapOptional("AlignOperands", Style.AlignOperands); in mapping()
251 IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); in mapping()
253 Style.AllowAllParametersOfDeclarationOnNextLine); in mapping()
255 Style.AllowShortBlocksOnASingleLine); in mapping()
257 Style.AllowShortCaseLabelsOnASingleLine); in mapping()
259 Style.AllowShortFunctionsOnASingleLine); in mapping()
261 Style.AllowShortIfStatementsOnASingleLine); in mapping()
263 Style.AllowShortLoopsOnASingleLine); in mapping()
265 Style.AlwaysBreakAfterDefinitionReturnType); in mapping()
267 Style.AlwaysBreakAfterReturnType); in mapping()
271 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
272 Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
273 if (Style.AlwaysBreakAfterDefinitionReturnType == FormatStyle::DRTBS_All) in mapping()
274 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
275 else if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
277 Style.AlwaysBreakAfterReturnType = in mapping()
282 Style.AlwaysBreakBeforeMultilineStrings); in mapping()
284 Style.AlwaysBreakTemplateDeclarations); in mapping()
285 IO.mapOptional("BinPackArguments", Style.BinPackArguments); in mapping()
286 IO.mapOptional("BinPackParameters", Style.BinPackParameters); in mapping()
287 IO.mapOptional("BraceWrapping", Style.BraceWrapping); in mapping()
289 Style.BreakBeforeBinaryOperators); in mapping()
290 IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); in mapping()
292 Style.BreakBeforeTernaryOperators); in mapping()
294 Style.BreakConstructorInitializersBeforeComma); in mapping()
296 Style.BreakAfterJavaFieldAnnotations); in mapping()
297 IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); in mapping()
298 IO.mapOptional("ColumnLimit", Style.ColumnLimit); in mapping()
299 IO.mapOptional("CommentPragmas", Style.CommentPragmas); in mapping()
301 Style.ConstructorInitializerAllOnOneLineOrOnePerLine); in mapping()
303 Style.ConstructorInitializerIndentWidth); in mapping()
304 IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); in mapping()
305 IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); in mapping()
306 IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); in mapping()
307 IO.mapOptional("DisableFormat", Style.DisableFormat); in mapping()
309 Style.ExperimentalAutoDetectBinPacking); in mapping()
310 IO.mapOptional("ForEachMacros", Style.ForEachMacros); in mapping()
311 IO.mapOptional("IncludeCategories", Style.IncludeCategories); in mapping()
312 IO.mapOptional("IncludeIsMainRegex", Style.IncludeIsMainRegex); in mapping()
313 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); in mapping()
314 IO.mapOptional("IndentWidth", Style.IndentWidth); in mapping()
316 Style.IndentWrappedFunctionNames); in mapping()
317 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes); in mapping()
318 IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports); in mapping()
320 Style.KeepEmptyLinesAtTheStartOfBlocks); in mapping()
321 IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin); in mapping()
322 IO.mapOptional("MacroBlockEnd", Style.MacroBlockEnd); in mapping()
323 IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); in mapping()
324 IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); in mapping()
325 IO.mapOptional("ObjCBlockIndentWidth", Style.ObjCBlockIndentWidth); in mapping()
326 IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty); in mapping()
328 Style.ObjCSpaceBeforeProtocolList); in mapping()
330 Style.PenaltyBreakBeforeFirstCallParameter); in mapping()
331 IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); in mapping()
333 Style.PenaltyBreakFirstLessLess); in mapping()
334 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); in mapping()
335 IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); in mapping()
337 Style.PenaltyReturnTypeOnItsOwnLine); in mapping()
338 IO.mapOptional("PointerAlignment", Style.PointerAlignment); in mapping()
339 IO.mapOptional("ReflowComments", Style.ReflowComments); in mapping()
340 IO.mapOptional("SortIncludes", Style.SortIncludes); in mapping()
341 IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); in mapping()
343 Style.SpaceBeforeAssignmentOperators); in mapping()
344 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); in mapping()
345 IO.mapOptional("SpaceInEmptyParentheses", Style.SpaceInEmptyParentheses); in mapping()
347 Style.SpacesBeforeTrailingComments); in mapping()
348 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles); in mapping()
350 Style.SpacesInContainerLiterals); in mapping()
352 Style.SpacesInCStyleCastParentheses); in mapping()
353 IO.mapOptional("SpacesInParentheses", Style.SpacesInParentheses); in mapping()
354 IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); in mapping()
355 IO.mapOptional("Standard", Style.Standard); in mapping()
356 IO.mapOptional("TabWidth", Style.TabWidth); in mapping()
357 IO.mapOptional("UseTab", Style.UseTab); in mapping()
439 static FormatStyle expandPresets(const FormatStyle &Style) { in expandPresets() argument
440 if (Style.BreakBeforeBraces == FormatStyle::BS_Custom) in expandPresets()
441 return Style; in expandPresets()
442 FormatStyle Expanded = Style; in expandPresets()
445 switch (Style.BreakBeforeBraces) { in expandPresets()
671 FormatStyle Style = getLLVMStyle(); in getWebKitStyle() local
672 Style.AccessModifierOffset = -4; in getWebKitStyle()
673 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
674 Style.AlignOperands = false; in getWebKitStyle()
675 Style.AlignTrailingComments = false; in getWebKitStyle()
676 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
677 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
678 Style.BreakConstructorInitializersBeforeComma = true; in getWebKitStyle()
679 Style.Cpp11BracedListStyle = false; in getWebKitStyle()
680 Style.ColumnLimit = 0; in getWebKitStyle()
681 Style.IndentWidth = 4; in getWebKitStyle()
682 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
683 Style.ObjCBlockIndentWidth = 4; in getWebKitStyle()
684 Style.ObjCSpaceAfterProperty = true; in getWebKitStyle()
685 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
686 Style.Standard = FormatStyle::LS_Cpp03; in getWebKitStyle()
687 return Style; in getWebKitStyle()
691 FormatStyle Style = getLLVMStyle(); in getGNUStyle() local
692 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
693 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
694 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
695 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
696 Style.BreakBeforeTernaryOperators = true; in getGNUStyle()
697 Style.Cpp11BracedListStyle = false; in getGNUStyle()
698 Style.ColumnLimit = 79; in getGNUStyle()
699 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
700 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
701 return Style; in getGNUStyle()
712 FormatStyle *Style) { in getPredefinedStyle() argument
714 *Style = getLLVMStyle(); in getPredefinedStyle()
716 *Style = getChromiumStyle(Language); in getPredefinedStyle()
718 *Style = getMozillaStyle(); in getPredefinedStyle()
720 *Style = getGoogleStyle(Language); in getPredefinedStyle()
722 *Style = getWebKitStyle(); in getPredefinedStyle()
724 *Style = getGNUStyle(); in getPredefinedStyle()
726 *Style = getNoStyle(); in getPredefinedStyle()
731 Style->Language = Language; in getPredefinedStyle()
735 std::error_code parseConfiguration(StringRef Text, FormatStyle *Style) { in parseConfiguration() argument
736 assert(Style); in parseConfiguration()
737 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
748 Input.setContext(Style); in parseConfiguration()
773 *Style = Styles[i]; in parseConfiguration()
774 Style->Language = Language; in parseConfiguration()
781 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText() argument
787 FormatStyle NonConstStyle = expandPresets(Style); in configurationAsText()
796 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter() argument
798 : TokenAnalyzer(Env, Style), IncompleteFormat(IncompleteFormat) {} in Formatter()
808 if (Style.Language == FormatStyle::LK_JavaScript && in analyze()
809 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) in analyze()
819 Env.getSourceManager(), Style, in analyze()
821 ContinuationIndenter Indenter(Style, Tokens.getKeywords(), in analyze()
824 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, Tokens.getKeywords(), in analyze()
847 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
849 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
854 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
966 if (Style.DerivePointerAlignment) in deriveLocalStyle()
967 Style.PointerAlignment = countVariableAlignments(AnnotatedLines) <= 0 in deriveLocalStyle()
970 if (Style.Standard == FormatStyle::LS_Auto) in deriveLocalStyle()
971 Style.Standard = hasCpp03IncompatibleFormat(AnnotatedLines) in deriveLocalStyle()
986 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner() argument
987 : TokenAnalyzer(Env, Style), in Cleaner()
1054 if (Style.BraceWrapping.AfterNamespace) { in checkEmptyNamespace()
1216 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes() argument
1270 IncludeCategoryManager(const FormatStyle &Style, StringRef FileName) in IncludeCategoryManager() argument
1271 : Style(Style), FileName(FileName) { in IncludeCategoryManager()
1273 for (const auto &Category : Style.IncludeCategories) in IncludeCategoryManager()
1288 Ret = Style.IncludeCategories[i].Priority; in getIncludePriority()
1304 (HeaderStem + Style.IncludeIsMainRegex).str()); in isMainHeader()
1311 const FormatStyle &Style; member in clang::format::__anon5fb509880511::IncludeCategoryManager
1323 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes() argument
1341 IncludeCategoryManager Categories(Style, FileName); in sortCppIncludes()
1367 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces, in sortCppIncludes()
1379 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Replaces, Cursor); in sortCppIncludes()
1383 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes() argument
1387 if (!Style.SortIncludes) in sortIncludes()
1389 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
1390 return sortJavaScriptImports(Style, Code, Ranges, FileName); in sortIncludes()
1391 sortCppIncludes(Style, Code, Ranges, FileName, Replaces, Cursor); in sortIncludes()
1399 const FormatStyle &Style) { in processReplacements() argument
1411 ProcessFunc(Style, *NewCode, ChangedRanges, FileName); in processReplacements()
1418 const FormatStyle &Style) { in formatReplacements() argument
1421 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
1424 return sortIncludes(Style, Code, Ranges, FileName); in formatReplacements()
1427 processReplacements(SortIncludes, Code, Replaces, Style); in formatReplacements()
1433 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements() argument
1436 return reformat(Style, Code, Ranges, FileName); in formatReplacements()
1438 return processReplacements(Reformat, Code, *SortedReplaces, Style); in formatReplacements()
1469 const FormatStyle &Style) { in getOffsetAfterHeaderGuardsAndComments() argument
1474 getFormattingLangOpts(Style)); in getOffsetAfterHeaderGuardsAndComments()
1496 const FormatStyle &Style) { in fixCppIncludeInsertions() argument
1497 if (Style.Language != FormatStyle::LanguageKind::LK_Cpp) in fixCppIncludeInsertions()
1521 IncludeCategoryManager Categories(Style, FileName); in fixCppIncludeInsertions()
1528 for (const auto &Category : Style.IncludeCategories) in fixCppIncludeInsertions()
1533 getOffsetAfterHeaderGuardsAndComments(FileName, Code, Style); in fixCppIncludeInsertions()
1600 const FormatStyle &Style) { in cleanupAroundReplacements() argument
1603 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
1606 return cleanup(Style, Code, Ranges, FileName); in cleanupAroundReplacements()
1610 fixCppIncludeInsertions(Code, Replaces, Style); in cleanupAroundReplacements()
1611 return processReplacements(Cleanup, Code, NewReplaces, Style); in cleanupAroundReplacements()
1614 tooling::Replacements reformat(const FormatStyle &Style, SourceManager &SM, in reformat() argument
1617 FormatStyle Expanded = expandPresets(Style); in reformat()
1626 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
1629 FormatStyle Expanded = expandPresets(Style); in reformat()
1639 tooling::Replacements cleanup(const FormatStyle &Style, SourceManager &SM, in cleanup() argument
1642 Cleaner Clean(Env, Style); in cleanup()
1646 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup() argument
1651 Cleaner Clean(*Env, Style); in cleanup()
1655 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts() argument
1658 LangOpts.CPlusPlus11 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
1659 LangOpts.CPlusPlus14 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1; in getFormattingLangOpts()
1661 bool AlternativeOperators = Style.Language == FormatStyle::LK_Cpp; in getFormattingLangOpts()
1700 FormatStyle Style = getLLVMStyle(); in getStyle() local
1701 Style.Language = getLanguageByFileName(FileName); in getStyle()
1702 if (!getPredefinedStyle(FallbackStyle, Style.Language, &Style)) { in getStyle()
1705 return Style; in getStyle()
1710 if (std::error_code ec = parseConfiguration(StyleName, &Style)) { in getStyle()
1714 return Style; in getStyle()
1718 if (!getPredefinedStyle(StyleName, Style.Language, &Style)) in getStyle()
1721 return Style; in getStyle()
1763 parseConfiguration(Text.get()->getBuffer(), &Style)) { in getStyle()
1775 return Style; in getStyle()
1780 << getLanguageName(Style.Language) << ": " in getStyle()
1783 return Style; in getStyle()