[PATCH] D62895: [Analyzer] Iterator Checkers - Check and simulate `std::advance`, `std::prev` and `std::next`

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 02:31:07 PDT 2019


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, Szelethus.
baloghadamsoftware added a project: clang.
Herald added subscribers: Charusso, gamesh411, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, xazax.hun, whisperity.
baloghadamsoftware added a parent revision: D62893: [Analyzer] Iterator Checkers - Make range errors and invalidated access fatal.

In case of invoking `std::advance`, `std::prev` and `std::next` range errors should be reported in the invoker and not inside the STL implementation code. Another problem is if the analyzer budget runs out just at the point these functions are invoked. This results in strange behavior such as `std::prev(v.end())` equals `v.end()`. To prevent this simulate these functions if they were not inlined.


Repository:
  rC Clang

https://reviews.llvm.org/D62895

Files:
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/iterator-range.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62895.203107.patch
Type: text/x-patch
Size: 5309 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190605/c7779456/attachment.bin>


More information about the cfe-commits mailing list