This is an archive of the discontinued LLVM Phabricator instance.

[llvm/Object] - Make dyn_cast<XCOFFObjectFile> work as it should.
ClosedPublic

Authored by grimar on Aug 25 2020, 7:55 AM.

Details

Summary

Currently, dyn_cast<XCOFFObjectFile> always does cast and returns a pointer,
even when we pass ELF/Wasm/Mach-O or COFF instead of XCOFF.

It happens because XCOFFObjectFile class does not implement classof.
I've fixed it and added a unit test.

Diff Detail

Event Timeline

grimar created this revision.Aug 25 2020, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2020, 7:55 AM
grimar requested review of this revision.Aug 25 2020, 7:55 AM
MaskRay accepted this revision.Aug 25 2020, 11:25 PM
MaskRay added inline comments.
llvm/tools/llvm-objdump/llvm-objdump.cpp
540 ↗(On Diff #287667)

This reordering is unneeded...

This revision is now accepted and ready to land.Aug 25 2020, 11:25 PM
grimar planned changes to this revision.Aug 26 2020, 2:10 AM
grimar marked an inline comment as done.
grimar added inline comments.
llvm/tools/llvm-objdump/llvm-objdump.cpp
540 ↗(On Diff #287667)

Yes, I've did it to test the change mostly. I'll try to prepare a unit test instead.

grimar updated this revision to Diff 287907.Aug 26 2020, 3:51 AM
grimar marked an inline comment as done.
grimar edited the summary of this revision. (Show Details)
  • Added unit test.
This revision is now accepted and ready to land.Aug 26 2020, 3:51 AM
grimar requested review of this revision.Aug 26 2020, 3:51 AM
This revision is now accepted and ready to land.Aug 26 2020, 4:17 AM