diff options
author | Owen Pan <owenpiano@gmail.com> | 2025-04-30 00:09:29 -0700 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2025-04-30 00:12:41 -0700 |
commit | 7752e0a10b25da2f2eadbed10606bd5454dbca05 (patch) | |
tree | 298332e72d270e10c30e6cd7e44a296f61a77add /clang/lib/Format/FormatTokenLexer.cpp | |
parent | 38cb7d5e7591cdfb39d1030480920ec1ce4873c6 (diff) | |
download | llvm-7752e0a10b25da2f2eadbed10606bd5454dbca05.zip llvm-7752e0a10b25da2f2eadbed10606bd5454dbca05.tar.gz llvm-7752e0a10b25da2f2eadbed10606bd5454dbca05.tar.bz2 |
Revert "[clang-format] Add OneLineFormatOffRegex option (#137577)"
This reverts commit b8bb1ccb4f9126d1bc9817be24e17f186a75a08b which triggered
an assertion failure in CodeGenTest.TestNonAlterTest.
Diffstat (limited to 'clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r-- | clang/lib/Format/FormatTokenLexer.cpp | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/clang/lib/Format/FormatTokenLexer.cpp b/clang/lib/Format/FormatTokenLexer.cpp index bff9db2..a4c94ac 100644 --- a/clang/lib/Format/FormatTokenLexer.cpp +++ b/clang/lib/Format/FormatTokenLexer.cpp @@ -83,43 +83,8 @@ FormatTokenLexer::FormatTokenLexer( ArrayRef<FormatToken *> FormatTokenLexer::lex() { assert(Tokens.empty()); assert(FirstInLineIndex == 0); - const llvm::Regex FormatOffRegex(Style.OneLineFormatOffRegex); - enum { FO_None, FO_CurrentLine, FO_NextLine } FormatOff = FO_None; do { Tokens.push_back(getNextToken()); - auto &Tok = *Tokens.back(); - const auto NewlinesBefore = Tok.NewlinesBefore; - switch (FormatOff) { - case FO_CurrentLine: - if (NewlinesBefore == 0) - Tok.Finalized = true; - else - FormatOff = FO_None; - break; - case FO_NextLine: - if (NewlinesBefore > 1) { - FormatOff = FO_None; - } else { - Tok.Finalized = true; - FormatOff = FO_CurrentLine; - } - break; - default: - if (!FormattingDisabled && FormatOffRegex.match(Tok.TokenText)) { - if (Tok.is(tok::comment) && - (NewlinesBefore > 0 || &Tok == Tokens.front())) { - Tok.Finalized = true; - FormatOff = FO_NextLine; - } else { - for (auto *Token : reverse(Tokens)) { - Token->Finalized = true; - if (Token->NewlinesBefore > 0) - break; - } - FormatOff = FO_CurrentLine; - } - } - } if (Style.isJavaScript()) { tryParseJSRegexLiteral(); handleTemplateStrings(); |