[clang] [Clang] Treat the body of an expansion statement with expansion size 0 as discarded (PR #212319)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 4 22:22:28 PDT 2026


================
@@ -1784,13 +1784,15 @@ void ASTStmtReader::VisitCXXForRangeStmt(CXXForRangeStmt *S) {
 
 void ASTStmtReader::VisitCXXExpansionStmtPattern(CXXExpansionStmtPattern *S) {
   VisitStmt(S);
-  Record.skipInts(1); // Skip kind.
+  Record.skipInts(2); // Skip kind and whether there is an expansion size.
----------------
ojhunt wrote:

Not something to be addressed here but I really wish we had someway to do this in a clearer way - my preference would be

```cpp
[[unused]] unsigned kind = Record.readInt();
[[unused]] bool hasExpansionSize = Record.readInt();
```

But I assume that there's a perf cost that makes `skipInts` worthwhile.

I don't know if `readBool`/`writeBool` is more efficient/validated than a raw int.

https://github.com/llvm/llvm-project/pull/212319


More information about the cfe-commits mailing list