Lines Matching refs:Style

809   static void mapping(IO &IO, FormatStyle &Style) {  in mapping()
811 IO.mapOptional("Language", Style.Language); in mapping()
819 if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && in mapping()
820 Style == PredefinedStyle) { in mapping()
828 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
831 if (!getPredefinedStyle(BasedOnStyle, Language, &Style)) { in mapping()
835 Style.Language = OldLanguage; in mapping()
868 IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlines); in mapping()
870 IO.mapOptional("AlwaysBreakAfterReturnType", Style.BreakAfterReturnType); in mapping()
872 Style.BreakTemplateDeclarations); in mapping()
880 IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); in mapping()
881 IO.mapOptional("KeepEmptyLinesAtEOF", Style.KeepEmptyLines.AtEndOfFile); in mapping()
883 Style.KeepEmptyLines.AtStartOfBlock); in mapping()
885 Style.IndentWrappedFunctionNames); in mapping()
886 IO.mapOptional("IndentRequires", Style.IndentRequiresClause); in mapping()
887 IO.mapOptional("PointerBindsToType", Style.PointerAlignment); in mapping()
889 Style.SpaceBeforeParens); in mapping()
899 IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); in mapping()
900 IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); in mapping()
901 IO.mapOptional("AlignArrayOfStructures", Style.AlignArrayOfStructures); in mapping()
903 Style.AlignConsecutiveAssignments); in mapping()
905 Style.AlignConsecutiveBitFields); in mapping()
907 Style.AlignConsecutiveDeclarations); in mapping()
908 IO.mapOptional("AlignConsecutiveMacros", Style.AlignConsecutiveMacros); in mapping()
910 Style.AlignConsecutiveShortCaseStatements); in mapping()
912 Style.AlignConsecutiveTableGenBreakingDAGArgColons); in mapping()
914 Style.AlignConsecutiveTableGenCondOperatorColons); in mapping()
916 Style.AlignConsecutiveTableGenDefinitionColons); in mapping()
917 IO.mapOptional("AlignEscapedNewlines", Style.AlignEscapedNewlines); in mapping()
918 IO.mapOptional("AlignOperands", Style.AlignOperands); in mapping()
919 IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); in mapping()
921 Style.AllowAllArgumentsOnNextLine); in mapping()
923 Style.AllowAllParametersOfDeclarationOnNextLine); in mapping()
925 Style.AllowBreakBeforeNoexceptSpecifier); in mapping()
927 Style.AllowShortBlocksOnASingleLine); in mapping()
929 Style.AllowShortCaseExpressionOnASingleLine); in mapping()
931 Style.AllowShortCaseLabelsOnASingleLine); in mapping()
933 Style.AllowShortCompoundRequirementOnASingleLine); in mapping()
935 Style.AllowShortEnumsOnASingleLine); in mapping()
937 Style.AllowShortFunctionsOnASingleLine); in mapping()
939 Style.AllowShortIfStatementsOnASingleLine); in mapping()
941 Style.AllowShortLambdasOnASingleLine); in mapping()
943 Style.AllowShortLoopsOnASingleLine); in mapping()
945 Style.AlwaysBreakAfterDefinitionReturnType); in mapping()
947 Style.AlwaysBreakBeforeMultilineStrings); in mapping()
948 IO.mapOptional("AttributeMacros", Style.AttributeMacros); in mapping()
949 IO.mapOptional("BinPackArguments", Style.BinPackArguments); in mapping()
950 IO.mapOptional("BinPackParameters", Style.BinPackParameters); in mapping()
951 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing); in mapping()
953 Style.BracedInitializerIndentWidth); in mapping()
954 IO.mapOptional("BraceWrapping", Style.BraceWrapping); in mapping()
956 Style.BreakAdjacentStringLiterals); in mapping()
957 IO.mapOptional("BreakAfterAttributes", Style.BreakAfterAttributes); in mapping()
959 Style.BreakAfterJavaFieldAnnotations); in mapping()
960 IO.mapOptional("BreakAfterReturnType", Style.BreakAfterReturnType); in mapping()
961 IO.mapOptional("BreakArrays", Style.BreakArrays); in mapping()
963 Style.BreakBeforeBinaryOperators); in mapping()
965 Style.BreakBeforeConceptDeclarations); in mapping()
966 IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); in mapping()
968 Style.BreakBeforeInlineASMColon); in mapping()
970 Style.BreakBeforeTernaryOperators); in mapping()
972 Style.BreakConstructorInitializers); in mapping()
974 Style.BreakFunctionDefinitionParameters); in mapping()
975 IO.mapOptional("BreakInheritanceList", Style.BreakInheritanceList); in mapping()
976 IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); in mapping()
978 Style.BreakTemplateDeclarations); in mapping()
979 IO.mapOptional("ColumnLimit", Style.ColumnLimit); in mapping()
980 IO.mapOptional("CommentPragmas", Style.CommentPragmas); in mapping()
981 IO.mapOptional("CompactNamespaces", Style.CompactNamespaces); in mapping()
983 Style.ConstructorInitializerIndentWidth); in mapping()
984 IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); in mapping()
985 IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); in mapping()
986 IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); in mapping()
987 IO.mapOptional("DisableFormat", Style.DisableFormat); in mapping()
989 Style.EmptyLineAfterAccessModifier); in mapping()
991 Style.EmptyLineBeforeAccessModifier); in mapping()
993 Style.ExperimentalAutoDetectBinPacking); in mapping()
994 IO.mapOptional("FixNamespaceComments", Style.FixNamespaceComments); in mapping()
995 IO.mapOptional("ForEachMacros", Style.ForEachMacros); in mapping()
996 IO.mapOptional("IfMacros", Style.IfMacros); in mapping()
997 IO.mapOptional("IncludeBlocks", Style.IncludeStyle.IncludeBlocks); in mapping()
998 IO.mapOptional("IncludeCategories", Style.IncludeStyle.IncludeCategories); in mapping()
999 IO.mapOptional("IncludeIsMainRegex", Style.IncludeStyle.IncludeIsMainRegex); in mapping()
1001 Style.IncludeStyle.IncludeIsMainSourceRegex); in mapping()
1002 IO.mapOptional("IndentAccessModifiers", Style.IndentAccessModifiers); in mapping()
1003 IO.mapOptional("IndentCaseBlocks", Style.IndentCaseBlocks); in mapping()
1004 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); in mapping()
1005 IO.mapOptional("IndentExternBlock", Style.IndentExternBlock); in mapping()
1006 IO.mapOptional("IndentGotoLabels", Style.IndentGotoLabels); in mapping()
1007 IO.mapOptional("IndentPPDirectives", Style.IndentPPDirectives); in mapping()
1008 IO.mapOptional("IndentRequiresClause", Style.IndentRequiresClause); in mapping()
1009 IO.mapOptional("IndentWidth", Style.IndentWidth); in mapping()
1011 Style.IndentWrappedFunctionNames); in mapping()
1012 IO.mapOptional("InsertBraces", Style.InsertBraces); in mapping()
1013 IO.mapOptional("InsertNewlineAtEOF", Style.InsertNewlineAtEOF); in mapping()
1014 IO.mapOptional("InsertTrailingCommas", Style.InsertTrailingCommas); in mapping()
1015 IO.mapOptional("IntegerLiteralSeparator", Style.IntegerLiteralSeparator); in mapping()
1016 IO.mapOptional("JavaImportGroups", Style.JavaImportGroups); in mapping()
1017 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes); in mapping()
1018 IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports); in mapping()
1019 IO.mapOptional("KeepEmptyLines", Style.KeepEmptyLines); in mapping()
1020 IO.mapOptional("LambdaBodyIndentation", Style.LambdaBodyIndentation); in mapping()
1021 IO.mapOptional("LineEnding", Style.LineEnding); in mapping()
1022 IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin); in mapping()
1023 IO.mapOptional("MacroBlockEnd", Style.MacroBlockEnd); in mapping()
1024 IO.mapOptional("Macros", Style.Macros); in mapping()
1025 IO.mapOptional("MainIncludeChar", Style.IncludeStyle.MainIncludeChar); in mapping()
1026 IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); in mapping()
1027 IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); in mapping()
1028 IO.mapOptional("NamespaceMacros", Style.NamespaceMacros); in mapping()
1029 IO.mapOptional("ObjCBinPackProtocolList", Style.ObjCBinPackProtocolList); in mapping()
1030 IO.mapOptional("ObjCBlockIndentWidth", Style.ObjCBlockIndentWidth); in mapping()
1032 Style.ObjCBreakBeforeNestedBlockParam); in mapping()
1034 Style.ObjCPropertyAttributeOrder); in mapping()
1035 IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty); in mapping()
1037 Style.ObjCSpaceBeforeProtocolList); in mapping()
1039 Style.PackConstructorInitializers); in mapping()
1040 IO.mapOptional("PenaltyBreakAssignment", Style.PenaltyBreakAssignment); in mapping()
1042 Style.PenaltyBreakBeforeFirstCallParameter); in mapping()
1043 IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); in mapping()
1045 Style.PenaltyBreakFirstLessLess); in mapping()
1047 Style.PenaltyBreakOpenParenthesis); in mapping()
1049 Style.PenaltyBreakScopeResolution); in mapping()
1050 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); in mapping()
1052 Style.PenaltyBreakTemplateDeclaration); in mapping()
1053 IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); in mapping()
1055 Style.PenaltyIndentedWhitespace); in mapping()
1057 Style.PenaltyReturnTypeOnItsOwnLine); in mapping()
1058 IO.mapOptional("PointerAlignment", Style.PointerAlignment); in mapping()
1059 IO.mapOptional("PPIndentWidth", Style.PPIndentWidth); in mapping()
1060 IO.mapOptional("QualifierAlignment", Style.QualifierAlignment); in mapping()
1062 if (Style.QualifierAlignment == FormatStyle::QAS_Right) in mapping()
1063 Style.QualifierOrder = {"type", "const", "volatile"}; in mapping()
1064 else if (Style.QualifierAlignment == FormatStyle::QAS_Left) in mapping()
1065 Style.QualifierOrder = {"const", "volatile", "type"}; in mapping()
1066 else if (Style.QualifierAlignment == FormatStyle::QAS_Custom) in mapping()
1067 IO.mapOptional("QualifierOrder", Style.QualifierOrder); in mapping()
1068 IO.mapOptional("RawStringFormats", Style.RawStringFormats); in mapping()
1069 IO.mapOptional("ReferenceAlignment", Style.ReferenceAlignment); in mapping()
1070 IO.mapOptional("ReflowComments", Style.ReflowComments); in mapping()
1071 IO.mapOptional("RemoveBracesLLVM", Style.RemoveBracesLLVM); in mapping()
1072 IO.mapOptional("RemoveParentheses", Style.RemoveParentheses); in mapping()
1073 IO.mapOptional("RemoveSemicolon", Style.RemoveSemicolon); in mapping()
1074 IO.mapOptional("RequiresClausePosition", Style.RequiresClausePosition); in mapping()
1076 Style.RequiresExpressionIndentation); in mapping()
1077 IO.mapOptional("SeparateDefinitionBlocks", Style.SeparateDefinitionBlocks); in mapping()
1078 IO.mapOptional("ShortNamespaceLines", Style.ShortNamespaceLines); in mapping()
1079 IO.mapOptional("SkipMacroDefinitionBody", Style.SkipMacroDefinitionBody); in mapping()
1080 IO.mapOptional("SortIncludes", Style.SortIncludes); in mapping()
1081 IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport); in mapping()
1082 IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations); in mapping()
1083 IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); in mapping()
1084 IO.mapOptional("SpaceAfterLogicalNot", Style.SpaceAfterLogicalNot); in mapping()
1086 Style.SpaceAfterTemplateKeyword); in mapping()
1088 Style.SpaceAroundPointerQualifiers); in mapping()
1090 Style.SpaceBeforeAssignmentOperators); in mapping()
1091 IO.mapOptional("SpaceBeforeCaseColon", Style.SpaceBeforeCaseColon); in mapping()
1093 Style.SpaceBeforeCpp11BracedList); in mapping()
1095 Style.SpaceBeforeCtorInitializerColon); in mapping()
1097 Style.SpaceBeforeInheritanceColon); in mapping()
1098 IO.mapOptional("SpaceBeforeJsonColon", Style.SpaceBeforeJsonColon); in mapping()
1099 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); in mapping()
1100 IO.mapOptional("SpaceBeforeParensOptions", Style.SpaceBeforeParensOptions); in mapping()
1102 Style.SpaceBeforeRangeBasedForLoopColon); in mapping()
1104 Style.SpaceBeforeSquareBrackets); in mapping()
1105 IO.mapOptional("SpaceInEmptyBlock", Style.SpaceInEmptyBlock); in mapping()
1107 Style.SpacesBeforeTrailingComments); in mapping()
1108 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles); in mapping()
1110 Style.SpacesInContainerLiterals); in mapping()
1112 Style.SpacesInLineCommentPrefix); in mapping()
1113 IO.mapOptional("SpacesInParens", Style.SpacesInParens); in mapping()
1114 IO.mapOptional("SpacesInParensOptions", Style.SpacesInParensOptions); in mapping()
1115 IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); in mapping()
1116 IO.mapOptional("Standard", Style.Standard); in mapping()
1118 Style.StatementAttributeLikeMacros); in mapping()
1119 IO.mapOptional("StatementMacros", Style.StatementMacros); in mapping()
1121 Style.TableGenBreakingDAGArgOperators); in mapping()
1123 Style.TableGenBreakInsideDAGArg); in mapping()
1124 IO.mapOptional("TabWidth", Style.TabWidth); in mapping()
1125 IO.mapOptional("TypeNames", Style.TypeNames); in mapping()
1126 IO.mapOptional("TypenameMacros", Style.TypenameMacros); in mapping()
1127 IO.mapOptional("UseTab", Style.UseTab); in mapping()
1129 Style.VerilogBreakBetweenInstancePorts); in mapping()
1131 Style.WhitespaceSensitiveMacros); in mapping()
1136 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
1137 Style.BreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
1138 if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
1140 Style.BreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
1141 } else if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
1143 Style.BreakAfterReturnType = FormatStyle::RTBS_TopLevelDefinitions; in mapping()
1150 Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) { in mapping()
1151 Style.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in mapping()
1158 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon) { in mapping()
1159 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in mapping()
1163 if (Style.PackConstructorInitializers == FormatStyle::PCIS_BinPack && in mapping()
1165 Style.PackConstructorInitializers = OnNextLine in mapping()
1169 } else if (Style.PackConstructorInitializers == in mapping()
1172 Style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in mapping()
1174 Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; in mapping()
1177 if (Style.LineEnding == FormatStyle::LE_DeriveLF) { in mapping()
1179 Style.LineEnding = UseCRLF ? FormatStyle::LE_CRLF : FormatStyle::LE_LF; in mapping()
1181 Style.LineEnding = FormatStyle::LE_DeriveCRLF; in mapping()
1184 if (Style.SpacesInParens != FormatStyle::SIPO_Custom && in mapping()
1189 Style.SpacesInParensOptions.ExceptDoubleParentheses = false; in mapping()
1190 Style.SpacesInParensOptions.InConditionalStatements = true; in mapping()
1191 Style.SpacesInParensOptions.InCStyleCasts = in mapping()
1193 Style.SpacesInParensOptions.InEmptyParentheses = in mapping()
1195 Style.SpacesInParensOptions.Other = true; in mapping()
1197 Style.SpacesInParensOptions = {}; in mapping()
1198 Style.SpacesInParensOptions.InConditionalStatements = in mapping()
1200 Style.SpacesInParensOptions.InCStyleCasts = in mapping()
1202 Style.SpacesInParensOptions.InEmptyParentheses = in mapping()
1205 Style.SpacesInParens = FormatStyle::SIPO_Custom; in mapping()
1861 FormatStyle Style = getLLVMStyle(); in getWebKitStyle() local
1862 Style.AccessModifierOffset = -4; in getWebKitStyle()
1863 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
1864 Style.AlignOperands = FormatStyle::OAS_DontAlign; in getWebKitStyle()
1865 Style.AlignTrailingComments = {}; in getWebKitStyle()
1866 Style.AlignTrailingComments.Kind = FormatStyle::TCAS_Never; in getWebKitStyle()
1867 Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Empty; in getWebKitStyle()
1868 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
1869 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
1870 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getWebKitStyle()
1871 Style.ColumnLimit = 0; in getWebKitStyle()
1872 Style.Cpp11BracedListStyle = false; in getWebKitStyle()
1873 Style.FixNamespaceComments = false; in getWebKitStyle()
1874 Style.IndentWidth = 4; in getWebKitStyle()
1875 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
1876 Style.ObjCBlockIndentWidth = 4; in getWebKitStyle()
1877 Style.ObjCSpaceAfterProperty = true; in getWebKitStyle()
1878 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
1879 Style.SpaceBeforeCpp11BracedList = true; in getWebKitStyle()
1880 Style.SpaceInEmptyBlock = true; in getWebKitStyle()
1881 return Style; in getWebKitStyle()
1885 FormatStyle Style = getLLVMStyle(); in getGNUStyle() local
1886 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
1887 Style.BreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
1888 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
1889 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
1890 Style.BreakBeforeTernaryOperators = true; in getGNUStyle()
1891 Style.ColumnLimit = 79; in getGNUStyle()
1892 Style.Cpp11BracedListStyle = false; in getGNUStyle()
1893 Style.FixNamespaceComments = false; in getGNUStyle()
1894 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
1895 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
1896 return Style; in getGNUStyle()
1900 FormatStyle Style = getLLVMStyle(Language); in getMicrosoftStyle() local
1901 Style.ColumnLimit = 120; in getMicrosoftStyle()
1902 Style.TabWidth = 4; in getMicrosoftStyle()
1903 Style.IndentWidth = 4; in getMicrosoftStyle()
1904 Style.UseTab = FormatStyle::UT_Never; in getMicrosoftStyle()
1905 Style.BreakBeforeBraces = FormatStyle::BS_Custom; in getMicrosoftStyle()
1906 Style.BraceWrapping.AfterClass = true; in getMicrosoftStyle()
1907 Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in getMicrosoftStyle()
1908 Style.BraceWrapping.AfterEnum = true; in getMicrosoftStyle()
1909 Style.BraceWrapping.AfterFunction = true; in getMicrosoftStyle()
1910 Style.BraceWrapping.AfterNamespace = true; in getMicrosoftStyle()
1911 Style.BraceWrapping.AfterObjCDeclaration = true; in getMicrosoftStyle()
1912 Style.BraceWrapping.AfterStruct = true; in getMicrosoftStyle()
1913 Style.BraceWrapping.AfterExternBlock = true; in getMicrosoftStyle()
1914 Style.BraceWrapping.BeforeCatch = true; in getMicrosoftStyle()
1915 Style.BraceWrapping.BeforeElse = true; in getMicrosoftStyle()
1916 Style.BraceWrapping.BeforeWhile = false; in getMicrosoftStyle()
1917 Style.PenaltyReturnTypeOnItsOwnLine = 1000; in getMicrosoftStyle()
1918 Style.AllowShortEnumsOnASingleLine = false; in getMicrosoftStyle()
1919 Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; in getMicrosoftStyle()
1920 Style.AllowShortCaseLabelsOnASingleLine = false; in getMicrosoftStyle()
1921 Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getMicrosoftStyle()
1922 Style.AllowShortLoopsOnASingleLine = false; in getMicrosoftStyle()
1923 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getMicrosoftStyle()
1924 Style.BreakAfterReturnType = FormatStyle::RTBS_None; in getMicrosoftStyle()
1925 return Style; in getMicrosoftStyle()
1929 FormatStyle Style = getLLVMStyle(); in getClangFormatStyle() local
1930 Style.InsertBraces = true; in getClangFormatStyle()
1931 Style.InsertNewlineAtEOF = true; in getClangFormatStyle()
1932 Style.IntegerLiteralSeparator.Decimal = 3; in getClangFormatStyle()
1933 Style.IntegerLiteralSeparator.DecimalMinDigits = 5; in getClangFormatStyle()
1934 Style.LineEnding = FormatStyle::LE_LF; in getClangFormatStyle()
1935 Style.RemoveBracesLLVM = true; in getClangFormatStyle()
1936 Style.RemoveParentheses = FormatStyle::RPS_ReturnStatement; in getClangFormatStyle()
1937 Style.RemoveSemicolon = true; in getClangFormatStyle()
1938 return Style; in getClangFormatStyle()
1950 FormatStyle *Style) { in getPredefinedStyle() argument
1952 *Style = getLLVMStyle(Language); in getPredefinedStyle()
1954 *Style = getChromiumStyle(Language); in getPredefinedStyle()
1956 *Style = getMozillaStyle(); in getPredefinedStyle()
1958 *Style = getGoogleStyle(Language); in getPredefinedStyle()
1960 *Style = getWebKitStyle(); in getPredefinedStyle()
1962 *Style = getGNUStyle(); in getPredefinedStyle()
1964 *Style = getMicrosoftStyle(Language); in getPredefinedStyle()
1966 *Style = getClangFormatStyle(); in getPredefinedStyle()
1968 *Style = getNoStyle(); in getPredefinedStyle()
1970 Style->InheritsParentConfig = true; in getPredefinedStyle()
1974 Style->Language = Language; in getPredefinedStyle()
1978 ParseError validateQualifierOrder(FormatStyle *Style) { in validateQualifierOrder() argument
1980 if (Style->QualifierOrder.empty()) in validateQualifierOrder()
1984 for (const auto &Qualifier : Style->QualifierOrder) { in validateQualifierOrder()
1994 std::set<std::string> UniqueQualifiers(Style->QualifierOrder.begin(), in validateQualifierOrder()
1995 Style->QualifierOrder.end()); in validateQualifierOrder()
1996 if (Style->QualifierOrder.size() != UniqueQualifiers.size()) { in validateQualifierOrder()
1998 << "Duplicate Qualifiers " << Style->QualifierOrder.size() in validateQualifierOrder()
2004 if (!llvm::is_contained(Style->QualifierOrder, "type")) in validateQualifierOrder()
2011 FormatStyle *Style, bool AllowUnknownOptions, in parseConfiguration() argument
2014 assert(Style); in parseConfiguration()
2015 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
2019 Style->StyleSet.Clear(); in parseConfiguration()
2027 Input.setContext(Style); in parseConfiguration()
2052 for (const FormatStyle &Style : llvm::reverse(Styles)) { in parseConfiguration() local
2053 if (Style.Language != FormatStyle::LK_None) in parseConfiguration()
2054 StyleSet.Add(Style); in parseConfiguration()
2055 if (Style.Language == Language) in parseConfiguration()
2065 *Style = *StyleSet.Get(Language); in parseConfiguration()
2066 if (Style->InsertTrailingCommas != FormatStyle::TCS_None && in parseConfiguration()
2067 Style->BinPackArguments) { in parseConfiguration()
2071 if (Style->QualifierAlignment != FormatStyle::QAS_Leave) in parseConfiguration()
2072 return make_error_code(validateQualifierOrder(Style)); in parseConfiguration()
2076 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText() argument
2082 FormatStyle NonConstStyle = Style; in configurationAsText()
2098 FormatStyle Style = It->second; in Get() local
2099 Style.StyleSet = *this; in Get()
2100 return Style; in Get()
2103 void FormatStyle::FormatStyleSet::Add(FormatStyle Style) { in Add() argument
2104 assert(Style.Language != LK_None && in Add()
2107 !Style.StyleSet.Styles && in Add()
2111 (*Styles)[Style.Language] = std::move(Style); in Add()
2125 ParensRemover(const Environment &Env, const FormatStyle &Style) in ParensRemover() argument
2126 : TokenAnalyzer(Env, Style) {} in ParensRemover()
2169 BracesInserter(const Environment &Env, const FormatStyle &Style) in BracesInserter() argument
2170 : TokenAnalyzer(Env, Style) {} in BracesInserter()
2222 BracesRemover(const Environment &Env, const FormatStyle &Style) in BracesRemover() argument
2223 : TokenAnalyzer(Env, Style) {} in BracesRemover()
2273 SemiRemover(const Environment &Env, const FormatStyle &Style) in SemiRemover() argument
2274 : TokenAnalyzer(Env, Style) {} in SemiRemover()
2333 JavaScriptRequoter(const Environment &Env, const FormatStyle &Style) in JavaScriptRequoter() argument
2334 : TokenAnalyzer(Env, Style) {} in JavaScriptRequoter()
2361 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
2363 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
2369 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
2421 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter() argument
2423 : TokenAnalyzer(Env, Style), Status(Status) {} in Formatter()
2437 Env.getSourceManager(), Style, in analyze()
2438 Style.LineEnding > FormatStyle::LE_CRLF in analyze()
2441 Style.LineEnding == FormatStyle::LE_DeriveCRLF) in analyze()
2442 : Style.LineEnding == FormatStyle::LE_CRLF); in analyze()
2443 ContinuationIndenter Indenter(Style, Tokens.getKeywords(), in analyze()
2447 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, in analyze()
2529 if (Style.DerivePointerAlignment) { in deriveLocalStyle()
2532 Style.PointerAlignment = FormatStyle::PAS_Right; in deriveLocalStyle()
2534 Style.PointerAlignment = FormatStyle::PAS_Left; in deriveLocalStyle()
2535 Style.ReferenceAlignment = FormatStyle::RAS_Pointer; in deriveLocalStyle()
2537 if (Style.Standard == FormatStyle::LS_Auto) { in deriveLocalStyle()
2538 Style.Standard = hasCpp03IncompatibleFormat(AnnotatedLines) in deriveLocalStyle()
2563 TrailingCommaInserter(const Environment &Env, const FormatStyle &Style) in TrailingCommaInserter() argument
2564 : TokenAnalyzer(Env, Style) {} in TrailingCommaInserter()
2609 if (ColumnNumber > Style.ColumnLimit) in insertTrailingCommas()
2624 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner() argument
2625 : TokenAnalyzer(Env, Style), in Cleaner()
2699 if (Style.BraceWrapping.AfterNamespace) { in checkEmptyNamespace()
2847 ObjCHeaderStyleGuesser(const Environment &Env, const FormatStyle &Style) in ObjCHeaderStyleGuesser() argument
2848 : TokenAnalyzer(Env, Style), IsObjC(false) {} in ObjCHeaderStyleGuesser()
2854 assert(Style.Language == FormatStyle::LK_Cpp); in analyze()
3075 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes() argument
3080 tooling::IncludeCategoryManager Categories(Style.IncludeStyle, FileName); in sortCppIncludes()
3090 if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) { in sortCppIncludes()
3133 Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Preserve) { in sortCppIncludes()
3142 if (Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
3176 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes() argument
3195 tooling::IncludeCategoryManager Categories(Style.IncludeStyle, FileName); in sortCppIncludes()
3238 (Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Merge || in sortCppIncludes()
3239 Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
3266 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code, in sortCppIncludes()
3283 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code, Replaces, in sortCppIncludes()
3291 static unsigned findJavaImportGroup(const FormatStyle &Style, in findJavaImportGroup() argument
3295 for (unsigned I = 0; I < Style.JavaImportGroups.size(); I++) { in findJavaImportGroup()
3296 const std::string &GroupPrefix = Style.JavaImportGroups[I]; in findJavaImportGroup()
3311 static void sortJavaImports(const FormatStyle &Style, in sortJavaImports() argument
3327 JavaImportGroups.push_back(findJavaImportGroup(Style, Import.Identifier)); in sortJavaImports()
3330 Style.SortJavaStaticImport == FormatStyle::SJSIO_After; in sortJavaImports()
3393 tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code, in sortJavaImports() argument
3441 sortJavaImports(Style, ImportsInBlock, Ranges, FileName, Code, Replaces); in sortJavaImports()
3454 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes() argument
3458 if (!Style.SortIncludes || Style.DisableFormat) in sortIncludes()
3462 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript && in sortIncludes()
3466 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
3467 return sortJavaScriptImports(Style, Code, Ranges, FileName); in sortIncludes()
3468 if (Style.Language == FormatStyle::LanguageKind::LK_Java) in sortIncludes()
3469 return sortJavaImports(Style, Code, Ranges, FileName, Replaces); in sortIncludes()
3470 sortCppIncludes(Style, Code, Ranges, FileName, Replaces, Cursor); in sortIncludes()
3478 const FormatStyle &Style) { in processReplacements() argument
3489 ProcessFunc(Style, *NewCode, ChangedRanges, FileName); in processReplacements()
3496 const FormatStyle &Style) { in formatReplacements() argument
3499 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3502 return sortIncludes(Style, Code, Ranges, FileName); in formatReplacements()
3505 processReplacements(SortIncludes, Code, Replaces, Style); in formatReplacements()
3511 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements() argument
3514 return reformat(Style, Code, Ranges, FileName); in formatReplacements()
3516 return processReplacements(Reformat, Code, *SortedReplaces, Style); in formatReplacements()
3534 const FormatStyle &Style) { in fixCppIncludeInsertions() argument
3535 if (!Style.isCpp()) in fixCppIncludeInsertions()
3560 tooling::HeaderIncludes Includes(FileName, Code, Style.IncludeStyle); in fixCppIncludeInsertions()
3606 const FormatStyle &Style) { in cleanupAroundReplacements() argument
3609 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
3612 return cleanup(Style, Code, Ranges, FileName); in cleanupAroundReplacements()
3616 fixCppIncludeInsertions(Code, Replaces, Style); in cleanupAroundReplacements()
3617 return cantFail(processReplacements(Cleanup, Code, NewReplaces, Style)); in cleanupAroundReplacements()
3622 reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3626 FormatStyle Expanded = Style; in reformat()
3651 if (Style.isJson()) { in reformat()
3659 Formatter(*Env, Style, Status).process().first; in reformat()
3684 if (Style.isCpp()) { in reformat()
3685 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) in reformat()
3688 if (Style.RemoveParentheses != FormatStyle::RPS_Leave) { in reformat()
3690 S.RemoveParentheses = Style.RemoveParentheses; in reformat()
3696 if (Style.InsertBraces) { in reformat()
3704 if (Style.RemoveBracesLLVM) { in reformat()
3712 if (Style.RemoveSemicolon) { in reformat()
3720 if (Style.FixNamespaceComments) { in reformat()
3726 if (Style.SortUsingDeclarations != FormatStyle::SUD_Never) { in reformat()
3733 if (Style.SeparateDefinitionBlocks != FormatStyle::SDS_Leave) { in reformat()
3739 if (Style.Language == FormatStyle::LK_ObjC && in reformat()
3740 !Style.ObjCPropertyAttributeOrder.empty()) { in reformat()
3746 if (Style.isJavaScript() && in reformat()
3747 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) { in reformat()
3757 if (Style.isJavaScript() && in reformat()
3758 Style.InsertTrailingCommas == FormatStyle::TCS_Wrapped) { in reformat()
3786 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) { in reformat()
3808 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3812 return internal::reformat(Style, Code, Ranges, in reformat()
3819 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup() argument
3823 if (Style.Language != FormatStyle::LK_Cpp) in cleanup()
3828 return Cleaner(*Env, Style).process().first; in cleanup()
3831 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3835 auto Result = reformat(Style, Code, Ranges, FileName, &Status); in reformat()
3841 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, in fixNamespaceEndComments() argument
3848 return NamespaceEndCommentsFixer(*Env, Style).process().first; in fixNamespaceEndComments()
3851 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, in sortUsingDeclarations() argument
3858 return UsingDeclarationsSorter(*Env, Style).process().first; in sortUsingDeclarations()
3861 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts() argument
3864 FormatStyle::LanguageStandard LexingStd = Style.Standard; in getFormattingLangOpts()
3881 LangOpts.CXXOperatorNames = Style.isCpp(); in getFormattingLangOpts()
3969 FormatStyle *Style, bool AllowUnknownOptions, in loadAndParseConfigFile() argument
3975 if (auto EC = parseConfiguration(*Text.get(), Style, AllowUnknownOptions, in loadAndParseConfigFile()
3987 FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code)); in getStyle() local
3989 if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle)) in getStyle()
3998 parseConfiguration(llvm::MemoryBufferRef(StyleName, Source), &Style, in getStyle()
4003 if (!Style.InheritsParentConfig) in getStyle()
4004 return Style; in getStyle()
4015 if (!Style.InheritsParentConfig && in getStyle()
4019 loadAndParseConfigFile(ConfigFile, FS, &Style, AllowUnknownOptions, in getStyle()
4029 if (!Style.InheritsParentConfig) in getStyle()
4030 return Style; in getStyle()
4041 if (!Style.InheritsParentConfig && !StyleName.equals_insensitive("file")) { in getStyle()
4042 if (!getPredefinedStyle(StyleName, Style.Language, &Style)) in getStyle()
4044 if (!Style.InheritsParentConfig) in getStyle()
4045 return Style; in getStyle()
4053 Style.InheritsParentConfig = false; in getStyle()
4057 auto applyChildFormatTexts = [&](FormatStyle *Style) { in getStyle() argument
4060 parseConfiguration(*MemBuf, Style, AllowUnknownOptions, in getStyle()
4095 loadAndParseConfigFile(ConfigFile, FS, &Style, AllowUnknownOptions, in getStyle()
4111 if (!Style.InheritsParentConfig) { in getStyle()
4114 applyChildFormatTexts(&Style); in getStyle()
4116 return Style; in getStyle()
4122 Style.InheritsParentConfig = false; in getStyle()
4136 getLanguageName(Style.Language) + ": " + in getStyle()