clang-format: Fix line breaking bug after empty ifs.

Before:
  if () {
  }
    else {
  }

After:
  if () {
  } else {
  }

This fixed llvm.org/PR17262.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190855 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index ee91722..58a1eeb 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -1061,6 +1061,7 @@
                Style.BreakConstructorInitializersBeforeComma) {
       Current->MustBreakBefore = true;
     } else if (Current->Previous->BlockKind == BK_Block &&
+               Current->Previous->isNot(tok::r_brace) &&
                Current->isNot(tok::r_brace)) {
       Current->MustBreakBefore = true;
     } else if (Current->is(tok::l_brace) && (Current->BlockKind == BK_Block)) {
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 2dfc405..3c29525 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -351,6 +351,11 @@
                "else {\n"
                "  i();\n"
                "}");
+  verifyFormat("void f() {\n"
+               "  if (a) {\n"
+               "  } else {\n"
+               "  }\n"
+               "}");
 }
 
 TEST_F(FormatTest, ElseIf) {