summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-02-03 08:29:02 +0000
committerDaniel Jasper <djasper@google.com>2017-02-03 08:29:02 +0000
commitda910e0a8bb86195e56c1b69f9da16649fcdf518 (patch)
tree606e422359338907f758e6af84429486a2a05491 /clang
parenta16cfe6fa9249a14f6b715cddc76d409c9a4040a (diff)
downloadbcm5719-llvm-da910e0a8bb86195e56c1b69f9da16649fcdf518.tar.gz
bcm5719-llvm-da910e0a8bb86195e56c1b69f9da16649fcdf518.zip
clang-format: [Proto] Also supports implicit string literal concatenation
llvm-svn: 293995
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
-rw-r--r--clang/unittests/Format/FormatTestProto.cpp3
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 2785ca45e70..16115611a5d 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/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/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp
index 6881af4361c..41d210ac7cd 100644
--- a/clang/unittests/Format/FormatTestProto.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud