[PATCH] D62893: [Analyzer] Iterator Checkers - Make range errors and invalidated access fatal

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 5 02:15:18 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.

Range errors (dereferencing or incrementing the past-the-end iterator or decrementing the iterator of the first element of the range) and access of invalidated iterators lead to undefined behavior. There is no point to continue the analysis after such an error on the same execution path, but terminate it by a sink node (fatal error). This also improves the performance and helps avoiding double reports (e.g. in case of nested iterators).


Repository:
  rC Clang

https://reviews.llvm.org/D62893

Files:
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
  test/Analysis/Inputs/system-header-simulator-cxx.h
  test/Analysis/diagnostics/explicit-suppression.cpp
  test/Analysis/invalidated-iterator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62893.203105.patch
Type: text/x-patch
Size: 29137 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190605/5060f99e/attachment-0001.bin>


More information about the cfe-commits mailing list