From d8d9839ae67dacb569dcc3e1fcabdbeefb62fe8b Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 20 Nov 2015 14:32:54 +0000 Subject: clang-format: [Proto] Support extending message. Before: extend.foo.Bar { } After: extend .foo.Bar { } llvm-svn: 253667 --- clang/lib/Format/FormatToken.h | 2 ++ clang/lib/Format/TokenAnnotator.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'clang/lib') 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)) -- cgit v1.2.3