]> granicus.if.org Git - clang/commit
[analyzer] Compute the correct this-region for temporary destructors.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 15 Feb 2018 19:17:44 +0000 (19:17 +0000)
commitf337a760516c29af3e3701260bb2b79cade1534d
tree2b7d9a4a8cc53ee9d98729053b26aeef1123c5e0
parent05e0241bc830fd7fd5600f798176982757b4ae3b
[analyzer] Compute the correct this-region for temporary destructors.

Inline them if possible - a separate flag is added to control this.
The whole thing is under the cfg-temporary-dtors flag, off by default so far.

Temporary destructors are called at the end of full-expression. If the
temporary is lifetime-extended, automatic destructors kick in instead,
which are not addressed in this patch, and normally already work well
modulo the overally broken support for lifetime extension.

The patch operates by attaching the this-region to the CXXBindTemporaryExpr in
the program state, and then recalling it during destruction that was triggered
by that CXXBindTemporaryExpr. It has become possible because
CXXBindTemporaryExpr is part of the construction context since r325210.

Differential revision: https://reviews.llvm.org/D43104

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325282 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Core/CallEvent.cpp
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/analyzer-config.cpp
test/Analysis/temp-obj-dtors-option.cpp [new file with mode: 0644]
test/Analysis/temporaries.cpp