]> granicus.if.org Git - clang/commit
[CodeGen] Try to not call a dtor after lifetime.end
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 10 Mar 2018 01:11:17 +0000 (01:11 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 10 Mar 2018 01:11:17 +0000 (01:11 +0000)
commit8fdc88794b44e70bdb93c6cf04baf3c1e3251d8b
tree207435c82e1edc3cc8cd30fea8c452b27bbbf7d5
parent72858dcc190c6438930f3cc17a134ed6195f6a15
[CodeGen] Try to not call a dtor after lifetime.end

If CodeGenFunction::EmitCall is:
- asked to emit a call with an indirectly returned value,
- given an invalid return value slot, and
- told the return value of the function it's calling is unused

then it'll make its own temporary, and add lifetime markers so that the
temporary's lifetime ends immediately after the call.

The early lifetime.end becomes problematic when we need to run a
destructor on the result of the function.

Instead of unconditionally saying that results of all calls are used
here (which would be correct, but would also cause us to never emit
lifetime markers for these temporaries), we just build our own temporary
to pass in when a dtor has to be run.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327192 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprAgg.cpp
test/CodeGenObjC/arc.m