diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-04 07:28:12 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-04 07:28:12 +0000 |
commit | ffbad0e8aa36c7e0cc7026a989b21177dc1fb255 (patch) | |
tree | c2a09e88442cd7ad938ba53cc1af6bfd6bcfdc0e /clang/lib/Format | |
parent | ccff4d1e60ceda9bd295116596029c0537033dbf (diff) | |
download | bcm5719-llvm-ffbad0e8aa36c7e0cc7026a989b21177dc1fb255.tar.gz bcm5719-llvm-ffbad0e8aa36c7e0cc7026a989b21177dc1fb255.zip |
clang-format: [Proto] Basic support for options with <> for repeated fields.
llvm-svn: 256737
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index d032a947861..51c58786c73 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -459,7 +459,8 @@ private: break; } } - if (Contexts.back().ColonIsDictLiteral) { + if (Contexts.back().ColonIsDictLiteral || + Style.Language == FormatStyle::LK_Proto) { Tok->Type = TT_DictLiteral; } else if (Contexts.back().ColonIsObjCMethodExpr || Line.startsWith(TT_ObjCMethodSpecifier)) { @@ -1878,6 +1879,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, tok::numeric_constant, tok::l_paren, tok::l_brace, tok::kw_true, tok::kw_false)) return false; + if (Left.is(tok::colon)) + return !Left.is(TT_ObjCMethodExpr); if (Left.is(tok::coloncolon)) return false; if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) @@ -1928,8 +1931,6 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, !Right.isOneOf(TT_ObjCMethodExpr, TT_LambdaLSquare) && !Left.isOneOf(tok::numeric_constant, TT_DictLiteral)) return false; - if (Left.is(tok::colon)) - return !Left.is(TT_ObjCMethodExpr); if (Left.is(tok::l_brace) && Right.is(tok::r_brace)) return !Left.Children.empty(); // No spaces in "{}". if ((Left.is(tok::l_brace) && Left.BlockKind != BK_Block) || |