]> granicus.if.org Git - clang/commitdiff
clang-format: [Proto] Also supports implicit string literal concatenation
authorDaniel Jasper <djasper@google.com>
Fri, 3 Feb 2017 08:29:02 +0000 (08:29 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 3 Feb 2017 08:29:02 +0000 (08:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293995 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestProto.cpp

index 2785ca45e70f727acd3834265b65bca064788b50..16115611a5da66109882b97155fa5522c9dcb5ef 100644 (file)
@@ -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;
index 6881af4361cf788f583cadc32fe36ae4376e8ead..41d210ac7cd71df4c07f1b165717c01295d68003 100644 (file)
@@ -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) {