From 6f2b88a39838fa46b222e506c9407f1cc31feeb3 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 5 Jun 2015 13:18:09 +0000 Subject: clang-format: More eagerly wrap trailing return types. Before: template auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa(t.a) .aaaaaaaa()); After: template auto aaaaaaaaaaaaaaaaaaaaaa(T t) -> decltype(eaaaaaaaaaaaaaaa(t.a).aaaaaaaa()); Also add a test case for a difficult template parsing case I stumbled accross. Needs fixing. llvm-svn: 239149 --- clang/unittests/Format/FormatTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/unittests/Format/FormatTest.cpp') diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 69d6cee7dea..0760530672b 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -3956,6 +3956,9 @@ TEST_F(FormatTest, TrailingReturnType) { verifyFormat("auto SomeFunction(A aaaaaaaaaaaaaaaaaaaaa) const\n" " -> decltype(f(aaaaaaaaaaaaaaaaaaaaa)) {}"); verifyFormat("auto doSomething(Aaaaaa *aaaaaa) -> decltype(aaaaaa->f()) {}"); + verifyFormat("template \n" + "auto aaaaaaaaaaaaaaaaaaaaaa(T t)\n" + " -> decltype(eaaaaaaaaaaaaaaa(t.a).aaaaaaaa());"); // Not trailing return types. verifyFormat("void f() { auto a = b->c(); }"); @@ -6606,6 +6609,7 @@ TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) { // FIXME: This is still incorrectly handled at the formatter side. verifyFormat("template <> struct X < 15, i<3 && 42 < 50 && 33 < 28> {};"); + verifyFormat("int i = SomeFunction(a b);"); // FIXME: // This now gets parsed incorrectly as class definition. -- cgit v1.2.3