]> granicus.if.org Git - clang/commit
[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)
commitf5fb3f3b81b10888ec0f219628d3df3f7782c65b
tree67dce127febcd1ef2666c4518c757134a1cbc292
parent3cbd1a48a081e370855d09357298eb8210d29294
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335795 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/clang/Analysis/AnalysisDeclContext.h
include/clang/Analysis/CFG.h
include/clang/Analysis/ConstructionContext.h
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
lib/Analysis/AnalysisDeclContext.cpp
lib/Analysis/CFG.cpp
lib/Analysis/ConstructionContext.cpp
lib/StaticAnalyzer/Core/AnalysisManager.cpp
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
test/Analysis/analyzer-config.c
test/Analysis/analyzer-config.cpp
test/Analysis/cfg-rich-constructors.cpp
test/Analysis/temp-obj-dtors-cfg-output.cpp