diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2018-03-16 15:23:22 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2018-03-16 15:23:22 +0000 |
| commit | abbd54ce009579da4aa532b83632cc584f0b7b19 (patch) | |
| tree | fbad68c068771cc6f8b7d0416b28113e1399c732 /clang/lib/Format | |
| parent | a9f05a9d50bb49b54ff0fbccc5e65016edd5a0da (diff) | |
| download | bcm5719-llvm-abbd54ce009579da4aa532b83632cc584f0b7b19.tar.gz bcm5719-llvm-abbd54ce009579da4aa532b83632cc584f0b7b19.zip | |
[clang-format] Disallow breaks before ']' in text proto extensions
Summary: This disallows patterns like `[ext.name\n]` in text protos.
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D44569
llvm-svn: 327716
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 3de454cc98a..edb5a6fd7aa 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2968,6 +2968,9 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; return true; } + if (Right.is(tok::r_square) && Right.MatchingParen && + Right.MatchingParen->is(TT_ProtoExtensionLSquare)) + return false; if (Right.is(TT_SelectorName) || (Right.is(tok::identifier) && Right.Next && Right.Next->is(TT_ObjCMethodExpr))) return Left.isNot(tok::period); // FIXME: Properly parse ObjC calls. |

