This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Make BitmaskEnum operations constant expressions
ClosedPublic

Authored by labath on Mar 9 2022, 4:12 AM.

Details

Summary

This avoids runtime initialization (a global constructor) whenever they appear
in the initializer.

The patch just adds the constexpr keyword to a couple of functions.

Diff Detail

Event Timeline

labath created this revision.Mar 9 2022, 4:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 4:12 AM
Herald added a subscriber: dexonsmith. · View Herald Transcript
labath requested review of this revision.Mar 9 2022, 4:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 9 2022, 4:12 AM
jlebar accepted this revision.Mar 9 2022, 7:28 AM
This revision is now accepted and ready to land.Mar 9 2022, 7:28 AM

This is just prep work for another change then?

labath added a comment.EditedMar 11 2022, 2:10 AM

This is just prep work for another change then?

Nope. This is the real thing. The "just" in the description is there because sprinkling the constexprs is literally the only thing I had to do to make it work.

This revision was landed with ongoing or failed builds.Mar 11 2022, 2:12 AM
This revision was automatically updated to reflect the committed changes.