[clang] [Clang] Implement P0963R3 "Structured binding declaration as a condition" (PR #130228)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 10 06:21:16 PDT 2025


================
@@ -5105,7 +5105,18 @@ bool Compiler<Emitter>::visitCompoundStmt(const CompoundStmt *S) {
 }
 
 template <class Emitter>
-bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
+bool Compiler<Emitter>::emitDecompositionVarInit(const DecompositionDecl *DD) {
+  for (auto *BD : DD->bindings())
+    if (auto *KD = BD->getHoldingVar()) {
+      if (!this->visitVarDecl(KD))
+        return false;
+    }
----------------
mizvekov wrote:

```suggestion
  for (auto *BD : DD->bindings())
    if (auto *KD = BD->getHoldingVar(); KD && !this->visitVarDecl(KD))
        return false;
```

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


More information about the cfe-commits mailing list