This is an archive of the discontinued LLVM Phabricator instance.

Debug info: Add support for DW_TAG_thrown_type.
ClosedPublic

Authored by aprantl on Apr 26 2017, 2:30 PM.

Details

Summary

For Swift we would like to be able to record the error types that a
function may throw in the debug info, so the debugger can display them alongside the
function's return value when finish-ing a function.

DWARF defines DW_TAG_thrown_type (intended to be used for C++ throw()
declarations) that is a perfect fit for this purpose. This patch wires
up support for DW_TAG_thrown_type in LLVM by adding a list of thrown
types to DISubprogram.

To offset the cost of the extra pointer, there is a follow-up patch
that turns DISubprogram into a variable-length node.

rdar://problem/29481673

Diff Detail

Event Timeline

dblaikie accepted this revision.Apr 26 2017, 2:40 PM
dblaikie added inline comments.
test/DebugInfo/Generic/thrownTypes.ll
9

might be nice to have a/the test show more than one of these - to verify that works (I'm not sure there are any other/existing cases where a single DIE contains the same attribute twice? Maybe there are)

This revision is now accepted and ready to land.Apr 26 2017, 2:40 PM
aprantl updated this revision to Diff 96836.Apr 26 2017, 3:27 PM

Expand testcase to use more than one thrown type.
Wire up DIBuilder support & add a unittest.

This revision was automatically updated to reflect the committed changes.