diff options
author | Daniel Jasper <djasper@google.com> | 2014-11-18 23:55:27 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-11-18 23:55:27 +0000 |
commit | 3aa9a6a126108b09c912a5e1ea5f9b9004b0ef7a (patch) | |
tree | d5ca659ac3818b1bf215566c7d7b5dadb450f34d /clang/lib/Format/Format.cpp | |
parent | 6761b42b90f931aa59b19b31d014e762dc23dc93 (diff) | |
download | bcm5719-llvm-3aa9a6a126108b09c912a5e1ea5f9b9004b0ef7a.tar.gz bcm5719-llvm-3aa9a6a126108b09c912a5e1ea5f9b9004b0ef7a.zip |
clang-format: Add option to disable alignment after opening brackets
Before:
SomeFunction(parameter,
parameter);
After:
SomeFunction(parameter,
parameter);
Patch by Harry Terkelsen, thank you!
llvm-svn: 222284
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r-- | clang/lib/Format/Format.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 52a88e0a788..fe52fb58765 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -170,6 +170,7 @@ template <> struct MappingTraits<FormatStyle> { } IO.mapOptional("AccessModifierOffset", Style.AccessModifierOffset); + IO.mapOptional("AlignAfterOpenBracket", Style.AlignAfterOpenBracket); IO.mapOptional("AlignEscapedNewlinesLeft", Style.AlignEscapedNewlinesLeft); IO.mapOptional("AlignTrailingComments", Style.AlignTrailingComments); IO.mapOptional("AllowAllParametersOfDeclarationOnNextLine", @@ -324,6 +325,7 @@ FormatStyle getLLVMStyle() { LLVMStyle.Language = FormatStyle::LK_Cpp; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignEscapedNewlinesLeft = false; + LLVMStyle.AlignAfterOpenBracket = true; LLVMStyle.AlignTrailingComments = true; LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true; LLVMStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_All; @@ -411,6 +413,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.PenaltyBreakBeforeFirstCallParameter = 1; if (Language == FormatStyle::LK_Java) { + GoogleStyle.AlignAfterOpenBracket = false; GoogleStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_None; GoogleStyle.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; GoogleStyle.ColumnLimit = 100; @@ -458,6 +461,7 @@ FormatStyle getMozillaStyle() { FormatStyle getWebKitStyle() { FormatStyle Style = getLLVMStyle(); Style.AccessModifierOffset = -4; + Style.AlignAfterOpenBracket = false; Style.AlignTrailingComments = false; Style.BreakBeforeBinaryOperators = FormatStyle::BOS_All; Style.BreakBeforeBraces = FormatStyle::BS_Stroustrup; |