diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-07 10:48:50 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-07 10:48:50 +0000 |
commit | 71607512cb70db3c1be8f0287153b681531687fc (patch) | |
tree | dbe5d30ca247121afcce41ac3feda5de5919b2e8 /unittests/Format/FormatTest.cpp | |
parent | dd5b1018d97a9666da92d320485a727ac63ee89a (diff) |
Do not break before "0" in pure virtual function declarations.
Before:
virtual void write(ELFWriter *writer, OwningPtr<FileOutputBuffer> &buffer) =
0
After:
virtual void write(ELFWriter *writerrr,
OwningPtr<FileOutputBuffer> &buffer) = 0;
This addresses llvm.org/PR14815.
To implement this I introduced a line type during parsing and moved the
definition of TokenType out of the struct for increased readability.
Should have done the latter in a separate patch, but it would be hard to
pull apart now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index fc4ce101b7..db822e7b37 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -392,6 +392,12 @@ TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) { " aLoooooooooooooooooooooooongFuuuuuuuuuuuuuunctiooooooooo)"); } +TEST_F(FormatTest, DoesNotBreakPureVirtualFunctionDefinition) { + verifyFormat( + "virtual void write(ELFWriter *writerrr,\n" + " OwningPtr<FileOutputBuffer> &buffer) = 0;"); +} + TEST_F(FormatTest, BreaksOnHashWhenDirectiveIsInvalid) { EXPECT_EQ("#\n;", format("#;")); verifyFormat("#\n;\n;\n;"); |