Page MenuHomePhabricator

[Align] Remove operations on MaybeAlign that asserted that it had a defined value.

Authored by craig.topper on Fri, May 22, 1:00 PM.



If the caller needs to reponsible for making sure the MaybeAlign
has a value, then we should just make the caller convert it to an Align
with operator*.

I explicitly deleted the relational comparison operators that
were being inherited from Optional. It's unclear what the meaning
of two MaybeAligns were one is defined and the other isn't
should be. So make the caller reponsible for defining the behavior.

I left the ==/!= operators from Optional. But now that exposed a
weird quirk that ==/!= between Align and MaybeAlign required the
MaybeAlign to be defined. But now the Align will be implicitly
converted to MaybeAlign and we'll use the MaybeAlign/MaybeAlign

/!=. I don't think that's a big problem though.

Diff Detail

Event Timeline

craig.topper created this revision.Fri, May 22, 1:00 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
efriedma accepted this revision.Fri, May 22, 3:55 PM

Optional has template <typename T> bool operator<(const Optional<T> &X, const T &Y); are you sure that doesn't trigger for MaybeAlign/Align?

Otherwise LGTM

This revision is now accepted and ready to land.Fri, May 22, 3:55 PM
This revision was automatically updated to reflect the committed changes.

LGTM thx for the patch.