ExprConstant: Make __builtin_object_size use EM_IgnoreSideEffects.
authorJames Y Knight <jyknight@google.com>
Wed, 10 Oct 2018 02:53:43 +0000 (02:53 +0000)
committerJames Y Knight <jyknight@google.com>
Wed, 10 Oct 2018 02:53:43 +0000 (02:53 +0000)
commit892b09ba11c99f033a8dd1ec62e04754aaeeba7c
tree6a6297616f4d330ef66d86b49a2d0a414fa024bb
parentbc1586352e135fb673360b7d56743ed516c5f7ee
ExprConstant: Make __builtin_object_size use EM_IgnoreSideEffects.

And, since EM_OffsetFold is now unused, remove it.

While builtin_object_size intends to ignore the presence of
side-effects in its argument, the EM_OffsetFold mode was NOT
configured to ignore side-effects. Rather it was effectively identical
to EM_ConstantFold -- its explanatory comment
notwithstanding.

However, currently, keepEvaluatingAfterSideEffect() is not always
honored -- sometimes evaluation continues despite it returning
false. Therefore, since the b_o_s code was only checking the return
value from evaluation, and not additionally checking the
HasSideEffects flag, side-effects _were_ in many cases actually being
ignored.

This change is a prerequisite cleanup towards fixing that issue.

Differential Revision: https://reviews.llvm.org/D52924

llvm-svn: 344110
clang/lib/AST/ExprConstant.cpp