diff options
author | Krasimir Georgiev <krasimir@google.com> | 2018-05-09 09:02:11 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2018-05-09 09:02:11 +0000 |
commit | 8b4bc76a2323961f6f8502e0d5249e53ac41c6ac (patch) | |
tree | ec8c313955390b1e2e991e6276b3f84959f30222 /clang/unittests/Format/FormatTestRawStrings.cpp | |
parent | 8e1c75a4c51528c0ad3a41300e9394df0b50b752 (diff) | |
download | bcm5719-llvm-8b4bc76a2323961f6f8502e0d5249e53ac41c6ac.tar.gz bcm5719-llvm-8b4bc76a2323961f6f8502e0d5249e53ac41c6ac.zip |
[clang-format] Respect BreakBeforeClosingBrace while calculating length
Summary:
This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace`
ParenState for matching scope closers. In order to distinguish between paren states
introduced by real vs. fake parens, I've added the token opening the ParensState
to that struct.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D46519
llvm-svn: 331857
Diffstat (limited to 'clang/unittests/Format/FormatTestRawStrings.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestRawStrings.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestRawStrings.cpp b/clang/unittests/Format/FormatTestRawStrings.cpp index f5a0c1e1816..b88ff07ee63 100644 --- a/clang/unittests/Format/FormatTestRawStrings.cpp +++ b/clang/unittests/Format/FormatTestRawStrings.cpp @@ -822,6 +822,41 @@ xxxxxxxaaaaax wwwwwww = _Verxrrrrrrrrr(PARSE_TEXT_PROTO(R"pb( )test", Style)); } +TEST_F(FormatTestRawStrings, KeepsRBraceFolloedByMoreLBracesOnSameLine) { + FormatStyle Style = getRawStringPbStyleWithColumns(80); + + expect_eq( + R"test( +int f() { + if (1) { + TTTTTTTTTTTTTTTTTTTTT s = PARSE_TEXT_PROTO(R"pb( + ttttttttt { + ppppppppppppp { + [cccccccccc.pppppppppppppp.TTTTTTTTTTTTTTTTTTTT] { field_1: "123_1" } + [cccccccccc.pppppppppppppp.TTTTTTTTTTTTTTTTTTTT] { field_2: "123_2" } + } + } + )pb"); + } +} +)test", + format( + R"test( +int f() { + if (1) { + TTTTTTTTTTTTTTTTTTTTT s = PARSE_TEXT_PROTO(R"pb( + ttttttttt { + ppppppppppppp { + [cccccccccc.pppppppppppppp.TTTTTTTTTTTTTTTTTTTT] { field_1: "123_1" } + [cccccccccc.pppppppppppppp.TTTTTTTTTTTTTTTTTTTT] { field_2: "123_2" }}} + )pb"); + } +} +)test", + Style)); +} + + } // end namespace } // end namespace format } // end namespace clang |