diff options
author | Daniel Jasper <djasper@google.com> | 2014-01-29 18:43:40 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-01-29 18:43:40 +0000 |
commit | 6e58feef76e2ba57198dcdcb8e4d24f14ace6621 (patch) | |
tree | ab63254243acd404327e3c959a3eae25557107b9 /clang | |
parent | 2cbbdf41c061fff572b354ac8549432709f1fe35 (diff) | |
download | bcm5719-llvm-6e58feef76e2ba57198dcdcb8e4d24f14ace6621.tar.gz bcm5719-llvm-6e58feef76e2ba57198dcdcb8e4d24f14ace6621.zip |
clang-format: Fix formatting of custom proto options.
Before:
repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {
aaaaaaaaaaaaaaaaa : AAAAAAAA
}];
After:
repeated double value = 1
[(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];
llvm-svn: 200405
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 6e82b19148c..a0edae51a72 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1469,7 +1469,7 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, // deliberate choice and might have aligned the contents of the string // literal accordingly. Thus, we try keep existing line breaks. return Right.NewlinesBefore > 0; - } else if (Right.Previous->is(tok::l_brace) && + } else if (Right.Previous->is(tok::l_brace) && Right.NestingLevel == 1 && Style.Language == FormatStyle::LK_Proto) { // Don't enums onto single lines in protocol buffers. return true; diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 6304d9688fd..443c3e10159 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -80,6 +80,8 @@ TEST_F(FormatTestProto, MessageFieldAttributes) { " deprecated = true];"); verifyFormat("optional LongMessageType long_proto_field = 1\n" " [default = REALLY_REALLY_LONG_CONSTANT_VALUE];"); + verifyFormat("repeated double value = 1\n" + " [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaaa : AAAAAAAA}];"); } TEST_F(FormatTestProto, FormatsOptions) { |