]> granicus.if.org Git - clang/commit
[analyzer] Fix a crash on lifetime extension through aggregate initialization.
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 25 Apr 2018 23:02:06 +0000 (23:02 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 25 Apr 2018 23:02:06 +0000 (23:02 +0000)
commit58aba33e0faf376c36a5e72e066bdf03335f5bba
treef68ddd166662b6125fdea7b55af4396f91d39ce0
parentf17cabfc9b9cd8acd9ed475eea3d1a21dfc7b66e
[analyzer] Fix a crash on lifetime extension through aggregate initialization.

If 'A' is a C++ aggregate with a reference field of type 'C', in code like
  A a = { C() };
C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
crashing. Additionally, destructors aren't added in the CFG for this case,
so for now we shouldn't be inlining the constructor for C().

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330882 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/lifetime-extension.cpp