HomePhabricator

[CFG] [analyzer] Add C++17-specific variable and return construction contexts.

Authored by dergachev.a on Mar 22 2018, 2:37 PM.

Description

[CFG] [analyzer] Add C++17-specific variable and return construction contexts.

In C++17 copy elision is mandatory for variable and return value constructors
(as long as it doesn't involve type conversion) which results in AST that does
not contain elidable constructors in their usual places. In order to provide
construction contexts in this scenario we need to cover more AST patterns.

This patch makes the CFG prepared for these scenarios by:

  • Fork VariableConstructionContext and ReturnedValueConstructionContext into two different sub-classes (each) one of which indicates the C++17 case and contains a reference to an extra CXXBindTemporaryExpr.
  • Allow CFGCXXRecordTypedCall element to accept VariableConstructionContext and ReturnedValueConstructionContext as its context.

Differential Revision: https://reviews.llvm.org/D44597

llvm-svn: 328248