Summary: This patch fixes a case where a proto message attribute is wrongly identified as an text proto extension.
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43465
llvm-svn: 325509
// (aaa) = aaa
// ];
//
+ // extensions 123 [
+ // (aaa) = aaa
+ // ];
+ //
// or text proto extensions (in options):
//
// option (Aaa.options) = {
Left->Type = TT_ArrayInitializerLSquare;
if (!Left->endsSequence(tok::l_square, tok::numeric_constant,
tok::equal) &&
+ !Left->endsSequence(tok::l_square, tok::numeric_constant,
+ tok::identifier) &&
!Left->endsSequence(tok::l_square, tok::colon, TT_SelectorName)) {
Left->Type = TT_ProtoExtensionLSquare;
BindingIncrease = 10;
" aaaaaaaaaaaaaaaa: true\n"
" }\n"
"];");
+ verifyFormat("extensions 20 [(proto2.type) = 'Aaaa.bbbb'];");
+ verifyFormat("extensions 20\n"
+ " [(proto3.type) = 'Aaaa.bbbb', (aaa.Aaa) = 'aaa.bbb'];");
+ verifyFormat("extensions 123 [\n"
+ " (aaa) = aaaa,\n"
+ " (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {\n"
+ " aaaaaaaaaaaaaaaaa: true,\n"
+ " aaaaaaaaaaaaaaaa: true\n"
+ " }\n"
+ "];");
}
TEST_F(FormatTestProto, DoesntWrapFileOptions) {