r175068 - Fix comment alignment close to the column limit.
Daniel Jasper
djasper at google.com
Wed Feb 13 11:25:55 PST 2013
Author: djasper
Date: Wed Feb 13 13:25:54 2013
New Revision: 175068
URL: http://llvm.org/viewvc/llvm-project?rev=175068&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Format/Format.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/Format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/Format.cpp?rev=175068&r1=175067&r2=175068&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Feb 13 13:25:54 2013
@@ -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;
}
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=175068&r1=175067&r2=175068&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Feb 13 13:25:54 2013
@@ -465,6 +465,9 @@ TEST_F(FormatTest, UnderstandsSingleLine
" 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",
More information about the cfe-commits
mailing list