diff options
author | Marek Kurdej <marek.kurdej+llvm.org@gmail.com> | 2022-02-10 10:14:36 +0100 |
---|---|---|
committer | Marek Kurdej <marek.kurdej+llvm.org@gmail.com> | 2022-02-10 10:51:03 +0100 |
commit | 4efde1e554cce3f017b3d1ce700bd1860eed2ccd (patch) | |
tree | cd8e0f26deb96246dfa1fbf31f309402581eb2f2 /clang/lib/Format/FormatToken.cpp | |
parent | 34ff99a0b7b18d8242cce7d1fe0e04e003718015 (diff) | |
download | llvm-4efde1e554cce3f017b3d1ce700bd1860eed2ccd.zip llvm-4efde1e554cce3f017b3d1ce700bd1860eed2ccd.tar.gz llvm-4efde1e554cce3f017b3d1ce700bd1860eed2ccd.tar.bz2 |
[clang-format] Move FormatToken::opensBlockOrBlockTypeList to source file. NFC.
Diffstat (limited to 'clang/lib/Format/FormatToken.cpp')
-rw-r--r-- | clang/lib/Format/FormatToken.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index 40aa8f5..5577918d 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -74,6 +74,20 @@ bool FormatToken::isTypeOrIdentifier() const { return isSimpleTypeSpecifier() || Tok.isOneOf(tok::kw_auto, tok::identifier); } +bool FormatToken::opensBlockOrBlockTypeList(const FormatStyle &Style) const { + // C# Does not indent object initialisers as continuations. + if (is(tok::l_brace) && getBlockKind() == BK_BracedInit && Style.isCSharp()) + return true; + if (is(TT_TemplateString) && opensScope()) + return true; + return is(TT_ArrayInitializerLSquare) || is(TT_ProtoExtensionLSquare) || + (is(tok::l_brace) && + (getBlockKind() == BK_Block || is(TT_DictLiteral) || + (!Style.Cpp11BracedListStyle && NestingLevel == 0))) || + (is(tok::less) && (Style.Language == FormatStyle::LK_Proto || + Style.Language == FormatStyle::LK_TextProto)); +} + TokenRole::~TokenRole() {} void TokenRole::precomputeFormattingInfos(const FormatToken *Token) {} |