This is an archive of the discontinued LLVM Phabricator instance.

[NFC] add new function is64Bit for SymbolicFile class
ClosedPublic

Authored by DiggerLin on Feb 1 2023, 11:07 AM.

Details

Summary

since the class 'SymbolicFile ' do not have a is64Bit() API , when we need to check whether a SymbolicFile object is 64bit or not. we need to write a function to do it, it maybe cause duplication code.

Diff Detail

Event Timeline

DiggerLin created this revision.Feb 1 2023, 11:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2023, 11:07 AM
DiggerLin requested review of this revision.Feb 1 2023, 11:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2023, 11:07 AM
DiggerLin updated this revision to Diff 494018.Feb 1 2023, 11:11 AM

run git format

Some nits, but this basically looks fine so far. Do we have testing that exercises each of the new methods?

llvm/include/llvm/Object/MachO.h
740

I'm not sure there's a need to move the declaration?

llvm/include/llvm/Object/SymbolicFile.h
161

I think it would be better to make this a pure virtual function and force every implementation to specify the bitness of the object file (even if it's always 32-bit). Otherwise, when a new format comes along, it would be easy to forget to implement this function.

llvm/include/llvm/Object/TapiFile.h
51–53

Please leave these methods in the order they were in before.

DiggerLin updated this revision to Diff 494318.Feb 2 2023, 8:19 AM
DiggerLin marked an inline comment as done.

address comment .

MaskRay accepted this revision.Feb 2 2023, 1:33 PM
MaskRay added inline comments.
llvm/include/llvm/Object/SymbolicFile.h
161

This can be marked done now.

llvm/include/llvm/Object/TapiFile.h
51–53

This can be marked done now.

This revision is now accepted and ready to land.Feb 2 2023, 1:33 PM
jhenderson accepted this revision.Feb 3 2023, 1:46 AM

LGTM too.

DiggerLin marked 4 inline comments as done.Feb 3 2023, 6:03 AM
DiggerLin added inline comments.
llvm/include/llvm/Object/MachO.h
740

just move the all the override API together.

This revision was landed with ongoing or failed builds.Feb 6 2023, 7:44 AM
This revision was automatically updated to reflect the committed changes.