From c79e4d2d253d234c3f5bef70ab1d5fbb582cd279 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 14 Mar 2017 00:40:32 +0000 Subject: clang-format: Make it very slighly more expensive to wrap between "= {". This prevents unwanted fallout from r296664. Specifically in proto formatting, this changed: optional Aaaaaaaa aaaaaaaa = 12 [ (aaa) = aaaa, (bbbbbbbbbbbbbbbbbbbbbbbbbb) = { aaaaaaaaaaaaaaaaa: true, aaaaaaaaaaaaaaaa: true } ]; Into: optional Aaaaaaaa aaaaaaaa = 12 [ (aaa) = aaaa, (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {aaaaaaaaaaaaaaaaa: true, aaaaaaaaaaaaaaaa: true} ]; Which is considered less readable. Generally, it seems preferable to format such dict literals as blocks rather than contract them to one line. llvm-svn: 297696 --- clang/unittests/Format/FormatTestProto.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/unittests/Format/FormatTestProto.cpp') diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 41d210ac7cd..d174c65a1f3 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -138,6 +138,13 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { verifyFormat("optional string test = 1 [default =\n" " \"test\"\n" " \"test\"];"); + verifyFormat("optional Aaaaaaaa aaaaaaaa = 12 [\n" + " (aaa) = aaaa,\n" + " (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {\n" + " aaaaaaaaaaaaaaaaa: true,\n" + " aaaaaaaaaaaaaaaa: true\n" + " }\n" + "];"); } TEST_F(FormatTestProto, DoesntWrapFileOptions) { -- cgit v1.2.3