[analyzer] Fix trivial copy for empty objects.
authorArtem Dergachev <artem.dergachev@gmail.com>
Tue, 27 Feb 2018 21:10:08 +0000 (21:10 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Tue, 27 Feb 2018 21:10:08 +0000 (21:10 +0000)
commit4449e7f008cbb6da6dbe8a93fdf4cfd89851f7b1
treed58380501c5ce67ea2ee090718898425ed3faa07
parent1e3dbd7a17b3cfbda5a0b83812020122a82a9e0e
[analyzer] Fix trivial copy for empty objects.

The SVal for any empty C++ object is an UnknownVal. Because RegionStore does
not have binding extents, binding an empty object to an UnknownVal may
potentially overwrite existing bindings at the same offset.

Therefore, when performing a trivial copy of an empty object, don't try to
take the value of the object and bind it to the copy. Doing nothing is accurate
enough, and it doesn't screw any existing bindings.

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

llvm-svn: 326247
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/test/Analysis/ctor.mm