[clang] [Clang][P1061] Add stuctured binding packs (PR #121417)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 05:57:24 PST 2025


================
@@ -12726,11 +12726,15 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
 
   // Likewise, variables with tuple-like bindings are required if their
   // bindings have side-effects.
-  if (const auto *DD = dyn_cast<DecompositionDecl>(VD))
-    for (const auto *BD : DD->bindings())
-      if (const auto *BindingVD = BD->getHoldingVar())
-        if (DeclMustBeEmitted(BindingVD))
-          return true;
+  if (const auto *DD = dyn_cast<DecompositionDecl>(VD)) {
+    bool BindingResult = false;
+    DD->VisitHoldingVars([&](VarDecl *BindingVD) {
----------------
erichkeane wrote:

I'd be a little surprised if there wasn't an existing iterator type that would work.  If not though, I'd vastly prefer removing both of the `Visit` functions and replacing them with iterators.

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


More information about the cfe-commits mailing list