From dfc274d9ec49ca323a5d789b9475fd653351b90c Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 3 Feb 2017 08:29:02 +0000 Subject: [PATCH] clang-format: [Proto] Also supports implicit string literal concatenation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293995 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/TokenAnnotator.cpp | 3 ++- unittests/Format/FormatTestProto.cpp | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 2785ca45e7..16115611a5 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -2391,7 +2391,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, Right.Next->is(tok::string_literal)) return true; } else if (Style.Language == FormatStyle::LK_Cpp || - Style.Language == FormatStyle::LK_ObjC) { + Style.Language == FormatStyle::LK_ObjC || + Style.Language == FormatStyle::LK_Proto) { if (Left.isStringLiteral() && (Right.isStringLiteral() || Right.is(TT_ObjCStringLiteral))) return true; diff --git a/unittests/Format/FormatTestProto.cpp b/unittests/Format/FormatTestProto.cpp index 6881af4361..41d210ac7c 100644 --- a/unittests/Format/FormatTestProto.cpp +++ b/unittests/Format/FormatTestProto.cpp @@ -135,6 +135,9 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { " key: 'a' //\n" " }\n" "];"); + verifyFormat("optional string test = 1 [default =\n" + " \"test\"\n" + " \"test\"];"); } TEST_F(FormatTestProto, DoesntWrapFileOptions) { -- 2.40.0