Don't merge one-line functions in weird brace styles.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181872 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 6472a1f..99521ea 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1341,7 +1341,8 @@
     if (I + 1 == E || (I + 1)->Type == LT_Invalid)
       return;
 
-    if (I->Last->is(tok::l_brace)) {
+    if (I->Last->is(tok::l_brace) &&
+        Style.BreakBeforeBraces == FormatStyle::BS_Attach) {
       tryMergeSimpleBlock(I, E, Limit);
     } else if (I->First.is(tok::kw_if)) {
       tryMergeSimpleIf(I, E, Limit);
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index b804577..69a0078 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -4117,6 +4117,10 @@
                "      b();\n"
                "    }\n"
                "  }\n"
+               "  void g()\n"
+               "  {\n"
+               "    return;\n"
+               "  }\n"
                "}\n"
                "}",
                BreakBeforeBrace);
@@ -4134,6 +4138,10 @@
                "      b();\n"
                "    }\n"
                "  }\n"
+               "  void g()\n"
+               "  {\n"
+               "    return;\n"
+               "  }\n"
                "}\n"
                "}",
                BreakBeforeBrace);