diff options
| author | Manuel Klimek <klimek@google.com> | 2013-01-07 07:56:50 +0000 |
|---|---|---|
| committer | Manuel Klimek <klimek@google.com> | 2013-01-07 07:56:50 +0000 |
| commit | ef920699401edf1d910d8af00a600d536732c522 (patch) | |
| tree | 8edb8b65a08d34473013057e516bb55e122712f9 /clang/unittests/Format/FormatTest.cpp | |
| parent | c7345ccc2c4732603d2803d10b2b235807727057 (diff) | |
| download | bcm5719-llvm-ef920699401edf1d910d8af00a600d536732c522.tar.gz bcm5719-llvm-ef920699401edf1d910d8af00a600d536732c522.zip | |
Fix layouting of tokens with a leading escaped newline.
If a token follows directly on an escaped newline, the escaped newline
is stored with the token. Since we re-layout escaped newlines, we need
to treat them just like normal whitespace - thus, we need to increase
the whitespace-length of the token, while decreasing the token length
(otherwise the token length contains the length of the escaped newline
and we double-count it while indenting).
llvm-svn: 171706
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index de794dabb6c..3e672ae5a3a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -481,6 +481,12 @@ TEST_F(FormatTest, FormatUnbalancedStructuralElements) { format("#define A } }\nint i;", getLLVMStyleWithColumns(11))); } +TEST_F(FormatTest, EscapedNewlineAtStartOfTokenInMacroDefinition) { + EXPECT_EQ("#define A \\\n int i; \\\n int j;", + format("#define A \\\nint i;\\\n int j;", + getLLVMStyleWithColumns(11))); +} + TEST_F(FormatTest, MixingPreprocessorDirectivesAndNormalCode) { EXPECT_EQ( "#define ALooooooooooooooooooooooooooooooooooooooongMacro(" |

