]> granicus.if.org Git - clang/commit
[clang-format] Fixes indentation of inner text proto messages
authorKrasimir Georgiev <krasimir@google.com>
Thu, 25 Jan 2018 14:10:43 +0000 (14:10 +0000)
committerKrasimir Georgiev <krasimir@google.com>
Thu, 25 Jan 2018 14:10:43 +0000 (14:10 +0000)
commitf949e0451d222ba394d169f052a0658b259a4af3
treeef4dfabae219fe0c269a9f7e15525041ddc22d51
parent0b990c5f6a4426f90377ad0ab9b642570130df62
[clang-format] Fixes indentation of inner text proto messages

Summary:
Consider the text proto:
```
message {
  sub { key: value }
}
```
Previously the first `{` was TT_Unknown, which caused the inner message to be
indented by the continuation width. This didn't happen for:
```
message {
  sub: { key: value }
}
```
This is because the code to mark the first `{` as a TT_DictLiteral was only
considering the case where it marches forward and reaches a `:`.

This patch updates this by looking not only for `:`, but also for `<` and `{`.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D42500

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323419 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestTextProto.cpp