[cfe-commits] r171963 - in /cfe/trunk: lib/Format/Format.cpp unittests/Format/FormatTest.cpp
Daniel Jasper
djasper at google.com
Wed Jan 9 01:50:49 PST 2013
Author: djasper
Date: Wed Jan 9 03:50:48 2013
New Revision: 171963
URL: http://llvm.org/viewvc/llvm-project?rev=171963&view=rev
Log:
Correctly format wrapped function call parameters in templated functions.
This fixes llvm.org/PR14846.
Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
int aaaaaaaaaaaaaaaaa);
After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
int aaaaaaaaaaaaaaaaa);
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=171963&r1=171962&r2=171963&view=diff
==============================================================================
--- cfe/trunk/lib/Format/Format.cpp (original)
+++ cfe/trunk/lib/Format/Format.cpp Wed Jan 9 03:50:48 2013
@@ -315,7 +315,7 @@
WhitespaceStartColumn);
}
- State.LastSpace[ParenLevel] = State.Indent[ParenLevel];
+ State.LastSpace[ParenLevel] = State.Column;
if (Current.is(tok::colon) && CurrentLineType != LT_ObjCMethodDecl &&
State.NextToken->Type != TT_ConditionalExpr)
State.Indent[ParenLevel] += 2;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=171963&r1=171962&r2=171963&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Wed Jan 9 03:50:48 2013
@@ -869,6 +869,9 @@
"aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+ verifyFormat("template <typename T>\n"
+ "void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " int aaaaaaaaaaaaaaaaa);");
}
More information about the cfe-commits
mailing list