diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 753eada8f1b0..32853dc209e6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1450,6 +1450,15 @@ bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons, nextToken(); parseBracedList(); break; + case tok::less: + if (Style.Language == FormatStyle::LK_Proto) { + nextToken(); + parseBracedList(/*ContinueOnSemicolons=*/false, + /*ClosingBraceKind=*/tok::greater); + } else { + nextToken(); + } + break; case tok::semi: // JavaScript (or more precisely TypeScript) can have semicolons in braced // lists (in so-called TypeMemberLists). Thus, the semicolon cannot be diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 639da87c6ea9..ca26c5439591 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -356,6 +356,11 @@ TEST_F(FormatTestProto, FormatsOptions) { " }\n" " field_g: OK\n" ">;"); + + verifyFormat("option (MyProto.options) = <\n" + " data1 \n" + " data2 {key2: value2}\n" + ">;"); } TEST_F(FormatTestProto, FormatsService) {