[clang] [Clang] Treat the body of an expansion statement with expansion size 0 as discarded (PR #212319)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 11:48:11 PDT 2026
================
@@ -2371,6 +2371,20 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc,
MisleadingIndentationChecker MIChecker(*this, MSK_for, ForLoc);
+ // If this is an expansion statement with a known expansion size of 0, parse
+ // the body as a discarded statement.
+ bool ShouldEnterDiscardedContext = false;
+ if (ESD && ForRangeStmt.isUsable()) {
+ auto *Pattern = ForRangeStmt.getAs<CXXExpansionStmtPattern>();
+ ShouldEnterDiscardedContext = Pattern->getExpansionSize() == 0u;
----------------
Sirraide wrote:
Yes
https://github.com/llvm/llvm-project/pull/212319
More information about the cfe-commits
mailing list