Check whether Sema::CreateBuiltinUnaryOp returns an empty result.

If it does, calling AddInitializerToDecl will crash, so we should
abort the result synthesis in this case.

<rdar://problem/27205383>

llvm-svn: 274787
This commit is contained in:
Jim Ingham 2016-07-07 19:06:37 +00:00
parent 65fa0704aa
commit 3a45e03442
1 changed files with 2 additions and 0 deletions

View File

@ -373,6 +373,8 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body,
ExprResult address_of_expr = m_sema->CreateBuiltinUnaryOp(SourceLocation(), UO_AddrOf, last_expr);
if (address_of_expr.get())
m_sema->AddInitializerToDecl(result_decl, address_of_expr.get(), true, false);
else
return false;
}
else
{