Do not add newline in empty blocks.

void f() {}
now gets formatted in one line.

llvm-svn: 172067
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index c0ed6c5..39efeab 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1033,6 +1033,8 @@
     if (Left.is(tok::at) &&
         Right.FormatTok.Tok.getObjCKeywordID() != tok::objc_not_keyword)
       return false;
+    if (Left.is(tok::l_brace) && Right.is(tok::r_brace))
+      return false;
     return true;
   }
 
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 736178e..e9c6211 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -167,15 +167,17 @@
   assert(FormatTok.Tok.is(tok::l_brace) && "'{' expected");
   nextToken();
 
-  addUnwrappedLine();
+  if (!FormatTok.Tok.is(tok::r_brace)) {
+    addUnwrappedLine();
 
-  Line->Level += AddLevels;
-  parseLevel(/*HasOpeningBrace=*/true);
-  Line->Level -= AddLevels;
+    Line->Level += AddLevels;
+    parseLevel(/*HasOpeningBrace=*/true);
+    Line->Level -= AddLevels;
 
-  if (!FormatTok.Tok.is(tok::r_brace))
-    return true;
+    if (!FormatTok.Tok.is(tok::r_brace))
+      return true;
 
+  }
   nextToken();  // Munch the closing brace.
   return false;
 }