]> granicus.if.org Git - clang/commit
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)
commit60c8c0cc0786c7f6b8dc5c1e3acd7ec98f0a7b6d
tree468d74bc13917a93c6a14a8c71d9b656a8b45ad4
parent41055c6168135fe539801799e5c5636247cf0302
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344110 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ExprConstant.cpp