From dd5b1018d97a9666da92d320485a727ac63ee89a Mon Sep 17 00:00:00 2001 From: Manuel Klimek <klimek@google.com> Date: Mon, 7 Jan 2013 10:03:37 +0000 Subject: [PATCH] Fix incorrect FIXME. The case that we wanted to write a test for cannot happen, as the UnwrappedLineParser already protects against it. Added an assert to prevent regressions of that assumption. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171720 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/UnwrappedLineParser.cpp | 5 +++-- unittests/Format/FormatTest.cpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 70f33ad0315..4066b55ecb7 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -41,8 +41,9 @@ public: } virtual FormatToken getNextToken() { - // FIXME: Write test that breaks due to a missing - // if (eof()) return createEOF(); + // The \c UnwrappedLineParser guards against this by never calling + // \c getNextToken() after it has encountered the first eof token. + assert(!eof()); Token = PreviousTokenSource->getNextToken(); if (eof()) return createEOF(); diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 54999e1f634..fc4ce101b7b 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -394,6 +394,7 @@ TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) { TEST_F(FormatTest, BreaksOnHashWhenDirectiveIsInvalid) { EXPECT_EQ("#\n;", format("#;")); + verifyFormat("#\n;\n;\n;"); } TEST_F(FormatTest, UnescapedEndOfLineEndsPPDirective) { -- GitLab