[ADT] Make BitmaskEnum operations constant expressions
authorPavel Labath <pavel@labath.sk>
Wed, 9 Mar 2022 12:07:33 +0000 (13:07 +0100)
committerPavel Labath <pavel@labath.sk>
Fri, 11 Mar 2022 10:11:55 +0000 (11:11 +0100)
commit161bddf3af09aa883c9414d793de79c89e51636a
tree8a8f32e43e885464bbbe8636eef01b208d0534f1
parentaeeb1199b4b4d33b823bae15ca969527c89676cf
[ADT] Make BitmaskEnum operations constant expressions

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.

Differential Revision: https://reviews.llvm.org/D121281
llvm/include/llvm/ADT/BitmaskEnum.h
llvm/include/llvm/Support/MathExtras.h
llvm/unittests/ADT/BitmaskEnumTest.cpp