[Analyzer] Model STL Algoirthms to improve the iterator checkers
authorAdam Balogh <adam.balogh@ericsson.com>
Wed, 20 Nov 2019 08:15:42 +0000 (09:15 +0100)
committerAdam Balogh <adam.balogh@ericsson.com>
Wed, 5 Feb 2020 16:59:08 +0000 (17:59 +0100)
commitb198f16e1e1c8ee849008c1b886199eae5bc2e01
tree6a7ad4478a7acee45e85a07b1921fdb32de4af80
parent307e0d5490a5f2a069a00e4273784d1a2e005ab9
[Analyzer] Model STL Algoirthms to improve the iterator checkers

STL Algorithms are usually implemented in a tricky for performance
reasons which is too complicated for the analyzer. Furthermore inlining
them is costly. Instead of inlining we should model their behavior
according to the specifications.

This patch is the first step towards STL Algorithm modeling. It models
all the `find()`-like functions in a simple way: the result is either
found or not. In the future it can be extended to only return success if
container modeling is also extended in a way the it keeps track of
trivial insertions and deletions.

Differential Revision: https://reviews.llvm.org/D70818
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
clang/lib/StaticAnalyzer/Checkers/Iterator.h
clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp [new file with mode: 0644]
clang/test/Analysis/Inputs/system-header-simulator-cxx.h
clang/test/Analysis/analyzer-config.c
clang/test/Analysis/stl-algorithm-modeling-aggressive-std-find-modeling.cpp [new file with mode: 0644]
clang/test/Analysis/stl-algorithm-modeling.cpp [new file with mode: 0644]