[all-commits] [llvm/llvm-project] 9a08a3: [Analyzer] Split container modeling from iterator ...

Balogh, Ádám via All-commits all-commits at lists.llvm.org
Wed Jan 29 07:07:41 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a08a3fab9993f9b93167de5c783dfed6dd7efc0
      https://github.com/llvm/llvm-project/commit/9a08a3fab9993f9b93167de5c783dfed6dd7efc0
  Author: Adam Balogh <adam.balogh at ericsson.com>
  Date:   2020-01-29 (Wed, 29 Jan 2020)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
    M clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
    A clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
    A clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
    M clang/lib/StaticAnalyzer/Checkers/Iterator.h
    M clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
    A clang/test/Analysis/container-modeling.cpp
    A clang/test/Analysis/debug-container-modeling.cpp
    M clang/test/Analysis/debug-iterator-modeling.cpp
    M clang/test/Analysis/iterator-modelling.cpp

  Log Message:
  -----------
  [Analyzer] Split container modeling from iterator modeling

Iterator modeling depends on container modeling,
but not vice versa. This enables the possibility
to arrange these two modeling checkers into
separate layers.

There are several advantages for doing this: the
first one is that this way we can keep the
respective modeling checkers moderately simple
and small. Furthermore, this enables creation of
checkers on container operations which only
depend on the container modeling. Thus iterator
modeling can be disabled together with the
iterator checkers if they are not needed.

Since many container operations also affect
iterators, container modeling also uses the
iterator library: it creates iterator positions
upon calling the `begin()` or `end()` method of
a containter (but propagation of the abstract
position is left to the iterator modeling),
shifts or invalidates iterators according to the
rules upon calling a container modifier and
rebinds the iterator to a new container upon
`std::move()`.

Iterator modeling propagates the abstract
iterator position, handles the relations between
iterator positions and models iterator
operations such as increments and decrements.

Differential Revision: https://reviews.llvm.org/D73547




More information about the All-commits mailing list