diff options
author | Owen Pan <owenpiano@gmail.com> | 2024-03-19 18:02:09 -0700 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2024-03-19 18:06:59 -0700 |
commit | 6f31cf51dfdc2c317ba8149d57d2ffb583403833 (patch) | |
tree | c8e573cc76f641371b41c4301577a9bbaba6770d /clang/lib/Format/FormatTokenLexer.cpp | |
parent | a289f66efd638c2af14cdb88968e4eaeea0c0605 (diff) | |
download | llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.zip llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.gz llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.bz2 |
Revert "[clang-format][NFC] Eliminate the IsCpp parameter in all functions (#84599)"
This reverts c3a1eb6207d8 (and the related commit f3c5278efa3b) which makes
cleanupAroundReplacements() no longer thread-safe.
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index a1c8df8..12db4de 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -30,7 +30,6 @@ FormatTokenLexer::FormatTokenLexer( Encoding(Encoding), Allocator(Allocator), FirstInLineIndex(0), FormattingDisabled(false), MacroBlockBeginRegex(Style.MacroBlockBegin), MacroBlockEndRegex(Style.MacroBlockEnd) { - assert(IsCpp == Style.isCpp()); Lex.reset(new Lexer(ID, SourceMgr.getBufferOrFake(ID), SourceMgr, LangOpts)); Lex->SetKeepWhitespaceMode(true); @@ -111,7 +110,7 @@ void FormatTokenLexer::tryMergePreviousTokens() { return; if (tryMergeForEach()) return; - if (IsCpp && tryTransformTryUsageForC()) + if (Style.isCpp() && tryTransformTryUsageForC()) return; if (Style.isJavaScript() || Style.isCSharp()) { @@ -1338,7 +1337,7 @@ FormatToken *FormatTokenLexer::getNextToken() { Column = FormatTok->LastLineColumnWidth; } - if (IsCpp) { + if (Style.isCpp()) { auto *Identifier = FormatTok->Tok.getIdentifierInfo(); auto it = Macros.find(Identifier); if (!(Tokens.size() > 0 && Tokens.back()->Tok.getIdentifierInfo() && |