[PATCH] D26839: [analyzer] An attempt to fix pr19539 - crashes on temporaries life-extended via members

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 23:29:36 PST 2016


NoQ created this revision.
NoQ added reviewers: zaks.anna, dcoughlin, xazax.hun, a.sidorin.
NoQ added subscribers: nandor, cfe-commits.

1. Re-use approach used in codegen. `MaterializeTemporaryExpr` may be positioned in a strange manner, above the member access to the temporary, which makes it a bit tricky to find the expression that actually corresponds to the temporary object. FIXME: Hmm, probably we should re-use this approach in CFG as well (cf. https://reviews.llvm.org/D22419).
2. Create the temporary region that corresponds to the full temporary object, rather than to the sub-object. This was a bug.
3. If lifetime extension occurs, use the temporary object region's path-sensitive type, rather than reference variable type, in order to call the correct destructor.


https://reviews.llvm.org/D26839

Files:
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/Analysis/lifetime-extension.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26839.78476.patch
Type: text/x-patch
Size: 5374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161118/f0906a3f/attachment.bin>


More information about the cfe-commits mailing list