]> granicus.if.org Git - clang/commit
Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 11 Jun 2013 02:41:00 +0000 (02:41 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 11 Jun 2013 02:41:00 +0000 (02:41 +0000)
commit85af7cecadbf5d4b905d6b3b4b1b6fa684183aff
tree8cf297a2c2da7cfbcdf9cf3a84fdc9530f9d4b44
parent939d83efba53994af07c7dc82b88873132a18c0d
Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.

We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183721 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGCleanup.cpp
lib/CodeGen/CGCleanup.h
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CodeGenFunction.h
lib/Sema/SemaInit.cpp
test/CodeGenCXX/cxx11-thread-local.cpp
test/CodeGenCXX/temporaries.cpp