[PATCH] D39803: [analyzer] pr34766: Fix a crash on explicit construction of std::initializer_list.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 8 23:39:05 PST 2017

NoQ added a comment.

In https://reviews.llvm.org/D39803#919945, @george.karpenkov wrote:

> I think I lack context to completely get what is going on here: I assume we don't model the assignment here?

- We model `IntegralLiteral` as `nonloc::ConcreteInt` `12 S32b`.
- We model `InitListExpr` as `nonloc::CompoundVal` `{ 12 S32b }`.
- We model `MaterializeTemporaryExpr` as `loc::MemRegionVal` `&temp_object{const int [1], {12}}` in which `{12 S32b}` is stored, retroactively creating the location in which the list was supposed to be present from the start (TODO: why not `CompoundLiteralRegion`?).
- We //do not// model `CXXStdInitializerListExpr` or internals of `std::initializer_list`, hence the value of this expresssion, conservatively, is `conj_$0{std::initializer_list<int>}`. See also https://reviews.llvm.org/D35216.
- We //now// model `CompoundLiteralExpr` as `conj_$0{std::initializer_list<int>}` as no-op.


More information about the cfe-commits mailing list