shafik added inline comments.
================
Comment at: clang/lib/AST/StmtPrinter.cpp:2166
if (Node->isInitCapture(C)) {
+ VarDecl *D = cast<VarDecl>(C->getCapturedVar());
----------------
I wonder if it is worth commenting that only a `VarDecl` can be an init capture
and therefore we can unconditionally cast to `VarDecl`?
================
Comment at: clang/lib/Sema/SemaInit.cpp:7851
+ bool InitCapture =
+ isa<VarDecl>(VD) && cast<VarDecl>(VD)->isInitCapture();
Diag(Elem.Capture->getLocation(),
diag::note_lambda_capture_initializer)
----------------
cor3ntin wrote:
> shafik wrote:
> > I see we are doing this kind of check to see if we have a `VarDecl` and
> > then check if it is an init capture and I wish there was a way not to
> > repeat this but I don't see it.
> I considered having a function In ValueDecl, what do you think?
I thought about that but when I looked at `ValueDecl` it seemed pretty
lightweight.
@aaron.ballman wdyt is `ValueDecl` the right place or is this code repetition
ok?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122768/new/
https://reviews.llvm.org/D122768
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits