]> granicus.if.org Git - clang/commitdiff
Flip flag to merge short if-statements into one line for Google style.
authorDaniel Jasper <djasper@google.com>
Wed, 24 Apr 2013 13:46:00 +0000 (13:46 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 24 Apr 2013 13:46:00 +0000 (13:46 +0000)
This now allows clang-format to do:
if (a) return;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180187 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index 0c3f85d124773eb68b1210f6f1251c2f8fc3e333..b483308a5a4cdb86b8628293ad26db56d6084cf9 100644 (file)
@@ -67,7 +67,7 @@ FormatStyle getGoogleStyle() {
   GoogleStyle.BinPackParameters = true;
   GoogleStyle.AllowAllParametersOfDeclarationOnNextLine = true;
   GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
-  GoogleStyle.AllowShortIfStatementsOnASingleLine = false;
+  GoogleStyle.AllowShortIfStatementsOnASingleLine = true;
   GoogleStyle.ObjCSpaceBeforeProtocolList = false;
   GoogleStyle.PenaltyExcessCharacter = 1000000;
   GoogleStyle.PenaltyReturnTypeOnItsOwnLine = 200;
@@ -77,6 +77,7 @@ FormatStyle getGoogleStyle() {
 FormatStyle getChromiumStyle() {
   FormatStyle ChromiumStyle = getGoogleStyle();
   ChromiumStyle.AllowAllParametersOfDeclarationOnNextLine = false;
+  ChromiumStyle.AllowShortIfStatementsOnASingleLine = false;
   ChromiumStyle.BinPackParameters = false;
   ChromiumStyle.Standard = FormatStyle::LS_Cpp03;
   ChromiumStyle.DerivePointerBinding = false;