]> granicus.if.org Git - clang/commitdiff
Fix incorrect FIXME.
authorManuel Klimek <klimek@google.com>
Mon, 7 Jan 2013 10:03:37 +0000 (10:03 +0000)
committerManuel Klimek <klimek@google.com>
Mon, 7 Jan 2013 10:03:37 +0000 (10:03 +0000)
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
unittests/Format/FormatTest.cpp

index 70f33ad0315cadfc1482cb4ad7aea79e26f8f806..4066b55ecb78f4bf96caede37c99070df8d5e80c 100644 (file)
@@ -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();
index 54999e1f634c5633d7d5f207fed471c778586cf9..fc4ce101b7bfb08a4f7409be970b786d066e809e 100644 (file)
@@ -394,6 +394,7 @@ TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) {
 
 TEST_F(FormatTest, BreaksOnHashWhenDirectiveIsInvalid) {
   EXPECT_EQ("#\n;", format("#;"));
+  verifyFormat("#\n;\n;\n;");
 }
 
 TEST_F(FormatTest, UnescapedEndOfLineEndsPPDirective) {