[clang] [clang] Fix a crash when a variable is captured by a block nested inside a lambda (PR #93749)

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 11:46:54 PDT 2024


ahatanak wrote:

`hasInit` checks whether `VarDecl::Init`'s pointer is null. But `VarDecl::ensureEvaluatedStmt` creates an `EvaluatedStmt` if there isn't one already,  after which `hasInit` returns true.

https://github.com/llvm/llvm-project/blob/3af717d661e9fe8d562181b933a373ca58e41b27/clang/lib/AST/Decl.cpp#L2541

`Init.get<Stmt *>()` returns null when there's no initializer.

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


More information about the cfe-commits mailing list