[PATCH] D43477: [CFG] [analyzer] Add MaterializeTemporaryExpr into the construction context.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 11:57:59 PST 2018


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

`MaterializeTemporaryExpr` captures lifetime extension information. In the analyzer it is important to have this information at construction site because we would be dealing only with rvalue expressions for quite a while, but in order to perform lifetime extension later, we need to put extra effort into keeping the lvalue around.

`MaterializeTemporaryExpr` is added either as a trigger statement if there's no `CXXBindTemporaryExpr` within it (eg. `const C &c(123);` or the actual (not the elidable copy) constructor in `C foo() { return C(123); }`), or as a parent construction context if there already is a `CXXBindTemporary`. In the latter case, it is included in the dump and tested accordingly. I understand that this is quite counter-intuitive at the moment (easy to construct, hard to use) and i'd make super sure that `ConstructionContext` is refactored later to become easy to understand and work with - separation of different "kinds" of construction contexts and fancy kind-specific helper methods are absolutely necessary. But for now i'm focused on getting it to work.


Repository:
  rC Clang

https://reviews.llvm.org/D43477

Files:
  include/clang/Analysis/CFG.h
  lib/Analysis/CFG.cpp
  test/Analysis/cfg-rich-constructors.cpp
  test/Analysis/temp-obj-dtors-cfg-output.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43477.134957.patch
Type: text/x-patch
Size: 7799 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180219/8f8f5598/attachment-0001.bin>


More information about the cfe-commits mailing list