[PATCH] D137244: [Clang] Correctly capture bindings in dependent lambdas.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 9 08:13:18 PST 2023
aaron.ballman added a comment.
Mostly just nits from me at this point.
================
Comment at: clang/lib/AST/DeclCXX.cpp:3232
+VarDecl *ValueDecl::getPotentiallyDecomposedVarDecl() {
+ assert((isa<VarDecl>(this) || isa<BindingDecl>(this)) &&
+ "expected a VarDecl or a BindingDecl");
----------------
================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:125
+ diag::err_param_default_argument_references_local)
+ << D->getDeclName() << DefaultArg->getSourceRange();
}
----------------
`ValueDecl` is a subclass of `NamedDecl` and the diagnostic printer knows how to properly print those -- I assume this is an NFC change (or near enough to it).
================
Comment at: clang/lib/Sema/SemaExpr.cpp:19648-19649
// odr-used, but we may still need to track them for lambda capture.
// FIXME: Do we also need to do this inside dependent typeid expressions
// (which are modeled as unevaluated at this point)?
+ DoMarkPotentialCapture(SemaRef, Loc, Var, E);
----------------
Should this comment be moved elsewhere, as it now seems detached from the original logic.
================
Comment at: clang/lib/Sema/TreeTransform.h:13326-13327
// Transform the captured variable.
- VarDecl *CapturedVar
- = cast_or_null<VarDecl>(getDerived().TransformDecl(C->getLocation(),
- C->getCapturedVar()));
+ ValueDecl *CapturedVar = cast_or_null<ValueDecl>(
+ getDerived().TransformDecl(C->getLocation(), C->getCapturedVar()));
if (!CapturedVar || CapturedVar->isInvalidDecl()) {
----------------
================
Comment at: clang/test/SemaCXX/cxx20-decomposition.cpp:96
+
template <unsigned long, typename T>
----------------
Spurious whitespace?
================
Comment at: clang/test/SemaCXX/cxx20-decomposition.cpp:160
+ return a;
+ }() ; }(0);
+ (void)[&](auto c) { return b + [&a](auto) {
----------------
Same edit elsewhere. Did clang-format get confused?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137244/new/
https://reviews.llvm.org/D137244
More information about the cfe-commits
mailing list