This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Avoid emitting empty debug globals subsection.
ClosedPublic

Authored by akhuang on Nov 24 2020, 11:41 AM.

Details

Summary

In https://reviews.llvm.org/D89072 I added static const data members
to the debug subsection for globals. It skipped emitting an S_CONSTANT if it
didn't have a value, which meant the subsection could be empty.

This patch fixes the empty subsection issue.

Diff Detail

Event Timeline

akhuang created this revision.Nov 24 2020, 11:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 24 2020, 11:41 AM
akhuang requested review of this revision.Nov 24 2020, 11:41 AM
akhuang updated this revision to Diff 307454.Nov 24 2020, 2:39 PM

avoid calling isa on a null value

rnk accepted this revision.Nov 24 2020, 4:08 PM

Looks good, thanks!

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
3140

LLVM likes to use llvm_unreachable instead for this kind of case

This revision is now accepted and ready to land.Nov 24 2020, 4:08 PM
rnk requested changes to this revision.Nov 24 2020, 4:08 PM

I forgot, you should add a test for this.

This revision now requires changes to proceed.Nov 24 2020, 4:08 PM
rnk added a comment.Nov 24 2020, 4:10 PM

As a super bonus thing, can you make LLD emit a similar warning when it sees empty .debug$S sections? That way we won't run into this again in the future.

akhuang updated this revision to Diff 307725.Nov 25 2020, 4:05 PM

Add test; add warning in lld when it sees empty subsection

rnk accepted this revision.Nov 25 2020, 4:12 PM

Thanks, looks good

This revision is now accepted and ready to land.Nov 25 2020, 4:12 PM
This revision was landed with ongoing or failed builds.Nov 25 2020, 4:13 PM
This revision was automatically updated to reflect the committed changes.