r176244 - Fix bug when formatting "A<A<A>>".
Daniel Jasper
djasper at google.com
Thu Feb 28 02:06:06 PST 2013
Author: djasper
Date: Thu Feb 28 04:06:05 2013
New Revision: 176244
URL: http://llvm.org/viewvc/llvm-project?rev=176244&view=rev
Log:
Fix bug when formatting "A<A<A>>".
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaa);
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
int aaaaaaaaaaaaaaaaaaaaaaa);
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=176244&r1=176243&r2=176244&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Thu Feb 28 04:06:05 2013
@@ -999,6 +999,7 @@ public:
if (FormatTok.Tok.is(tok::greatergreater)) {
FormatTok.Tok.setKind(tok::greater);
+ FormatTok.TokenLength = 1;
GreaterStashed = true;
}
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=176244&r1=176243&r2=176244&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Feb 28 04:06:05 2013
@@ -2002,6 +2002,8 @@ TEST_F(FormatTest, BreaksLongDeclaration
verifyGoogleFormat("template <typename T>\n"
"aaaaaaaa::aaaaa::aaaaaa<T, aaaaaaaaaaaaaaaaaaaaaaaaa>\n"
"aaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaa() {}");
+ verifyGoogleFormat("A<A<A>> aaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " int aaaaaaaaaaaaaaaaaaaaaaa);");
}
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {
More information about the cfe-commits
mailing list