diff options
author | Daniel Jasper <djasper@google.com> | 2014-12-04 16:07:17 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-12-04 16:07:17 +0000 |
commit | a4e55f4d1ec87056703c752644e12640e97fb5a1 (patch) | |
tree | 2b662c38b633c30ea8a172f10aaf1aa272a9e7e6 /clang/lib/Format/TokenAnnotator.cpp | |
parent | d33304b3adfea0eb407984cc93a508d252a656e6 (diff) | |
download | bcm5719-llvm-a4e55f4d1ec87056703c752644e12640e97fb5a1.tar.gz bcm5719-llvm-a4e55f4d1ec87056703c752644e12640e97fb5a1.zip |
clang-format: [JS] Don't put top-level dict literals on a single line.
These are often used for enums which apparently are easier to read if
formatted with one element per line.
llvm-svn: 223367
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-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 9f692437cad..ede60eede3c 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1891,6 +1891,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line, if (Right.is(tok::char_constant) && Left.is(tok::plus) && Left.Previous && Left.Previous->is(tok::char_constant)) return true; + if (Left.is(TT_DictLiteral) && Left.is(tok::l_brace) && + Left.NestingLevel == 0) + return true; } else if (Style.Language == FormatStyle::LK_Java) { if (Left.is(TT_LeadingJavaAnnotation) && Right.isNot(tok::l_paren) && Line.Last->is(tok::l_brace)) |