[clang] RewriteModernObjC::SynthBlockInitExpr - remove block nullptr check

All paths have already dereferenced the block pointer
This commit is contained in:
Simon Pilgrim 2022-02-11 15:05:09 +00:00
parent 4490a26a3e
commit f162036fcd

View file

@ -5356,16 +5356,15 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp,
Exp = new (Context) DeclRefExpr(*Context, FD, false, FD->getType(),
VK_LValue, SourceLocation());
bool isNestedCapturedVar = false;
if (block)
for (const auto &CI : block->captures()) {
const VarDecl *variable = CI.getVariable();
if (variable == ND && CI.isNested()) {
assert (CI.isByRef() &&
"SynthBlockInitExpr - captured block variable is not byref");
isNestedCapturedVar = true;
break;
}
for (const auto &CI : block->captures()) {
const VarDecl *variable = CI.getVariable();
if (variable == ND && CI.isNested()) {
assert(CI.isByRef() &&
"SynthBlockInitExpr - captured block variable is not byref");
isNestedCapturedVar = true;
break;
}
}
// captured nested byref variable has its address passed. Do not take
// its address again.
if (!isNestedCapturedVar)