diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2018-02-14 19:47:58 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2018-02-14 19:47:58 +0000 |
| commit | 76064a4b1e7fd1d53cdef12300cb21ceccad3e48 (patch) | |
| tree | dcb027179613cff61ee8a39966de425cab3725d8 /clang/lib/Format | |
| parent | ab31b7759dc3cc02b83c49ce1790aef0db9bf1f0 (diff) | |
| download | bcm5719-llvm-76064a4b1e7fd1d53cdef12300cb21ceccad3e48.tar.gz bcm5719-llvm-76064a4b1e7fd1d53cdef12300cb21ceccad3e48.zip | |
[clang-format] Recognize percents as format specifiers in protos
Summary:
Frequently, a percent in protos denotes a formatting specifier for string replacement.
Thus it is desirable to keep the percent together with what follows after it.
Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D43294
llvm-svn: 325159
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 248e2b58501..0d54208bbe9 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2425,6 +2425,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, if (Left.MatchingParen && Left.MatchingParen->is(TT_ProtoExtensionLSquare) && Right.isOneOf(tok::l_brace, tok::less)) return !Style.Cpp11BracedListStyle; + // A percent is probably part of a formatting specification, such as %lld. + if (Left.is(tok::percent)) + return false; } else if (Style.Language == FormatStyle::LK_JavaScript) { if (Left.is(TT_JsFatArrow)) return true; |

