diff options
| author | Daniel Jasper <djasper@google.com> | 2013-02-13 19:25:54 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-02-13 19:25:54 +0000 |
| commit | 525264c369c6259c4154d06d7cee8f8615ea23c8 (patch) | |
| tree | 6195a812f71dd5e38a7083cfdc2701bedef5ab1d /clang | |
| parent | 553e0fe365b4767924b6cbdde77a3e2a2197cdae (diff) | |
| download | bcm5719-llvm-525264c369c6259c4154d06d7cee8f8615ea23c8.tar.gz bcm5719-llvm-525264c369c6259c4154d06d7cee8f8615ea23c8.zip | |
Fix comment alignment close to the column limit.
Due to an error in one of the expressions, we used to not align comments
although it would have been possible.
llvm-svn: 175068
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index d66271ce61d..d8c02e2e18b 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -127,7 +127,7 @@ public: else Comments.back().MinColumn = Spaces; Comments.back().MaxColumn = - Style.ColumnLimit - Spaces - Tok.FormatTok.TokenLength; + Style.ColumnLimit - Tok.FormatTok.TokenLength; return; } } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 354654b1e28..8fb4b2acd5e 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -465,6 +465,9 @@ TEST_F(FormatTest, UnderstandsSingleLineComments) { " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaa ||\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa || aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;"); + verifyFormat("int aaaa; // aaaaa\n" + "int aa; // aaaaaaa", getLLVMStyleWithColumns(20)); + EXPECT_EQ("void f() { // This does something ..\n" "}\n" "int a; // This is unrelated", |

