diff options
| -rw-r--r-- | clang/lib/Format/FormatToken.h | 2 | ||||
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestProto.cpp | 5 |
3 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Format/FormatToken.h b/clang/lib/Format/FormatToken.h index 002ff25bfa3..49885205994 100644 --- a/clang/lib/Format/FormatToken.h +++ b/clang/lib/Format/FormatToken.h @@ -553,6 +553,7 @@ struct AdditionalKeywords { kw_mark = &IdentTable.get("mark"); + kw_extend = &IdentTable.get("extend"); kw_option = &IdentTable.get("option"); kw_optional = &IdentTable.get("optional"); kw_repeated = &IdentTable.get("repeated"); @@ -597,6 +598,7 @@ struct AdditionalKeywords { IdentifierInfo *kw_mark; // Proto keywords. + IdentifierInfo *kw_extend; IdentifierInfo *kw_option; IdentifierInfo *kw_optional; IdentifierInfo *kw_repeated; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 8f08828b5f2..70ff7d8b9e4 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1949,7 +1949,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, } else if (Style.Language == FormatStyle::LK_Proto) { if (Right.is(tok::period) && Left.isOneOf(Keywords.kw_optional, Keywords.kw_required, - Keywords.kw_repeated)) + Keywords.kw_repeated, Keywords.kw_extend)) return true; if (Right.is(tok::l_paren) && Left.isOneOf(Keywords.kw_returns, Keywords.kw_option)) diff --git a/clang/unittests/Format/FormatTestProto.cpp b/clang/unittests/Format/FormatTestProto.cpp index 0dadd3b6731..cd2c0c8aa46 100644 --- a/clang/unittests/Format/FormatTestProto.cpp +++ b/clang/unittests/Format/FormatTestProto.cpp @@ -162,5 +162,10 @@ TEST_F(FormatTestProto, FormatsService) { "};"); } +TEST_F(FormatTestProto, ExtendingMessage) { + verifyFormat("extend .foo.Bar {\n" + "}"); +} + } // end namespace tooling } // end namespace clang |

