steakhal accepted this revision. steakhal added a comment. Looks good. Thank you.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp:420-421 + // We should also allow defensive initialization of structs. + if (const auto *ILE = + dyn_cast<InitListExpr>(E->IgnoreParenCasts())) { + // We can use exactly the same logic here. ---------------- vsavchenko wrote: > NoQ wrote: > > vsavchenko wrote: > > > martong wrote: > > > > What about nested InitListExpr's? > > > > ``` > > > > std::array<int, 3> a1{ {1, 2, 3} }; > > > > ``` > > > > > > > > ``` > > > > VarDecl 0x561b200333a0 </home/egbomrt/tmp/aaa.cc:2:1, col:34> col:20 a1 > > > > 'std::array<int, 3>':'std::array<int, 3>' listinit > > > > `-InitListExpr 0x561b20036d78 <col:22, col:34> 'std::array<int, > > > > 3>':'std::array<int, 3>' > > > > `-InitListExpr 0x561b20036dc0 <col:24, col:32> 'typename > > > > _AT_Type::_Type':'int [3]' > > > > |-IntegerLiteral 0x561b20033408 <col:25> 'int' 1 > > > > |-IntegerLiteral 0x561b20033428 <col:28> 'int' 2 > > > > `-IntegerLiteral 0x561b20033448 <col:31> 'int' 3 > > > > ``` > > > I'm not sure that we'll report anything on that > > We probably won't because it's a C++ object, even though it's an aggregate > > so we should probably warn(?) What about a plain C object like > > ```lang=c++ > > int x[2][2] = { { 0, 0 }, { 0, 0 } }; > > ``` > > ? > The same here, we still don't warn about stores like this, but I think I can > add test with nested structs Should we add a C++ test case as well? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99262/new/ https://reviews.llvm.org/D99262 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits