]> granicus.if.org Git - clang/commit
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)
commit88a2da87723f20dfc9d6fa77b4d65aa7a691ff8d
treed247a34294da790a0990f5bc11ad37f1d25e3e23
parent8e47b092c60e3b4842e6200e022dd1253e9896c6
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355278 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/Sanitizers.h
lib/Basic/Sanitizers.cpp