forked from OSchip/llvm-project
[clang-format] Break consecutive string literals in text protos
Summary: This patch fixes a bug where consecutive string literals in text protos were put on the same line. Reviewers: alexfh Reviewed By: alexfh Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44204 llvm-svn: 326945
This commit is contained in:
parent
d8139348fb
commit
9ad7af6423
|
@ -2717,7 +2717,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
|
|||
return true;
|
||||
} else if (Style.Language == FormatStyle::LK_Cpp ||
|
||||
Style.Language == FormatStyle::LK_ObjC ||
|
||||
Style.Language == FormatStyle::LK_Proto) {
|
||||
Style.Language == FormatStyle::LK_Proto ||
|
||||
Style.Language == FormatStyle::LK_TextProto) {
|
||||
if (Left.isStringLiteral() && Right.isStringLiteral())
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -452,5 +452,11 @@ TEST_F(FormatTestTextProto, AcceptsOperatorAsKey) {
|
|||
" >\n"
|
||||
">");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestTextProto, BreaksConsecutiveStringLiterals) {
|
||||
verifyFormat("ala: \"str1\"\n"
|
||||
" \"str2\"\n");
|
||||
}
|
||||
|
||||
} // end namespace tooling
|
||||
} // end namespace clang
|
||||
|
|
Loading…
Reference in New Issue