[clang] [Clang] Implement P0963R3 "Structured binding declaration as a condition" (PR #130228)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 10 02:00:17 PDT 2025
================
@@ -4224,15 +4224,18 @@ class DecompositionDecl final
: public VarDecl,
private llvm::TrailingObjects<DecompositionDecl, BindingDecl *> {
/// The number of BindingDecl*s following this object.
- unsigned NumBindings;
+ unsigned NumBindings : 31;
+
+ LLVM_PREFERRED_TYPE(bool)
+ unsigned IsDecisionVariable : 1;
----------------
cor3ntin wrote:
I am questioning if we really need that.
We know from context if it is or not (ie it's not really a property of the declaration)
- In a _condition_ a DecompositionDecl is always a decision variable
- Outside, it never is.
Maybe
`Compiler<Emitter>::visitDeclStmt`, `CodeGenFunction::EmitDecl`, `EvaluateDecl` can be modified
to take a bool that indicates whether we are in the context of a _condition_.
Is that an approach you considered?
https://github.com/llvm/llvm-project/pull/130228
More information about the cfe-commits
mailing list