Make the new SanitizerMask code added in r355190 constexpr.
authorJames Y Knight <jyknight@google.com>
Sat, 2 Mar 2019 20:22:48 +0000 (20:22 +0000)
committerJames Y Knight <jyknight@google.com>
Sat, 2 Mar 2019 20:22:48 +0000 (20:22 +0000)
commit47c777fe4102e080baaffd920ec425ed201106b1
tree4f2c4c307bc639f246dc8babf198f628960e9290
parent315d0bbb9c065d0def8d66a69b6fcd94a870d28a
Make the new SanitizerMask code added in r355190 constexpr.

Then, as a consequence, remove the complex set of workarounds for
initialization order -- which are apparently not 100% reliable.

The only downside is that some of the member functions are now
specific to kNumElem == 2, and will need to be updated if that
constant is increased in the future.

Unfortunately, the current code caused an initialization-order runtime
failure for me in some compilation modes. It appears that in a
toolchain without init-array enabled, the order of initialization of
static data members of a template can be reversed w.r.t. the order
within a file.

This caused e.g. SanitizerKind::CFI to be initialized to 0.

I'm not quite sure if that is an allowable ordering variation, or
nonconforming behavior, but in any case, making everything constexpr
eliminates the possibility of such an issue.

llvm-svn: 355278
clang/include/clang/Basic/Sanitizers.h
clang/lib/Basic/Sanitizers.cpp