Lines Matching refs:Style

815   static void mapping(IO &IO, FormatStyle &Style) {  in mapping()
817 IO.mapOptional("Language", Style.Language); in mapping()
825 if (getPredefinedStyle(StyleName, Style.Language, &PredefinedStyle) && in mapping()
826 Style == PredefinedStyle) { in mapping()
835 FormatStyle::LanguageKind OldLanguage = Style.Language; in mapping()
838 if (!getPredefinedStyle(BasedOnStyle, Language, &Style)) { in mapping()
842 Style.Language = OldLanguage; in mapping()
875 IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlines); in mapping()
884 IO.mapOptional("DerivePointerBinding", Style.DerivePointerAlignment); in mapping()
886 Style.IndentWrappedFunctionNames); in mapping()
887 IO.mapOptional("IndentRequires", Style.IndentRequiresClause); in mapping()
888 IO.mapOptional("PointerBindsToType", Style.PointerAlignment); in mapping()
890 Style.SpaceBeforeParens); in mapping()
900 IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); in mapping()
901 IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); in mapping()
902 IO.mapOptional("AlignArrayOfStructures", Style.AlignArrayOfStructures); in mapping()
904 Style.AlignConsecutiveAssignments); in mapping()
906 Style.AlignConsecutiveBitFields); in mapping()
908 Style.AlignConsecutiveDeclarations); in mapping()
909 IO.mapOptional("AlignConsecutiveMacros", Style.AlignConsecutiveMacros); in mapping()
911 Style.AlignConsecutiveShortCaseStatements); in mapping()
912 IO.mapOptional("AlignEscapedNewlines", Style.AlignEscapedNewlines); in mapping()
913 IO.mapOptional("AlignOperands", Style.AlignOperands); in mapping()
914 IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); in mapping()
916 Style.AllowAllArgumentsOnNextLine); in mapping()
918 Style.AllowAllParametersOfDeclarationOnNextLine); in mapping()
920 Style.AllowBreakBeforeNoexceptSpecifier); in mapping()
922 Style.AllowShortBlocksOnASingleLine); in mapping()
924 Style.AllowShortCaseLabelsOnASingleLine); in mapping()
926 Style.AllowShortCompoundRequirementOnASingleLine); in mapping()
928 Style.AllowShortEnumsOnASingleLine); in mapping()
930 Style.AllowShortFunctionsOnASingleLine); in mapping()
932 Style.AllowShortIfStatementsOnASingleLine); in mapping()
934 Style.AllowShortLambdasOnASingleLine); in mapping()
936 Style.AllowShortLoopsOnASingleLine); in mapping()
938 Style.AlwaysBreakAfterDefinitionReturnType); in mapping()
940 Style.AlwaysBreakAfterReturnType); in mapping()
942 Style.AlwaysBreakBeforeMultilineStrings); in mapping()
944 Style.AlwaysBreakTemplateDeclarations); in mapping()
945 IO.mapOptional("AttributeMacros", Style.AttributeMacros); in mapping()
946 IO.mapOptional("BinPackArguments", Style.BinPackArguments); in mapping()
947 IO.mapOptional("BinPackParameters", Style.BinPackParameters); in mapping()
948 IO.mapOptional("BitFieldColonSpacing", Style.BitFieldColonSpacing); in mapping()
950 Style.BracedInitializerIndentWidth); in mapping()
951 IO.mapOptional("BraceWrapping", Style.BraceWrapping); in mapping()
953 Style.BreakAdjacentStringLiterals); in mapping()
954 IO.mapOptional("BreakAfterAttributes", Style.BreakAfterAttributes); in mapping()
956 Style.BreakAfterJavaFieldAnnotations); in mapping()
957 IO.mapOptional("BreakArrays", Style.BreakArrays); in mapping()
959 Style.BreakBeforeBinaryOperators); in mapping()
961 Style.BreakBeforeConceptDeclarations); in mapping()
962 IO.mapOptional("BreakBeforeBraces", Style.BreakBeforeBraces); in mapping()
964 Style.BreakBeforeInlineASMColon); in mapping()
966 Style.BreakBeforeTernaryOperators); in mapping()
968 Style.BreakConstructorInitializers); in mapping()
969 IO.mapOptional("BreakInheritanceList", Style.BreakInheritanceList); in mapping()
970 IO.mapOptional("BreakStringLiterals", Style.BreakStringLiterals); in mapping()
971 IO.mapOptional("ColumnLimit", Style.ColumnLimit); in mapping()
972 IO.mapOptional("CommentPragmas", Style.CommentPragmas); in mapping()
973 IO.mapOptional("CompactNamespaces", Style.CompactNamespaces); in mapping()
975 Style.ConstructorInitializerIndentWidth); in mapping()
976 IO.mapOptional("ContinuationIndentWidth", Style.ContinuationIndentWidth); in mapping()
977 IO.mapOptional("Cpp11BracedListStyle", Style.Cpp11BracedListStyle); in mapping()
978 IO.mapOptional("DerivePointerAlignment", Style.DerivePointerAlignment); in mapping()
979 IO.mapOptional("DisableFormat", Style.DisableFormat); in mapping()
981 Style.EmptyLineAfterAccessModifier); in mapping()
983 Style.EmptyLineBeforeAccessModifier); in mapping()
985 Style.ExperimentalAutoDetectBinPacking); in mapping()
986 IO.mapOptional("FixNamespaceComments", Style.FixNamespaceComments); in mapping()
987 IO.mapOptional("ForEachMacros", Style.ForEachMacros); in mapping()
988 IO.mapOptional("IfMacros", Style.IfMacros); in mapping()
989 IO.mapOptional("IncludeBlocks", Style.IncludeStyle.IncludeBlocks); in mapping()
990 IO.mapOptional("IncludeCategories", Style.IncludeStyle.IncludeCategories); in mapping()
991 IO.mapOptional("IncludeIsMainRegex", Style.IncludeStyle.IncludeIsMainRegex); in mapping()
993 Style.IncludeStyle.IncludeIsMainSourceRegex); in mapping()
994 IO.mapOptional("IndentAccessModifiers", Style.IndentAccessModifiers); in mapping()
995 IO.mapOptional("IndentCaseBlocks", Style.IndentCaseBlocks); in mapping()
996 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels); in mapping()
997 IO.mapOptional("IndentExternBlock", Style.IndentExternBlock); in mapping()
998 IO.mapOptional("IndentGotoLabels", Style.IndentGotoLabels); in mapping()
999 IO.mapOptional("IndentPPDirectives", Style.IndentPPDirectives); in mapping()
1000 IO.mapOptional("IndentRequiresClause", Style.IndentRequiresClause); in mapping()
1001 IO.mapOptional("IndentWidth", Style.IndentWidth); in mapping()
1003 Style.IndentWrappedFunctionNames); in mapping()
1004 IO.mapOptional("InsertBraces", Style.InsertBraces); in mapping()
1005 IO.mapOptional("InsertNewlineAtEOF", Style.InsertNewlineAtEOF); in mapping()
1006 IO.mapOptional("InsertTrailingCommas", Style.InsertTrailingCommas); in mapping()
1007 IO.mapOptional("IntegerLiteralSeparator", Style.IntegerLiteralSeparator); in mapping()
1008 IO.mapOptional("JavaImportGroups", Style.JavaImportGroups); in mapping()
1009 IO.mapOptional("JavaScriptQuotes", Style.JavaScriptQuotes); in mapping()
1010 IO.mapOptional("JavaScriptWrapImports", Style.JavaScriptWrapImports); in mapping()
1012 Style.KeepEmptyLinesAtTheStartOfBlocks); in mapping()
1013 IO.mapOptional("KeepEmptyLinesAtEOF", Style.KeepEmptyLinesAtEOF); in mapping()
1014 IO.mapOptional("LambdaBodyIndentation", Style.LambdaBodyIndentation); in mapping()
1015 IO.mapOptional("LineEnding", Style.LineEnding); in mapping()
1016 IO.mapOptional("MacroBlockBegin", Style.MacroBlockBegin); in mapping()
1017 IO.mapOptional("MacroBlockEnd", Style.MacroBlockEnd); in mapping()
1018 IO.mapOptional("Macros", Style.Macros); in mapping()
1019 IO.mapOptional("MaxEmptyLinesToKeep", Style.MaxEmptyLinesToKeep); in mapping()
1020 IO.mapOptional("NamespaceIndentation", Style.NamespaceIndentation); in mapping()
1021 IO.mapOptional("NamespaceMacros", Style.NamespaceMacros); in mapping()
1022 IO.mapOptional("ObjCBinPackProtocolList", Style.ObjCBinPackProtocolList); in mapping()
1023 IO.mapOptional("ObjCBlockIndentWidth", Style.ObjCBlockIndentWidth); in mapping()
1025 Style.ObjCBreakBeforeNestedBlockParam); in mapping()
1027 Style.ObjCPropertyAttributeOrder); in mapping()
1028 IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty); in mapping()
1030 Style.ObjCSpaceBeforeProtocolList); in mapping()
1032 Style.PackConstructorInitializers); in mapping()
1033 IO.mapOptional("PenaltyBreakAssignment", Style.PenaltyBreakAssignment); in mapping()
1035 Style.PenaltyBreakBeforeFirstCallParameter); in mapping()
1036 IO.mapOptional("PenaltyBreakComment", Style.PenaltyBreakComment); in mapping()
1038 Style.PenaltyBreakFirstLessLess); in mapping()
1040 Style.PenaltyBreakOpenParenthesis); in mapping()
1042 Style.PenaltyBreakScopeResolution); in mapping()
1043 IO.mapOptional("PenaltyBreakString", Style.PenaltyBreakString); in mapping()
1045 Style.PenaltyBreakTemplateDeclaration); in mapping()
1046 IO.mapOptional("PenaltyExcessCharacter", Style.PenaltyExcessCharacter); in mapping()
1048 Style.PenaltyIndentedWhitespace); in mapping()
1050 Style.PenaltyReturnTypeOnItsOwnLine); in mapping()
1051 IO.mapOptional("PointerAlignment", Style.PointerAlignment); in mapping()
1052 IO.mapOptional("PPIndentWidth", Style.PPIndentWidth); in mapping()
1053 IO.mapOptional("QualifierAlignment", Style.QualifierAlignment); in mapping()
1055 if (Style.QualifierAlignment == FormatStyle::QAS_Right) in mapping()
1056 Style.QualifierOrder = {"type", "const", "volatile"}; in mapping()
1057 else if (Style.QualifierAlignment == FormatStyle::QAS_Left) in mapping()
1058 Style.QualifierOrder = {"const", "volatile", "type"}; in mapping()
1059 else if (Style.QualifierAlignment == FormatStyle::QAS_Custom) in mapping()
1060 IO.mapOptional("QualifierOrder", Style.QualifierOrder); in mapping()
1061 IO.mapOptional("RawStringFormats", Style.RawStringFormats); in mapping()
1062 IO.mapOptional("ReferenceAlignment", Style.ReferenceAlignment); in mapping()
1063 IO.mapOptional("ReflowComments", Style.ReflowComments); in mapping()
1064 IO.mapOptional("RemoveBracesLLVM", Style.RemoveBracesLLVM); in mapping()
1065 IO.mapOptional("RemoveParentheses", Style.RemoveParentheses); in mapping()
1066 IO.mapOptional("RemoveSemicolon", Style.RemoveSemicolon); in mapping()
1067 IO.mapOptional("RequiresClausePosition", Style.RequiresClausePosition); in mapping()
1069 Style.RequiresExpressionIndentation); in mapping()
1070 IO.mapOptional("SeparateDefinitionBlocks", Style.SeparateDefinitionBlocks); in mapping()
1071 IO.mapOptional("ShortNamespaceLines", Style.ShortNamespaceLines); in mapping()
1072 IO.mapOptional("SkipMacroDefinitionBody", Style.SkipMacroDefinitionBody); in mapping()
1073 IO.mapOptional("SortIncludes", Style.SortIncludes); in mapping()
1074 IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport); in mapping()
1075 IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations); in mapping()
1076 IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast); in mapping()
1077 IO.mapOptional("SpaceAfterLogicalNot", Style.SpaceAfterLogicalNot); in mapping()
1079 Style.SpaceAfterTemplateKeyword); in mapping()
1081 Style.SpaceAroundPointerQualifiers); in mapping()
1083 Style.SpaceBeforeAssignmentOperators); in mapping()
1084 IO.mapOptional("SpaceBeforeCaseColon", Style.SpaceBeforeCaseColon); in mapping()
1086 Style.SpaceBeforeCpp11BracedList); in mapping()
1088 Style.SpaceBeforeCtorInitializerColon); in mapping()
1090 Style.SpaceBeforeInheritanceColon); in mapping()
1091 IO.mapOptional("SpaceBeforeJsonColon", Style.SpaceBeforeJsonColon); in mapping()
1092 IO.mapOptional("SpaceBeforeParens", Style.SpaceBeforeParens); in mapping()
1093 IO.mapOptional("SpaceBeforeParensOptions", Style.SpaceBeforeParensOptions); in mapping()
1095 Style.SpaceBeforeRangeBasedForLoopColon); in mapping()
1097 Style.SpaceBeforeSquareBrackets); in mapping()
1098 IO.mapOptional("SpaceInEmptyBlock", Style.SpaceInEmptyBlock); in mapping()
1100 Style.SpacesBeforeTrailingComments); in mapping()
1101 IO.mapOptional("SpacesInAngles", Style.SpacesInAngles); in mapping()
1103 Style.SpacesInContainerLiterals); in mapping()
1105 Style.SpacesInLineCommentPrefix); in mapping()
1106 IO.mapOptional("SpacesInParens", Style.SpacesInParens); in mapping()
1107 IO.mapOptional("SpacesInParensOptions", Style.SpacesInParensOptions); in mapping()
1108 IO.mapOptional("SpacesInSquareBrackets", Style.SpacesInSquareBrackets); in mapping()
1109 IO.mapOptional("Standard", Style.Standard); in mapping()
1111 Style.StatementAttributeLikeMacros); in mapping()
1112 IO.mapOptional("StatementMacros", Style.StatementMacros); in mapping()
1113 IO.mapOptional("TabWidth", Style.TabWidth); in mapping()
1114 IO.mapOptional("TypeNames", Style.TypeNames); in mapping()
1115 IO.mapOptional("TypenameMacros", Style.TypenameMacros); in mapping()
1116 IO.mapOptional("UseTab", Style.UseTab); in mapping()
1118 Style.VerilogBreakBetweenInstancePorts); in mapping()
1120 Style.WhitespaceSensitiveMacros); in mapping()
1125 if (Style.AlwaysBreakAfterDefinitionReturnType != FormatStyle::DRTBS_None && in mapping()
1126 Style.AlwaysBreakAfterReturnType == FormatStyle::RTBS_None) { in mapping()
1127 if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
1129 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in mapping()
1130 } else if (Style.AlwaysBreakAfterDefinitionReturnType == in mapping()
1132 Style.AlwaysBreakAfterReturnType = in mapping()
1140 Style.BreakInheritanceList == FormatStyle::BILS_BeforeColon) { in mapping()
1141 Style.BreakInheritanceList = FormatStyle::BILS_BeforeComma; in mapping()
1148 Style.BreakConstructorInitializers == FormatStyle::BCIS_BeforeColon) { in mapping()
1149 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in mapping()
1153 if (Style.PackConstructorInitializers == FormatStyle::PCIS_BinPack && in mapping()
1155 Style.PackConstructorInitializers = OnNextLine in mapping()
1159 } else if (Style.PackConstructorInitializers == in mapping()
1162 Style.PackConstructorInitializers = FormatStyle::PCIS_BinPack; in mapping()
1164 Style.PackConstructorInitializers = FormatStyle::PCIS_CurrentLine; in mapping()
1167 if (Style.LineEnding == FormatStyle::LE_DeriveLF) { in mapping()
1169 Style.LineEnding = UseCRLF ? FormatStyle::LE_CRLF : FormatStyle::LE_LF; in mapping()
1171 Style.LineEnding = FormatStyle::LE_DeriveCRLF; in mapping()
1174 if (Style.SpacesInParens != FormatStyle::SIPO_Custom && in mapping()
1180 Style.SpacesInParensOptions.InConditionalStatements = true; in mapping()
1181 Style.SpacesInParensOptions.InCStyleCasts = in mapping()
1183 Style.SpacesInParensOptions.InEmptyParentheses = in mapping()
1185 Style.SpacesInParensOptions.Other = true; in mapping()
1187 Style.SpacesInParensOptions = {}; in mapping()
1188 Style.SpacesInParensOptions.InConditionalStatements = in mapping()
1190 Style.SpacesInParensOptions.InCStyleCasts = in mapping()
1192 Style.SpacesInParensOptions.InEmptyParentheses = in mapping()
1195 Style.SpacesInParens = FormatStyle::SIPO_Custom; in mapping()
1840 FormatStyle Style = getLLVMStyle(); in getWebKitStyle() local
1841 Style.AccessModifierOffset = -4; in getWebKitStyle()
1842 Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign; in getWebKitStyle()
1843 Style.AlignOperands = FormatStyle::OAS_DontAlign; in getWebKitStyle()
1844 Style.AlignTrailingComments = {}; in getWebKitStyle()
1845 Style.AlignTrailingComments.Kind = FormatStyle::TCAS_Never; in getWebKitStyle()
1846 Style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Empty; in getWebKitStyle()
1847 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getWebKitStyle()
1848 Style.BreakBeforeBraces = FormatStyle::BS_WebKit; in getWebKitStyle()
1849 Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; in getWebKitStyle()
1850 Style.Cpp11BracedListStyle = false; in getWebKitStyle()
1851 Style.ColumnLimit = 0; in getWebKitStyle()
1852 Style.FixNamespaceComments = false; in getWebKitStyle()
1853 Style.IndentWidth = 4; in getWebKitStyle()
1854 Style.NamespaceIndentation = FormatStyle::NI_Inner; in getWebKitStyle()
1855 Style.ObjCBlockIndentWidth = 4; in getWebKitStyle()
1856 Style.ObjCSpaceAfterProperty = true; in getWebKitStyle()
1857 Style.PointerAlignment = FormatStyle::PAS_Left; in getWebKitStyle()
1858 Style.SpaceBeforeCpp11BracedList = true; in getWebKitStyle()
1859 Style.SpaceInEmptyBlock = true; in getWebKitStyle()
1860 return Style; in getWebKitStyle()
1864 FormatStyle Style = getLLVMStyle(); in getGNUStyle() local
1865 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_All; in getGNUStyle()
1866 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_AllDefinitions; in getGNUStyle()
1867 Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; in getGNUStyle()
1868 Style.BreakBeforeBraces = FormatStyle::BS_GNU; in getGNUStyle()
1869 Style.BreakBeforeTernaryOperators = true; in getGNUStyle()
1870 Style.Cpp11BracedListStyle = false; in getGNUStyle()
1871 Style.ColumnLimit = 79; in getGNUStyle()
1872 Style.FixNamespaceComments = false; in getGNUStyle()
1873 Style.SpaceBeforeParens = FormatStyle::SBPO_Always; in getGNUStyle()
1874 Style.Standard = FormatStyle::LS_Cpp03; in getGNUStyle()
1875 return Style; in getGNUStyle()
1879 FormatStyle Style = getLLVMStyle(Language); in getMicrosoftStyle() local
1880 Style.ColumnLimit = 120; in getMicrosoftStyle()
1881 Style.TabWidth = 4; in getMicrosoftStyle()
1882 Style.IndentWidth = 4; in getMicrosoftStyle()
1883 Style.UseTab = FormatStyle::UT_Never; in getMicrosoftStyle()
1884 Style.BreakBeforeBraces = FormatStyle::BS_Custom; in getMicrosoftStyle()
1885 Style.BraceWrapping.AfterClass = true; in getMicrosoftStyle()
1886 Style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Always; in getMicrosoftStyle()
1887 Style.BraceWrapping.AfterEnum = true; in getMicrosoftStyle()
1888 Style.BraceWrapping.AfterFunction = true; in getMicrosoftStyle()
1889 Style.BraceWrapping.AfterNamespace = true; in getMicrosoftStyle()
1890 Style.BraceWrapping.AfterObjCDeclaration = true; in getMicrosoftStyle()
1891 Style.BraceWrapping.AfterStruct = true; in getMicrosoftStyle()
1892 Style.BraceWrapping.AfterExternBlock = true; in getMicrosoftStyle()
1893 Style.BraceWrapping.BeforeCatch = true; in getMicrosoftStyle()
1894 Style.BraceWrapping.BeforeElse = true; in getMicrosoftStyle()
1895 Style.BraceWrapping.BeforeWhile = false; in getMicrosoftStyle()
1896 Style.PenaltyReturnTypeOnItsOwnLine = 1000; in getMicrosoftStyle()
1897 Style.AllowShortEnumsOnASingleLine = false; in getMicrosoftStyle()
1898 Style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; in getMicrosoftStyle()
1899 Style.AllowShortCaseLabelsOnASingleLine = false; in getMicrosoftStyle()
1900 Style.AllowShortIfStatementsOnASingleLine = FormatStyle::SIS_Never; in getMicrosoftStyle()
1901 Style.AllowShortLoopsOnASingleLine = false; in getMicrosoftStyle()
1902 Style.AlwaysBreakAfterDefinitionReturnType = FormatStyle::DRTBS_None; in getMicrosoftStyle()
1903 Style.AlwaysBreakAfterReturnType = FormatStyle::RTBS_None; in getMicrosoftStyle()
1904 return Style; in getMicrosoftStyle()
1908 FormatStyle Style = getLLVMStyle(); in getClangFormatStyle() local
1909 Style.InsertBraces = true; in getClangFormatStyle()
1910 Style.InsertNewlineAtEOF = true; in getClangFormatStyle()
1911 Style.LineEnding = FormatStyle::LE_LF; in getClangFormatStyle()
1912 Style.RemoveBracesLLVM = true; in getClangFormatStyle()
1913 Style.RemoveParentheses = FormatStyle::RPS_ReturnStatement; in getClangFormatStyle()
1914 return Style; in getClangFormatStyle()
1926 FormatStyle *Style) { in getPredefinedStyle() argument
1928 *Style = getLLVMStyle(Language); in getPredefinedStyle()
1930 *Style = getChromiumStyle(Language); in getPredefinedStyle()
1932 *Style = getMozillaStyle(); in getPredefinedStyle()
1934 *Style = getGoogleStyle(Language); in getPredefinedStyle()
1936 *Style = getWebKitStyle(); in getPredefinedStyle()
1938 *Style = getGNUStyle(); in getPredefinedStyle()
1940 *Style = getMicrosoftStyle(Language); in getPredefinedStyle()
1942 *Style = getClangFormatStyle(); in getPredefinedStyle()
1944 *Style = getNoStyle(); in getPredefinedStyle()
1946 Style->InheritsParentConfig = true; in getPredefinedStyle()
1950 Style->Language = Language; in getPredefinedStyle()
1954 ParseError validateQualifierOrder(FormatStyle *Style) { in validateQualifierOrder() argument
1956 if (Style->QualifierOrder.empty()) in validateQualifierOrder()
1960 for (const auto &Qualifier : Style->QualifierOrder) { in validateQualifierOrder()
1970 std::set<std::string> UniqueQualifiers(Style->QualifierOrder.begin(), in validateQualifierOrder()
1971 Style->QualifierOrder.end()); in validateQualifierOrder()
1972 if (Style->QualifierOrder.size() != UniqueQualifiers.size()) { in validateQualifierOrder()
1974 << "Duplicate Qualifiers " << Style->QualifierOrder.size() in validateQualifierOrder()
1980 if (!llvm::is_contained(Style->QualifierOrder, "type")) in validateQualifierOrder()
1987 FormatStyle *Style, bool AllowUnknownOptions, in parseConfiguration() argument
1990 assert(Style); in parseConfiguration()
1991 FormatStyle::LanguageKind Language = Style->Language; in parseConfiguration()
1995 Style->StyleSet.Clear(); in parseConfiguration()
2003 Input.setContext(Style); in parseConfiguration()
2028 for (const FormatStyle &Style : llvm::reverse(Styles)) { in parseConfiguration() local
2029 if (Style.Language != FormatStyle::LK_None) in parseConfiguration()
2030 StyleSet.Add(Style); in parseConfiguration()
2031 if (Style.Language == Language) in parseConfiguration()
2041 *Style = *StyleSet.Get(Language); in parseConfiguration()
2042 if (Style->InsertTrailingCommas != FormatStyle::TCS_None && in parseConfiguration()
2043 Style->BinPackArguments) { in parseConfiguration()
2047 if (Style->QualifierAlignment != FormatStyle::QAS_Leave) in parseConfiguration()
2048 return make_error_code(validateQualifierOrder(Style)); in parseConfiguration()
2052 std::string configurationAsText(const FormatStyle &Style) { in configurationAsText() argument
2058 FormatStyle NonConstStyle = Style; in configurationAsText()
2074 FormatStyle Style = It->second; in Get() local
2075 Style.StyleSet = *this; in Get()
2076 return Style; in Get()
2079 void FormatStyle::FormatStyleSet::Add(FormatStyle Style) { in Add() argument
2080 assert(Style.Language != LK_None && in Add()
2083 !Style.StyleSet.Styles && in Add()
2087 (*Styles)[Style.Language] = std::move(Style); in Add()
2101 ParensRemover(const Environment &Env, const FormatStyle &Style) in ParensRemover() argument
2102 : TokenAnalyzer(Env, Style) {} in ParensRemover()
2145 BracesInserter(const Environment &Env, const FormatStyle &Style) in BracesInserter() argument
2146 : TokenAnalyzer(Env, Style) {} in BracesInserter()
2198 BracesRemover(const Environment &Env, const FormatStyle &Style) in BracesRemover() argument
2199 : TokenAnalyzer(Env, Style) {} in BracesRemover()
2249 SemiRemover(const Environment &Env, const FormatStyle &Style) in SemiRemover() argument
2250 : TokenAnalyzer(Env, Style) {} in SemiRemover()
2300 JavaScriptRequoter(const Environment &Env, const FormatStyle &Style) in JavaScriptRequoter() argument
2301 : TokenAnalyzer(Env, Style) {} in JavaScriptRequoter()
2328 (Style.JavaScriptQuotes == FormatStyle::JSQS_Single && in requoteJSStringLiteral()
2330 (Style.JavaScriptQuotes == FormatStyle::JSQS_Double && in requoteJSStringLiteral()
2336 bool IsSingle = Style.JavaScriptQuotes == FormatStyle::JSQS_Single; in requoteJSStringLiteral()
2388 Formatter(const Environment &Env, const FormatStyle &Style, in Formatter() argument
2390 : TokenAnalyzer(Env, Style), Status(Status) {} in Formatter()
2404 Env.getSourceManager(), Style, in analyze()
2405 Style.LineEnding > FormatStyle::LE_CRLF in analyze()
2408 Style.LineEnding == FormatStyle::LE_DeriveCRLF) in analyze()
2409 : Style.LineEnding == FormatStyle::LE_CRLF); in analyze()
2410 ContinuationIndenter Indenter(Style, Tokens.getKeywords(), in analyze()
2414 UnwrappedLineFormatter(&Indenter, &Whitespaces, Style, in analyze()
2496 if (Style.DerivePointerAlignment) { in deriveLocalStyle()
2499 Style.PointerAlignment = FormatStyle::PAS_Right; in deriveLocalStyle()
2501 Style.PointerAlignment = FormatStyle::PAS_Left; in deriveLocalStyle()
2502 Style.ReferenceAlignment = FormatStyle::RAS_Pointer; in deriveLocalStyle()
2504 if (Style.Standard == FormatStyle::LS_Auto) { in deriveLocalStyle()
2505 Style.Standard = hasCpp03IncompatibleFormat(AnnotatedLines) in deriveLocalStyle()
2530 TrailingCommaInserter(const Environment &Env, const FormatStyle &Style) in TrailingCommaInserter() argument
2531 : TokenAnalyzer(Env, Style) {} in TrailingCommaInserter()
2576 if (ColumnNumber > Style.ColumnLimit) in insertTrailingCommas()
2591 Cleaner(const Environment &Env, const FormatStyle &Style) in Cleaner() argument
2592 : TokenAnalyzer(Env, Style), in Cleaner()
2666 if (Style.BraceWrapping.AfterNamespace) { in checkEmptyNamespace()
2814 ObjCHeaderStyleGuesser(const Environment &Env, const FormatStyle &Style) in ObjCHeaderStyleGuesser() argument
2815 : TokenAnalyzer(Env, Style), IsObjC(false) {} in ObjCHeaderStyleGuesser()
2821 assert(Style.Language == FormatStyle::LK_Cpp); in analyze()
3042 static void sortCppIncludes(const FormatStyle &Style, in sortCppIncludes() argument
3047 tooling::IncludeCategoryManager Categories(Style.IncludeStyle, FileName); in sortCppIncludes()
3057 if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) { in sortCppIncludes()
3100 Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Preserve) { in sortCppIncludes()
3108 if (Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
3140 tooling::Replacements sortCppIncludes(const FormatStyle &Style, StringRef Code, in sortCppIncludes() argument
3159 tooling::IncludeCategoryManager Categories(Style.IncludeStyle, FileName); in sortCppIncludes()
3196 (Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Merge || in sortCppIncludes()
3197 Style.IncludeStyle.IncludeBlocks == in sortCppIncludes()
3223 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code, in sortCppIncludes()
3240 sortCppIncludes(Style, IncludesInBlock, Ranges, FileName, Code, Replaces, in sortCppIncludes()
3248 static unsigned findJavaImportGroup(const FormatStyle &Style, in findJavaImportGroup() argument
3252 for (unsigned I = 0; I < Style.JavaImportGroups.size(); I++) { in findJavaImportGroup()
3253 const std::string &GroupPrefix = Style.JavaImportGroups[I]; in findJavaImportGroup()
3268 static void sortJavaImports(const FormatStyle &Style, in sortJavaImports() argument
3284 JavaImportGroups.push_back(findJavaImportGroup(Style, Import.Identifier)); in sortJavaImports()
3287 Style.SortJavaStaticImport == FormatStyle::SJSIO_After; in sortJavaImports()
3350 tooling::Replacements sortJavaImports(const FormatStyle &Style, StringRef Code, in sortJavaImports() argument
3398 sortJavaImports(Style, ImportsInBlock, Ranges, FileName, Code, Replaces); in sortJavaImports()
3411 tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code, in sortIncludes() argument
3415 if (!Style.SortIncludes || Style.DisableFormat) in sortIncludes()
3419 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript && in sortIncludes()
3423 if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript) in sortIncludes()
3424 return sortJavaScriptImports(Style, Code, Ranges, FileName); in sortIncludes()
3425 if (Style.Language == FormatStyle::LanguageKind::LK_Java) in sortIncludes()
3426 return sortJavaImports(Style, Code, Ranges, FileName, Replaces); in sortIncludes()
3427 sortCppIncludes(Style, Code, Ranges, FileName, Replaces, Cursor); in sortIncludes()
3435 const FormatStyle &Style) { in processReplacements() argument
3446 ProcessFunc(Style, *NewCode, ChangedRanges, FileName); in processReplacements()
3453 const FormatStyle &Style) { in formatReplacements() argument
3456 auto SortIncludes = [](const FormatStyle &Style, StringRef Code, in formatReplacements()
3459 return sortIncludes(Style, Code, Ranges, FileName); in formatReplacements()
3462 processReplacements(SortIncludes, Code, Replaces, Style); in formatReplacements()
3468 auto Reformat = [](const FormatStyle &Style, StringRef Code, in formatReplacements() argument
3471 return reformat(Style, Code, Ranges, FileName); in formatReplacements()
3473 return processReplacements(Reformat, Code, *SortedReplaces, Style); in formatReplacements()
3491 const FormatStyle &Style) { in fixCppIncludeInsertions() argument
3492 if (!Style.isCpp()) in fixCppIncludeInsertions()
3517 tooling::HeaderIncludes Includes(FileName, Code, Style.IncludeStyle); in fixCppIncludeInsertions()
3564 const FormatStyle &Style) { in cleanupAroundReplacements() argument
3567 auto Cleanup = [](const FormatStyle &Style, StringRef Code, in cleanupAroundReplacements()
3570 return cleanup(Style, Code, Ranges, FileName); in cleanupAroundReplacements()
3574 fixCppIncludeInsertions(Code, Replaces, Style); in cleanupAroundReplacements()
3575 return cantFail(processReplacements(Cleanup, Code, NewReplaces, Style)); in cleanupAroundReplacements()
3580 reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3584 FormatStyle Expanded = Style; in reformat()
3609 if (Style.isJson()) { in reformat()
3617 Formatter(*Env, Style, Status).process().first; in reformat()
3642 if (Style.isCpp()) { in reformat()
3643 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) in reformat()
3646 if (Style.RemoveParentheses != FormatStyle::RPS_Leave) { in reformat()
3648 S.RemoveParentheses = Style.RemoveParentheses; in reformat()
3654 if (Style.InsertBraces) { in reformat()
3662 if (Style.RemoveBracesLLVM) { in reformat()
3670 if (Style.RemoveSemicolon) { in reformat()
3678 if (Style.FixNamespaceComments) { in reformat()
3684 if (Style.SortUsingDeclarations != FormatStyle::SUD_Never) { in reformat()
3691 if (Style.SeparateDefinitionBlocks != FormatStyle::SDS_Leave) { in reformat()
3697 if (Style.Language == FormatStyle::LK_ObjC && in reformat()
3698 !Style.ObjCPropertyAttributeOrder.empty()) { in reformat()
3704 if (Style.isJavaScript() && in reformat()
3705 Style.JavaScriptQuotes != FormatStyle::JSQS_Leave) { in reformat()
3715 if (Style.isJavaScript() && in reformat()
3716 Style.InsertTrailingCommas == FormatStyle::TCS_Wrapped) { in reformat()
3744 if (Style.QualifierAlignment != FormatStyle::QAS_Leave) { in reformat()
3766 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3770 return internal::reformat(Style, Code, Ranges, in reformat()
3777 tooling::Replacements cleanup(const FormatStyle &Style, StringRef Code, in cleanup() argument
3781 if (Style.Language != FormatStyle::LK_Cpp) in cleanup()
3786 return Cleaner(*Env, Style).process().first; in cleanup()
3789 tooling::Replacements reformat(const FormatStyle &Style, StringRef Code, in reformat() argument
3793 auto Result = reformat(Style, Code, Ranges, FileName, &Status); in reformat()
3799 tooling::Replacements fixNamespaceEndComments(const FormatStyle &Style, in fixNamespaceEndComments() argument
3806 return NamespaceEndCommentsFixer(*Env, Style).process().first; in fixNamespaceEndComments()
3809 tooling::Replacements sortUsingDeclarations(const FormatStyle &Style, in sortUsingDeclarations() argument
3816 return UsingDeclarationsSorter(*Env, Style).process().first; in sortUsingDeclarations()
3819 LangOptions getFormattingLangOpts(const FormatStyle &Style) { in getFormattingLangOpts() argument
3822 FormatStyle::LanguageStandard LexingStd = Style.Standard; in getFormattingLangOpts()
3839 bool AlternativeOperators = Style.isCpp(); in getFormattingLangOpts()
3924 FormatStyle *Style, bool AllowUnknownOptions) { in loadAndParseConfigFile() argument
3929 if (auto EC = parseConfiguration(*Text.get(), Style, AllowUnknownOptions)) in loadAndParseConfigFile()
3938 FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code)); in getStyle() local
3940 if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle)) in getStyle()
3950 parseConfiguration(llvm::MemoryBufferRef(StyleName, Source), &Style, in getStyle()
3955 if (!Style.InheritsParentConfig) in getStyle()
3956 return Style; in getStyle()
3967 if (!Style.InheritsParentConfig && in getStyle()
3971 loadAndParseConfigFile(ConfigFile, FS, &Style, AllowUnknownOptions); in getStyle()
3980 if (!Style.InheritsParentConfig) in getStyle()
3981 return Style; in getStyle()
3992 if (!Style.InheritsParentConfig && !StyleName.equals_insensitive("file")) { in getStyle()
3993 if (!getPredefinedStyle(StyleName, Style.Language, &Style)) in getStyle()
3995 if (!Style.InheritsParentConfig) in getStyle()
3996 return Style; in getStyle()
4004 Style.InheritsParentConfig = false; in getStyle()
4008 auto applyChildFormatTexts = [&](FormatStyle *Style) { in getStyle() argument
4010 auto EC = parseConfiguration(*MemBuf, Style, AllowUnknownOptions, in getStyle()
4045 loadAndParseConfigFile(ConfigFile, FS, &Style, AllowUnknownOptions); in getStyle()
4060 if (!Style.InheritsParentConfig) { in getStyle()
4063 applyChildFormatTexts(&Style); in getStyle()
4065 return Style; in getStyle()
4071 Style.InheritsParentConfig = false; in getStyle()
4085 getLanguageName(Style.Language) + ": " + in getStyle()