]> granicus.if.org Git - clang/commit
Make __builtin_object_size always answer correctly
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 19 Aug 2015 02:19:07 +0000 (02:19 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Wed, 19 Aug 2015 02:19:07 +0000 (02:19 +0000)
commit81392bb9bf07e8db12ac79a6015a09d6cd1b8ca4
tree14dd018873e209e96ce2010aab6f1d27d15065ff
parentc4831ee4a2d61b73238b6aba2fd5193c44d9277c
Make __builtin_object_size always answer correctly

__builtin_object_size would return incorrect answers for many uses where
type=3. This fixes the inaccuracy by making us emit 0 instead of LLVM's
objectsize intrinsic.

Additionally, there are many cases where we would emit suboptimal (but
correct) answers, such as when arrays are involved. This patch fixes
some of these cases (please see new tests in test/CodeGen/object-size.c
for specifics on which cases are improved)

Resubmit of r245323 with PR24493 fixed.
Patch mostly by Richard Smith.
Differential Revision: http://reviews.llvm.org/D12000
This fixes PR15212.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245403 91177308-0d34-0410-b5e6-96231b3b80d8
lib/AST/ExprConstant.cpp
test/CodeGen/object-size.c
test/Sema/const-eval.c