From 61e6bbf8508a46ad1269c8ea67dc0372b84e9a3b Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 29 May 2013 12:07:31 +0000 Subject: Add option to always break template declarations. With option enabled (e.g. in Google-style): template void f() {} With option disabled: template void f() {} Enabling this for Google-style and Chromium-style, not sure which other styles would prefer that. llvm-svn: 182849 --- clang/lib/Format/Format.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/lib/Format/Format.cpp') diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 5e74ed188dc..797410ab11d 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -85,6 +85,8 @@ template <> struct MappingTraits { 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; -- cgit v1.2.3