diff options
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 093e88f..edd126c 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -304,6 +304,18 @@ struct ScalarEnumerationTraits<FormatStyle::BreakTemplateDeclarationsStyle> { } }; +template <> struct ScalarEnumerationTraits<FormatStyle::BracedListStyle> { + static void enumeration(IO &IO, FormatStyle::BracedListStyle &Value) { + IO.enumCase(Value, "Block", FormatStyle::BLS_Block); + IO.enumCase(Value, "FunctionCall", FormatStyle::BLS_FunctionCall); + IO.enumCase(Value, "AlignFirstComment", FormatStyle::BLS_AlignFirstComment); + + // For backward compatibility. + IO.enumCase(Value, "false", FormatStyle::BLS_Block); + IO.enumCase(Value, "true", FormatStyle::BLS_AlignFirstComment); + } +}; + template <> struct ScalarEnumerationTraits<FormatStyle::DAGArgStyle> { static void enumeration(IO &IO, FormatStyle::DAGArgStyle &Value) { IO.enumCase(Value, "DontBreak", FormatStyle::DAS_DontBreak); @@ -1628,7 +1640,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.CompactNamespaces = false; LLVMStyle.ConstructorInitializerIndentWidth = 4; LLVMStyle.ContinuationIndentWidth = 4; - LLVMStyle.Cpp11BracedListStyle = true; + LLVMStyle.Cpp11BracedListStyle = FormatStyle::BLS_AlignFirstComment; LLVMStyle.DerivePointerAlignment = false; LLVMStyle.DisableFormat = false; LLVMStyle.EmptyLineAfterAccessModifier = FormatStyle::ELAAMS_Never; @@ -1904,7 +1916,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { // beneficial there. Investigate turning this on once proper string reflow // has been implemented. GoogleStyle.BreakStringLiterals = false; - GoogleStyle.Cpp11BracedListStyle = false; + GoogleStyle.Cpp11BracedListStyle = FormatStyle::BLS_Block; GoogleStyle.SpacesInContainerLiterals = false; } else if (Language == FormatStyle::LK_ObjC) { GoogleStyle.AlwaysBreakBeforeMultilineStrings = false; @@ -2000,7 +2012,7 @@ FormatStyle getMozillaStyle() { MozillaStyle.BreakTemplateDeclarations = FormatStyle::BTDS_Yes; MozillaStyle.ConstructorInitializerIndentWidth = 2; MozillaStyle.ContinuationIndentWidth = 2; - MozillaStyle.Cpp11BracedListStyle = false; + MozillaStyle.Cpp11BracedListStyle = FormatStyle::BLS_Block; MozillaStyle.FixNamespaceComments = false; MozillaStyle.IndentCaseLabels = true; MozillaStyle.ObjCSpaceAfterProperty = true; @@ -2023,7 +2035,7 @@ FormatStyle getWebKitStyle() { Style.BreakBeforeBraces = FormatStyle::BS_WebKit; Style.BreakConstructorInitializers = FormatStyle::BCIS_BeforeComma; Style.ColumnLimit = 0; - Style.Cpp11BracedListStyle = false; + Style.Cpp11BracedListStyle = FormatStyle::BLS_Block; Style.FixNamespaceComments = false; Style.IndentWidth = 4; Style.NamespaceIndentation = FormatStyle::NI_Inner; @@ -2043,7 +2055,7 @@ FormatStyle getGNUStyle() { Style.BreakBeforeBraces = FormatStyle::BS_GNU; Style.BreakBeforeTernaryOperators = true; Style.ColumnLimit = 79; - Style.Cpp11BracedListStyle = false; + Style.Cpp11BracedListStyle = FormatStyle::BLS_Block; Style.FixNamespaceComments = false; Style.KeepFormFeed = true; Style.SpaceBeforeParens = FormatStyle::SBPO_Always; |