summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTestProto.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2018-02-27 19:07:47 +0000
committerKrasimir Georgiev <krasimir@google.com>2018-02-27 19:07:47 +0000
commit0aa4b4cb2e2185029f242a723737df252c1f0fd5 (patch)
tree0bffa82aa0a972dd5370fb23894bb0c0bb85c1ef /clang/unittests/Format/FormatTestProto.cpp
parente8436e8631540850f39ca5cb1f3d5a361ea714ab (diff)
downloadbcm5719-llvm-0aa4b4cb2e2185029f242a723737df252c1f0fd5.tar.gz
bcm5719-llvm-0aa4b4cb2e2185029f242a723737df252c1f0fd5.zip
[clang-format] Format operator key in protos
Summary: This fixes a glitch where ``operator: value`` in a text proto would mess up the underlying formatting since it gets parsed as a kw_operator instead of an identifier. Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43830 llvm-svn: 326227
Diffstat (limited to 'clang/unittests/Format/FormatTestProto.cpp')
-rw-r--r--clang/unittests/Format/FormatTestProto.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp
index 1d6b7502e09..6db44c765b4 100644
--- a/clang/unittests/Format/FormatTestProto.cpp
+++ b/clang/unittests/Format/FormatTestProto.cpp
@@ -478,5 +478,17 @@ TEST_F(FormatTestProto, FormatsRepeatedListInitializersInOptions) {
"};");
}
+TEST_F(FormatTestProto, AcceptsOperatorAsKeyInOptions) {
+ verifyFormat("option (MyProto.options) = {\n"
+ " bbbbbbbbb: <\n"
+ " ccccccccccccccccccccccc: <\n"
+ " operator: 1\n"
+ " operator: 2\n"
+ " operator { key: value }\n"
+ " >\n"
+ " >\n"
+ "};");
+}
+
} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud