This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Simplify DIEInteger::SizeOf().
ClosedPublic

Authored by ikudrin on Aug 5 2020, 4:44 AM.

Details

Summary

An AsmPrinter should always be provided to the method because some forms depend on its parameters. The only place in the codebase which passed a nullptr value was found in the unit tests, so the patch updates it to use some dummy AsmPrinter instead.

Diff Detail

Event Timeline

ikudrin created this revision.Aug 5 2020, 4:44 AM
ikudrin requested review of this revision.Aug 5 2020, 4:44 AM
ikudrin planned changes to this revision.Aug 5 2020, 8:42 AM
ikudrin abandoned this revision.Aug 6 2020, 2:14 AM
ikudrin updated this revision to Diff 292203.Sep 16 2020, 6:46 AM
ikudrin retitled this revision from [DebugInfo] Simplify DIEInteger::SizeOf(). NFCI. to [DebugInfo] Simplify DIEInteger::SizeOf()..
ikudrin edited the summary of this revision. (Show Details)

D87008 added creating a test AsmPrinter to the CodeGen unit tests, so it is now possible to fix the DIEHashTest.MemberBlock so that it provides an instance to the tested class.

dblaikie accepted this revision.Sep 16 2020, 10:01 AM

Looks good - thanks!

llvm/unittests/CodeGen/DIEHashTest.cpp
34–39

I'd probably roll this into getAsmPrinter - but up to you.

This revision is now accepted and ready to land.Sep 16 2020, 10:01 AM
ikudrin added inline comments.Sep 16 2020, 6:58 PM
llvm/unittests/CodeGen/DIEHashTest.cpp
34–39

ASSERT_THAT_EXPECTED breaks compilation if placed in a non-void function.

dblaikie added inline comments.Sep 16 2020, 7:11 PM
llvm/unittests/CodeGen/DIEHashTest.cpp
34–39

Fair enough - seems a bit subtle, but I don't have great alternative suggestions. Thanks for explaining!

This revision was automatically updated to reflect the committed changes.