This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Handle __func__ inside __finally
ClosedPublic

Authored by smeenai on Apr 11 2018, 8:52 AM.

Details

Summary

When we enter a __finally block, the CGF's CurCodeDecl will be null
(because CodeGenFunction::StartFunction is given an empty GlobalDecl for
a __finally block), and so the dyn_cast here will result in an assertion
failure. Change it to dyn_cast_or_null to handle this case.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Apr 11 2018, 8:52 AM
smeenai edited the summary of this revision. (Show Details)Apr 11 2018, 8:53 AM
smeenai added inline comments.Apr 11 2018, 8:55 AM
test/CodeGen/exceptions-seh-finally.c
281 ↗(On Diff #142025)

How stable is the mangling here? I included the complete call instruction because I wanted to ensure that the value of __func__ inside a __finally block reflects the parent function, not the outlined funclet, and both the [18 x i8] and the mangled string name are pretty good proxies for that. I can generalize it more if it'll make the test more reliable though.

rnk accepted this revision.Apr 11 2018, 10:03 AM

lgtm, thanks!

test/CodeGen/exceptions-seh-finally.c
281 ↗(On Diff #142025)

It's pretty stable.

This revision is now accepted and ready to land.Apr 11 2018, 10:03 AM
This revision was automatically updated to reflect the committed changes.