This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by NoQ on Feb 19 2018, 1:24 PM.

Details

Summary

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

Like 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.

Diff Detail