[PATCH] D76379: [Analyzer] IteratorRangeChecker verify `std::advance()`, `std::prev()` and `std::next()`

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 16:54:07 PDT 2020


NoQ added a comment.

In D76379#1930917 <https://reviews.llvm.org/D76379#1930917>, @baloghadamsoftware wrote:

> In D76379#1929698 <https://reviews.llvm.org/D76379#1929698>, @Szelethus wrote:
>
> > The patch looks great, though I'd kindly ask you to wait a bit for someone with a bit more experience on `SVal`-smithing ;)
>
>
> Do you mean the change from `const SVal &` to `SVal`? It was done according to this comment <https://reviews.llvm.org/D73720#inline-671284>.


I think @Szelethus means my inline comment.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorRangeChecker.cpp:131
+            C, Call.getArgSVal(0),
+            nonloc::ConcreteInt(BVF.getValue(llvm::APSInt::get(1))));
+      }
----------------
Please think about the type of the integer. You most likely want `SValBuilder::makeArrayIndex()`. There's also `SValBuilder::makeIntVal()` with a bunch of handy overloads. You almost never need to access `BasicValueFactory` directly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76379





More information about the cfe-commits mailing list