summaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-05-29 12:07:31 +0000
committerDaniel Jasper <djasper@google.com>2013-05-29 12:07:31 +0000
commitbbc8776493fc0176d925a5b528e61ee400895047 (patch)
tree8eae99a31041a313bcc7e8d90168d5b9ad927069 /lib/Format/Format.cpp
parent74caf012521be0651fb4f65db37796b900fcdac6 (diff)
downloadclang-bbc8776493fc0176d925a5b528e61ee400895047.tar.gz
clang-bbc8776493fc0176d925a5b528e61ee400895047.tar.bz2
clang-bbc8776493fc0176d925a5b528e61ee400895047.tar.xz
Add option to always break template declarations.
With option enabled (e.g. in Google-style): template <typename T> void f() {} With option disabled: template <typename T> void f() {} Enabling this for Google-style and Chromium-style, not sure which other styles would prefer that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 5e74ed188d..797410ab11 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -85,6 +85,8 @@ template <> struct MappingTraits<clang::format::FormatStyle> {
Style.AllowShortIfStatementsOnASingleLine);
IO.mapOptional("AllowShortLoopsOnASingleLine",
Style.AllowShortLoopsOnASingleLine);
+ IO.mapOptional("AlwaysBreakTemplateDeclarations",
+ Style.AlwaysBreakTemplateDeclarations);
IO.mapOptional("BinPackParameters", Style.BinPackParameters);
IO.mapOptional("ColumnLimit", Style.ColumnLimit);
IO.mapOptional("ConstructorInitializerAllOnOneLineOrOnePerLine",
@@ -120,6 +122,7 @@ FormatStyle getLLVMStyle() {
LLVMStyle.AllowAllParametersOfDeclarationOnNextLine = true;
LLVMStyle.AllowShortIfStatementsOnASingleLine = false;
LLVMStyle.AllowShortLoopsOnASingleLine = false;
+ LLVMStyle.AlwaysBreakTemplateDeclarations = false;
LLVMStyle.BinPackParameters = true;
LLVMStyle.ColumnLimit = 80;
LLVMStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = false;
@@ -146,6 +149,7 @@ FormatStyle getGoogleStyle() {
GoogleStyle.AllowAllParametersOfDeclarationOnNextLine = true;
GoogleStyle.AllowShortIfStatementsOnASingleLine = true;
GoogleStyle.AllowShortLoopsOnASingleLine = true;
+ GoogleStyle.AlwaysBreakTemplateDeclarations = true;
GoogleStyle.BinPackParameters = true;
GoogleStyle.ColumnLimit = 80;
GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;