[analyzer] Bind return value for assigment and copies of trivial empty classes
authorTomasz Kamiński <tomasz.kamiński@sonarsource.com>
Tue, 18 Jul 2023 06:24:17 +0000 (08:24 +0200)
committerTomasz Kamiński <tomasz.kamiński@sonarsource.com>
Tue, 18 Jul 2023 06:31:38 +0000 (08:31 +0200)
commit61760bb98c4694651261b2e10df3fa6f669098ed
tree103b93aa0eb7a295b91924a6d21ec7b950fec023
parentef7d53731bba8c4131f519d7a4dd8cd774cfe539
[analyzer] Bind return value for assigment and copies of trivial empty classes

We now properly bind return value of the trivial copy constructor
and assignments of the empty objects. Such operations do not
perform any loads from the source, however they preserve identity
of the assigned object:
```
Empty e;
auto& x = (e = Empty());
clang_analyzer_dump(x); // &e, was Unknown
```

Reviewed By: xazax.hun

Differential Revision: https://reviews.llvm.org/D155442
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/test/Analysis/ctor-trivial-copy.cpp [new file with mode: 0644]