summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-02-13 19:25:54 +0000
committerDaniel Jasper <djasper@google.com>2013-02-13 19:25:54 +0000
commit525264c369c6259c4154d06d7cee8f8615ea23c8 (patch)
tree6195a812f71dd5e38a7083cfdc2701bedef5ab1d /clang
parent553e0fe365b4767924b6cbdde77a3e2a2197cdae (diff)
downloadbcm5719-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.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp3
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",
OpenPOWER on IntegriCloud