]> granicus.if.org Git - clang/commit
[analyzer] Inline constructors for destroyable temporaries.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 15 Feb 2018 03:26:43 +0000 (03:26 +0000)
commit7d59ecf0b3b24d8be4abd914227fcea643f4cb3d
treea6524c6530b2206b78db46110d27a4c54dfead30
parentd9839346b97a232b56335f681bf507bbc7d39e33
[analyzer] Inline constructors for destroyable temporaries.

Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us
that we're indeed constructing a temporary, so we can trivially construct a
temporary region and inline the constructor.

Much like r325202, this is only done under the off-by-default
cfg-temporary-dtors flag because the temporary destructor, even if available,
will not be inlined and won't have the correct object value (target region).
Unless this is fixed, it is quite unsafe to inline the constructor.

If the temporary is lifetime-extended, the destructor would be an automatic
destructor, which would be evaluated with a "correct" target region - modulo
the series of incorrect relocations performed during the lifetime extension.
It means that at least, values within the object are guaranteed to be properly
escaped or invalidated.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325211 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
test/Analysis/temporaries.cpp