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) {