diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2018-02-27 19:07:47 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2018-02-27 19:07:47 +0000 |
| commit | 0aa4b4cb2e2185029f242a723737df252c1f0fd5 (patch) | |
| tree | 0bffa82aa0a972dd5370fb23894bb0c0bb85c1ef /clang/lib/Format | |
| parent | e8436e8631540850f39ca5cb1f3d5a361ea714ab (diff) | |
| download | bcm5719-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/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 f56230ee88c..494b98cd733 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -759,6 +759,9 @@ private: Tok->Type = TT_BinaryOperator; break; case tok::kw_operator: + if (Style.Language == FormatStyle::LK_TextProto || + Style.Language == FormatStyle::LK_Proto) + break; while (CurrentToken && !CurrentToken->isOneOf(tok::l_paren, tok::semi, tok::r_paren)) { if (CurrentToken->isOneOf(tok::star, tok::amp)) |

