[PATCH] D44124: [analyzer] Support destruction and lifetime-extension of inlined function return values.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 5 15:41:10 PST 2018

NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet.
Herald added subscribers: cfe-commits, rnkovacs.

With https://reviews.llvm.org/D44120 we can find the `CXXBindTemporaryExpr` and `MaterializeTemporaryExpr` that correspond to the temporary object that is being returned from a function into its caller. These expressions are on the caller side because it is the caller that's responsible for managing the lifetime of such temporary.

In order to find those expressions, we look at the call site's CFG element, notice that it is a `CFGValueTypedCall` that was added in https://reviews.llvm.org/D44120, and take the relevant construction context information from there.

This patch does not yet affect temporaries that were returned from conservatively evaluated functions.

The idea was initially described in the last part of http://lists.llvm.org/pipermail/cfe-dev/2018-February/056898.html and addresses most of the concerns from https://reviews.llvm.org/D42876.

  rC Clang



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44124.137096.patch
Type: text/x-patch
Size: 10835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180305/4f30f904/attachment.bin>

More information about the cfe-commits mailing list