Skip to content

Commit f162036

Browse files
committed
[clang] RewriteModernObjC::SynthBlockInitExpr - remove block nullptr check
All paths have already dereferenced the block pointer
1 parent 4490a26 commit f162036

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5356,16 +5356,15 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp,
53565356
Exp = new (Context) DeclRefExpr(*Context, FD, false, FD->getType(),
53575357
VK_LValue, SourceLocation());
53585358
bool isNestedCapturedVar = false;
5359-
if (block)
5360-
for (const auto &CI : block->captures()) {
5361-
const VarDecl *variable = CI.getVariable();
5362-
if (variable == ND && CI.isNested()) {
5363-
assert (CI.isByRef() &&
5364-
"SynthBlockInitExpr - captured block variable is not byref");
5365-
isNestedCapturedVar = true;
5366-
break;
5367-
}
5359+
for (const auto &CI : block->captures()) {
5360+
const VarDecl *variable = CI.getVariable();
5361+
if (variable == ND && CI.isNested()) {
5362+
assert(CI.isByRef() &&
5363+
"SynthBlockInitExpr - captured block variable is not byref");
5364+
isNestedCapturedVar = true;
5365+
break;
53685366
}
5367+
}
53695368
// captured nested byref variable has its address passed. Do not take
53705369
// its address again.
53715370
if (!isNestedCapturedVar)

0 commit comments

Comments
 (0)