diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /clang/lib/Format/FormatTokenLexer.h | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.h')
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.h b/clang/lib/Format/FormatTokenLexer.h index 611211be055a2..6b08677e33697 100644 --- a/clang/lib/Format/FormatTokenLexer.h +++ b/clang/lib/Format/FormatTokenLexer.h @@ -21,6 +21,7 @@ #include "clang/Basic/SourceManager.h" #include "clang/Format/Format.h" #include "llvm/ADT/MapVector.h" +#include "llvm/ADT/StringSet.h" #include "llvm/Support/Regex.h" #include <stack> @@ -37,7 +38,9 @@ enum LexerState { class FormatTokenLexer { public: FormatTokenLexer(const SourceManager &SourceMgr, FileID ID, unsigned Column, - const FormatStyle &Style, encoding::Encoding Encoding); + const FormatStyle &Style, encoding::Encoding Encoding, + llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator, + IdentifierTable &IdentTable); ArrayRef<FormatToken *> lex(); @@ -49,11 +52,13 @@ private: bool tryMergeLessLess(); bool tryMergeNSStringLiteral(); bool tryMergeJSPrivateIdentifier(); - bool tryMergeCSharpVerbatimStringLiteral(); + bool tryMergeCSharpStringLiteral(); bool tryMergeCSharpKeywordVariables(); - bool tryMergeCSharpNullConditionals(); bool tryMergeCSharpDoubleQuestion(); + bool tryMergeCSharpNullConditional(); bool tryTransformCSharpForEach(); + bool tryMergeForEach(); + bool tryTransformTryUsageForC(); bool tryMergeTokens(ArrayRef<tok::TokenKind> Kinds, TokenType NewType); @@ -79,6 +84,8 @@ private: // nested template parts by balancing curly braces. void handleTemplateStrings(); + void handleCSharpVerbatimAndInterpolatedStrings(); + void tryParsePythonComment(); bool tryMerge_TMacro(); @@ -98,10 +105,10 @@ private: const SourceManager &SourceMgr; FileID ID; const FormatStyle &Style; - IdentifierTable IdentTable; + IdentifierTable &IdentTable; AdditionalKeywords Keywords; encoding::Encoding Encoding; - llvm::SpecificBumpPtrAllocator<FormatToken> Allocator; + llvm::SpecificBumpPtrAllocator<FormatToken> &Allocator; // Index (in 'Tokens') of the last token that starts a new line. unsigned FirstInLineIndex; SmallVector<FormatToken *, 16> Tokens; @@ -113,6 +120,9 @@ private: llvm::Regex MacroBlockBeginRegex; llvm::Regex MacroBlockEndRegex; + // Targets that may appear inside a C# attribute. + static const llvm::StringSet<> CSharpAttributeTargets; + void readRawToken(FormatToken &Tok); void resetLexer(unsigned Offset); |