martong added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1706-1743 + // Check offsets for being out of bounds. // C++20 [expr.add] 7.6.6.4 (excerpt): // If P points to an array element i of an array object x with n // elements, where i < 0 or i > n, the behavior is undefined. // Dereferencing is not allowed on the "one past the last // element", when i == n. // Example: ---------------- ASDenysPetrov wrote: > martong wrote: > > Perhaps this hunk could be in an individual implementation function? > There are two //returns// inside the loop. That would not such easy to do a > separate function for this. > There are two //returns// inside the loop. That would not such easy to do a > separate function for this. I think you could return with an `Optional<SVal>` and then in the call site you could check if the optional is set. `Optional<SVal> areOffsetsOutOfBounds(...)` ? Then in the caller: ``` if (Optional<SVal> CheckResult = areOffsetsOutOfBounds(...)) return *CheckResult; ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111654/new/ https://reviews.llvm.org/D111654 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits