]> granicus.if.org Git - clang/commit
[CFG] [analyzer] Add C++17-specific variable and return construction contexts.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Mar 2018 21:37:39 +0000 (21:37 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Mar 2018 21:37:39 +0000 (21:37 +0000)
commit8f8f301be5170458cbafb136a4d483aa52b3d4a8
tree9f3f4c1d9035901d11c3955d0523aef9b09477d9
parent8dec9f5f26c98b318db49ed51450c9ea98461b77
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328248 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/CFG.h
include/clang/Analysis/ConstructionContext.h
lib/Analysis/CFG.cpp
lib/Analysis/ConstructionContext.cpp
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
test/Analysis/cfg-rich-constructors.cpp