summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp5
-rw-r--r--clang/unittests/Format/FormatTest.cpp1
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 70f33ad0315..4066b55ecb7 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 54999e1f634..fc4ce101b7b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud