isuckatcs added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1787 + if (V && + (!targetType->isStructureOrClassType() && !targetType->isUnionType())) return *V; ---------------- I assume `targetType` is the type we want to interpret the region as. Below this condition we seem to work with arrays. If `targetType` is an array, then we return something here instead of going further and returning something else we probably want. Why aren't we going further in that case? ================ Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1869 + // if we are here we have struct or union? + if (!VarT->isStructureType()) { + // TODO: support other options like unions or arrays or VLAs ---------------- What about classes? ``` class A { public: int x; }; struct B { int x; } ``` `A` and `B` are technically the same, but `A` will fall into the true branch, `B` will fall into the false branch. ================ Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1891 + ElemExpr = IL->getInit(Idx); + std::optional<SVal> ConstVal = svalBuilder.getConstantVal(ElemExpr); + // if there is no value create a zero one ---------------- This crashes if `ElemExpr` is a `nullptr`. ================ Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1914 + } + RecIter++; + continue; ---------------- Consider moving this into the for loop to avoid confusion. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D144977/new/ https://reviews.llvm.org/D144977 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits