[PATCH] D76361: [Analyzer] Iterator Modeling - Model `std::advance()`, `std::prev()` and `std::next()`

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 18 07:02:51 PDT 2020


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: ASDenysPetrov, martong, steakhal, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.
baloghadamsoftware added a comment.

Partially replacing D62895 <https://reviews.llvm.org/D62895>.


Whenever the analyzer budget runs out just at the point where `std::advance()`, `std::prev()` or `std::next()` is invoked the function are not inlined. This results in strange behavior such as `std::prev(v.end())` equals `v.end()`. To prevent this model these functions if they were not inlined. It may also happend that although `std::advance()` is inlined but a function it calls inside (e.g. `__advance()` in some implementations) is not. This case is also handled in this patch.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76361

Files:
  clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
  clang/test/Analysis/Inputs/system-header-simulator-cxx.h
  clang/test/Analysis/iterator-modelling.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76361.251066.patch
Type: text/x-patch
Size: 11509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200318/2e72acfa/attachment.bin>


More information about the cfe-commits mailing list