Page MenuHomePhabricator

[Attributor] Simplify comparison against constant null pointer
ClosedPublic

Authored by jdoerfert on Aug 18 2020, 8:52 AM.

Details

Summary

Comparison against null is a common pattern that usually is followed by
error handling code and the likes. We now use AANonNull to simplify
these comparisons optimistically in order to make more code dead early
on.

Diff Detail

Event Timeline

jdoerfert created this revision.Aug 18 2020, 8:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 18 2020, 8:52 AM
jdoerfert requested review of this revision.Aug 18 2020, 8:52 AM

I think the logic is correct, other people might want to check too.
Maybe we want to add more comments, it doesn't seem obvious what's happening here.

okura added a comment.Aug 19 2020, 6:14 AM

I think the logic is correct too and we need comments for this.
IMHO, putting the conditional into helper function would improve readability.

uenoku accepted this revision.Aug 19 2020, 9:47 AM

Great, LGTM :)

This revision is now accepted and ready to land.Aug 19 2020, 9:47 AM
This revision was landed with ongoing or failed builds.Aug 19 2020, 11:48 PM
This revision was automatically updated to reflect the committed changes.

FWIW, I moved the logic in a helper and added comments. Feel free to let me know if there is anything else :)