[PATCH] D86873: [analyzer][NFC] Refactor ArrayBoundCheckerV2

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 01:48:38 PDT 2020


martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:52
+  ///   Offset: SymIntExpr{conj{n, int}, +, 12, long long}
+  class RawOffsetCalculator final
+      : public MemRegionVisitor<RawOffsetCalculator, RegionRawOffsetV2> {
----------------
Since you are already deep in refactoring. This calculation together with the enclosing class seems to be useful for other Checkers too. Would make sense to put this to `CheckerHelpers`?
E.g. the PlacementNewChecker could have benefited from this class if it had been available for use during the implementation of the checker.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp:298
+  //
+  // The algorithm we are using here for bounds checking is to see if the
+  // memory access is within the extent of the base region.  Since we
----------------
What is the exact difference in between this algorithm and `assumeInBound`? What are the benefits (and disadvantages)  of using each of them?

And oh wait, there's more: `assumeInclusiveRange`. Is that also related? (StdLibraryFunctionsChecker uses that for range assumptions.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86873/new/

https://reviews.llvm.org/D86873



More information about the cfe-commits mailing list