diff options
author | Fangrui Song <maskray@google.com> | 2019-07-24 08:04:29 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-07-24 08:04:29 +0000 |
commit | 00e8ac3bebfa92e5a6260de0a87d70108d03edf4 (patch) | |
tree | da2f7c34f7387365daf992a88ae06d0288e663ae /clang/lib/Format/TokenAnnotator.cpp | |
parent | 0e7bbb11220a761fd999440b9bba3d30cac35095 (diff) | |
download | bcm5719-llvm-00e8ac3bebfa92e5a6260de0a87d70108d03edf4.tar.gz bcm5719-llvm-00e8ac3bebfa92e5a6260de0a87d70108d03edf4.zip |
[Format] Make it easy to add new format::FormatStyle::LanguageStandard. NFCI
Preparatory change for D65043.
We current use `!=LS_Cpp03` to enable language standards 11,14,17, and
2a. `>=LS_Cpp11` is better if we decide to add new LanguageStandard in
the future.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D65183
llvm-svn: 366876
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index d105d619afb..c5b9fbdae16 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2859,7 +2859,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, (Style.Language == FormatStyle::LK_Proto && Left.is(TT_DictLiteral))) return !Style.Cpp11BracedListStyle; return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) && - (Style.Standard != FormatStyle::LS_Cpp11 || Style.SpacesInAngles); + (Style.Standard < FormatStyle::LS_Cpp11 || Style.SpacesInAngles); } if (Right.isOneOf(tok::arrow, tok::arrowstar, tok::periodstar) || Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) || @@ -2878,7 +2878,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, return Right.WhitespaceRange.getBegin() != Right.WhitespaceRange.getEnd(); if (Right.is(tok::coloncolon) && !Left.isOneOf(tok::l_brace, tok::comment)) return (Left.is(TT_TemplateOpener) && - Style.Standard == FormatStyle::LS_Cpp03) || + Style.Standard < FormatStyle::LS_Cpp11) || !(Left.isOneOf(tok::l_paren, tok::r_paren, tok::l_square, tok::kw___super, TT_TemplateCloser, TT_TemplateOpener)) || |