This is an archive of the discontinued LLVM Phabricator instance.

[llvm][Support] Add isZero method for TypeSize. [NFC]
ClosedPublic

Authored by fpetrogalli on Mar 24 2020, 7:41 PM.

Details

Summary

The method is used where TypeSize is implicitly cast to integer for
being checked against 0.

Diff Detail

Event Timeline

fpetrogalli created this revision.Mar 24 2020, 7:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2020, 7:41 PM

I removed an instance of the isNonZero method, as the patch relates
only to the isZero method. I'll create a separate patch for that.

sdesmalen accepted this revision.Mar 26 2020, 1:28 PM

LGTM, thanks!

While this patch is quite trivial, for other patches, you may want to add a few more reviewers.

This revision is now accepted and ready to land.Mar 26 2020, 1:28 PM
sdesmalen added inline comments.Mar 26 2020, 1:32 PM
llvm/include/llvm/Support/TypeSize.h
153

nit: I mentioned this to Graham when he first proposed TypeSize, but having this variable named 'MinSize' is a bit odd when you compare with Zero, because in a sense, the minimum size of <anything> is always zero :)

fpetrogalli marked an inline comment as done.
fpetrogalli added a subscriber: efriedma.

LGTM, thanks!

While this patch is quite trivial, for other patches, you may want to add a few more reviewers.

Sure, will do. Added @efriedma for visibility, I'll wait some time before submitting to give them the possibility to comment in case they want to.

Thanks,

Francesco

llvm/include/llvm/Support/TypeSize.h
153

Agree. Shall we rename it to KnownSize, and consequently rename the get method to getKnownSize?

Thanks for the review!

fpetrogalli marked an inline comment as done.Mar 26 2020, 1:51 PM
fpetrogalli added inline comments.
llvm/include/llvm/Support/TypeSize.h
153

Of course, in a separate patch! :)

This revision was automatically updated to reflect the committed changes.