[PATCH] D43480: [CFG] [analyzer] Add construction context when the constructor is treated like a functional cast.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 13:25:07 PST 2018


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

When a constructor with a single argument is treated as a functional cast expression, skip the functional cast while finding the construction context.

Like https://reviews.llvm.org/D43477, this patch only adds new construction contexts in cases where there is no destructor, which therefore has no immediate effect on the analyzer. It allows us to find the `MaterializeTemporaryExpr` in some extra cases, such as the newly added test with `D &&d = D(1)`, which would help us with lifetime extension. But in case of lifetime extension through a normal lvalue reference, we'd also have to unwrap the no-op cast to `const`-object as well, which is something i'd follow up with.


Repository:
  rC Clang

https://reviews.llvm.org/D43480

Files:
  lib/Analysis/CFG.cpp
  test/Analysis/cfg-rich-constructors.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43480.134964.patch
Type: text/x-patch
Size: 5045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180219/e2ddb98d/attachment.bin>


More information about the cfe-commits mailing list