diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-01-25 14:10:43 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-01-25 14:10:43 +0000 |
commit | 91700e07938908adb720e616fcc61062b8da1fc0 (patch) | |
tree | 5cf7ea76caf5a84c90506696d29665f8cf00d3db /clang/unittests/Format/FormatTestTextProto.cpp | |
parent | 0fb9638e3c473ac53a4de6ef4911dbf12bfcaf76 (diff) | |
download | bcm5719-llvm-91700e07938908adb720e616fcc61062b8da1fc0.tar.gz bcm5719-llvm-91700e07938908adb720e616fcc61062b8da1fc0.zip |
[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
llvm-svn: 323419
Diffstat (limited to 'clang/unittests/Format/FormatTestTextProto.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestTextProto.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestTextProto.cpp b/clang/unittests/Format/FormatTestTextProto.cpp index 82da8737a37..26de5c9d106 100644 --- a/clang/unittests/Format/FormatTestTextProto.cpp +++ b/clang/unittests/Format/FormatTestTextProto.cpp @@ -289,6 +289,10 @@ TEST_F(FormatTestTextProto, SupportsAngleBracketMessageFields) { " headheadheadheadheadhead_id: 1\n" " product_data <product {1}>\n" ">"); + + verifyFormat("dcccwrnfioeruvginerurneitinfo {\n" + " exte3nsionrnfvui {key: value}\n" + "}"); } TEST_F(FormatTestTextProto, DiscardsUnbreakableTailIfCanBreakAfter) { |