diff options
| -rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index e724c69eb82..19bca8d860d 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -215,7 +215,7 @@ void UnwrappedLineParser::parsePPDirective() { nextToken(); if (FormatTok.Tok.getIdentifierInfo() == NULL) { - addUnwrappedLine(); + parsePPUnknown(); return; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 5ffd3518891..bffbbf53316 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -714,8 +714,10 @@ TEST_F(FormatTest, DoesNotBreakPureVirtualFunctionDefinition) { " OwningPtr<FileOutputBuffer> &buffer) = 0;"); } -TEST_F(FormatTest, BreaksOnHashWhenDirectiveIsInvalid) { - EXPECT_EQ("#\n;", format("#;")); +TEST_F(FormatTest, LayoutUnknownPPDirective) { + EXPECT_EQ("#123 \"A string literal\"", + format(" # 123 \"A string literal\"")); + EXPECT_EQ("#;", format("#;")); verifyFormat("#\n;\n;\n;"); } |

