[PATCH] D19065: clang-format: Last line in incomplete block is indented incorrectly

Marianne Mailhot-Sarrasin via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 08:02:26 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266321: clang-format: Last line in incomplete block is indented incorrectly (authored by mamai).

Changed prior to commit:
  http://reviews.llvm.org/D19065?vs=53582&id=53723#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19065

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/unittests/Format/FormatTest.cpp

Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -430,6 +430,9 @@
     ++Line->Level;
   parseLevel(/*HasOpeningBrace=*/true);
 
+  if (eof())
+    return;
+
   if (MacroBlock ? !FormatTok->is(TT_MacroBlockEnd)
                  : !FormatTok->is(tok::r_brace)) {
     Line->Level = InitialLevel;
Index: cfe/trunk/unittests/Format/FormatTest.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp
+++ cfe/trunk/unittests/Format/FormatTest.cpp
@@ -7110,10 +7110,9 @@
 }
 
 TEST_F(FormatTest, IndentLineCommentsInStartOfBlockAtEndOfFile) {
-  // FIXME: This is not what we want...
   verifyFormat("{\n"
-               "// a"
-               "// b");
+               "  // a\n"
+               "  // b");
 }
 
 TEST_F(FormatTest, FormatStarDependingOnContext) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19065.53723.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160414/22616f59/attachment.bin>


More information about the cfe-commits mailing list