When evaluating a __builtin_constant_p conditional, always enter
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 10 Sep 2019 21:24:09 +0000 (21:24 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 10 Sep 2019 21:24:09 +0000 (21:24 +0000)
commit045b2270ceba0ad785cf27beb05dd59ce10372f6
tree6ce165e8759f68105b728b5124d896a603b561bd
parent1e1db800487cbaf96e8f7809e3df42ba979c121d
When evaluating a __builtin_constant_p conditional, always enter
constant-folding mode regardless of the original evaluation mode.

In order for this to be correct, we need to track whether we're checking
for a potential constant expression or checking for undefined behavior
separately from the evaluation mode enum, since we don't want to clobber
those states when entering constant-folding mode.

llvm-svn: 371557
clang/lib/AST/ExprConstant.cpp
clang/test/Sema/i-c-e.c