[PATCH] D139544: [clang][dataflow] Add support for structured bindings of tuple-like types.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 9 05:15:04 PST 2022
ymandel added a comment.
> Those BindingDecls never appear in the CFG unless one of the is used.
Indeed. That''s the issue (which this discussion has helped clarify) -- the binding decls are not in the CFG and I was expecting them to be.
> By the time you see this node, the variable has already been created and you can access it using BindingDecl::getHoldingVar(). You want to analyze these BindingDecls when they are used not when you encounter the DecompositionDecl.
Great, that's exactly what this patch does. So, it sounds like we have what we need. Thank you!
Gabor -- now that I understand the issues involved, I think there are two options here:
1. When we encounter a `DeclRefExpr` to a `BindingDecl`, just treat that DeclRefExpr as the underlying binding expression. So, BindingDecl's are never interpreted directly -- we always see through them to their binding expression.
2. (What I have here): When we encounter a `DeclRefExpr` to a `BindingDecl`, force the evaluation of the `BindingDecl` and leave the handling of the `DeclRefExpr` as is.
Based on this discussion, I'm inclined to go with the first option. Moreover, we could use it *for all* `BindingDecl`s, not just tuple-typed decls and thereby entirely drop the custom handling of `BindingDecl`s. WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139544/new/
https://reviews.llvm.org/D139544
More information about the cfe-commits
mailing list