[CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 28 Jun 2018 00:04:54 +0000 (00:04 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 28 Jun 2018 00:04:54 +0000 (00:04 +0000)
commitff267df0de9664fa9af06987d455ae5f02425c3f
treed7ca32950960fee9964aa476bbe3d622323074b9
parent5bf1ead3771667bc51d7b6b2ddc29cb860b4fe21
[CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.

Before C++17 copy elision was optional, even if the elidable copy/move
constructor had arbitrary side effects. The elidable constructor is present
in the AST, but marked as elidable.

In these cases CFG now contains additional information that allows its clients
to figure out if a temporary object is only being constructed so that to pass
it to an elidable constructor. If so, it includes a reference to the elidable
constructor's construction context, so that the client could elide the
elidable constructor and construct the object directly at its final destination.

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

llvm-svn: 335795
14 files changed:
clang/include/clang/Analysis/AnalysisDeclContext.h
clang/include/clang/Analysis/CFG.h
clang/include/clang/Analysis/ConstructionContext.h
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/lib/Analysis/AnalysisDeclContext.cpp
clang/lib/Analysis/CFG.cpp
clang/lib/Analysis/ConstructionContext.cpp
clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp
clang/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/analyzer-config.cpp
clang/test/Analysis/cfg-rich-constructors.cpp
clang/test/Analysis/temp-obj-dtors-cfg-output.cpp