diff options
author | Daniel Jasper <djasper@google.com> | 2013-01-09 09:50:48 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-01-09 09:50:48 +0000 |
commit | d64f73812f3e6473ef8b6b6ec909bb9d8a510843 (patch) | |
tree | 70ef3ef92b384b65c0d6550ca137dec1274948b6 | |
parent | 41df16e2a835f547b9384643e1804e75940e74dd (diff) |
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);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171963 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Format/Format.cpp | 2 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index e5e59f4550..fbcb228fbe 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -315,7 +315,7 @@ private: 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; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index fb21ea7c6f..56d4e17468 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -869,6 +869,9 @@ TEST_F(FormatTest, WrapsTemplateDeclarations) { "aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaa,\n" " aaaaaaaaaaaaaaaaaaaaaaaaaa<T>::aaaaaaaaaa,\n" " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); + verifyFormat("template <typename T>\n" + "void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n" + " int aaaaaaaaaaaaaaaaa);"); } |