diff options
author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-08-18 18:20:43 +0000 |
---|---|---|
committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-08-18 18:20:43 +0000 |
commit | 3acb7796545327967a7f4762cc0412f0d2f11d09 (patch) | |
tree | 400543e1120d53c54cc456dd4d1e381700f197f2 /include/clang/Frontend/CodeGenOptions.def | |
parent | 028c7cdb0555d559b6c64b18d23b7939aa18a9c0 (diff) |
[analyzer] Fix modeling of constructors
This diff fixes analyzer's crash (triggered assert) on the newly added test case.
The assert being discussed is assert(!B.lookup(R, BindingKey::Direct))
in lib/StaticAnalyzer/Core/RegionStore.cpp, however the root cause is different.
For classes with empty bases the offsets might be tricky.
For example, let's assume we have
struct S: NonEmptyBase, EmptyBase {
...
};
In this case Clang applies empty base class optimization and
the offset of EmptyBase will be 0, it can be verified via
clang -cc1 -x c++ -v -fdump-record-layouts main.cpp -emit-llvm -o /dev/null.
When the analyzer tries to perform zero initialization of EmptyBase
it will hit the assert because that region
has already been "written" by the constructor of NonEmptyBase.
Test plan:
make check-all
Differential revision: https://reviews.llvm.org/D36851
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/CodeGenOptions.def')
0 files changed, 0 insertions, 0 deletions