r173787 - Reverting changes from r173785 (removing empty lines before "}").

Daniel Jasper djasper at google.com
Tue Jan 29 02:00:16 PST 2013


Author: djasper
Date: Tue Jan 29 04:00:16 2013
New Revision: 173787

URL: http://llvm.org/viewvc/llvm-project?rev=173787&view=rev
Log:
Reverting changes from r173785 (removing empty lines before "}").

This needs some more thinking, e.g. for namespaces, chains of if-else
if, ...

Modified:
    cfe/trunk/lib/Format/Format.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=173787&r1=173786&r2=173787&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Tue Jan 29 04:00:16 2013
@@ -1990,8 +1990,6 @@ private:
                                  Style.MaxEmptyLinesToKeep + 1);
     if (Newlines == 0 && !Tok.IsFirst)
       Newlines = 1;
-    if (Tok.Tok.is(tok::r_brace) && Newlines > 1)
-      Newlines = 1;
     unsigned Indent = Level * 2;
 
     bool IsAccessModifier = false;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=173787&r1=173786&r2=173787&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Jan 29 04:00:16 2013
@@ -136,7 +136,6 @@ TEST_F(FormatTest, FormatsUnwrappedLines
 
 TEST_F(FormatTest, FormatsNestedBlockStatements) {
   EXPECT_EQ("{\n  {\n    {}\n  }\n}", format("{{{}}}"));
-  EXPECT_EQ("{\n  {\n    {}\n  }\n}", format("{{{}}\n\n}"));
 }
 
 TEST_F(FormatTest, FormatsNestedCall) {





More information about the cfe-commits mailing list