Author: Owen Pan Date: 2026-01-10T19:58:29-08:00 New Revision: 4f90ce4e6ec20db592836421ce309aaab134c353
URL: https://github.com/llvm/llvm-project/commit/4f90ce4e6ec20db592836421ce309aaab134c353 DIFF: https://github.com/llvm/llvm-project/commit/4f90ce4e6ec20db592836421ce309aaab134c353.diff LOG: [clang-format][NFC] Minor cleanups of RemoveParentheses Added: Modified: clang/lib/Format/UnwrappedLineParser.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index c1a9161b10720..5503df481b557 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -2618,10 +2618,9 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType, nextToken(); if (Prev) { auto OptionalParens = [&] { - if (MightBeStmtExpr || MightBeFoldExpr || SeenComma || InMacroCall || - Line->InMacroBody || - Style.RemoveParentheses == FormatStyle::RPS_Leave || - RParen->getPreviousNonComment() == LParen) { + if (Style.RemoveParentheses == FormatStyle::RPS_Leave || + MightBeStmtExpr || MightBeFoldExpr || SeenComma || InMacroCall || + Line->InMacroBody || RParen->getPreviousNonComment() == LParen) { return false; } const bool DoubleParens = @@ -2659,14 +2658,14 @@ bool UnwrappedLineParser::parseParens(TokenType AmpAmpTokenType, } return false; }; - if (Prev->is(TT_TypenameMacro)) { + if (OptionalParens()) { + LParen->Optional = true; + RParen->Optional = true; + } else if (Prev->is(TT_TypenameMacro)) { LParen->setFinalizedType(TT_TypeDeclarationParen); RParen->setFinalizedType(TT_TypeDeclarationParen); } else if (Prev->is(tok::greater) && RParen->Previous == LParen) { Prev->setFinalizedType(TT_TemplateCloser); - } else if (OptionalParens()) { - LParen->Optional = true; - RParen->Optional = true; } } return SeenEqual; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
