[analyzer] Make symbol_iterator iterate over SVal's symbolic base.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Mar 2018 21:30:58 +0000 (21:30 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 22 Mar 2018 21:30:58 +0000 (21:30 +0000)
commitd2e77472d1a3c5637c0056eaf2466e3512dc08ec
tree42235beb0eacb9b048a51fd6c0e91328ffdcb155
parentd96de6f6ae28a8a6652c32f055f50c5e2c59a1aa
[analyzer] Make symbol_iterator iterate over SVal's symbolic base.

If a memory region (or an SVal that represents a pointer to that memory region)
is a (direct or indirect, not necessarily proper) sub-region of a SymbolicRegion
then it is said to have a symbolic base.

For now SVal::symbol_iterator explores the symbol within a symbolic region
only when the SVal represents a pointer to the symbolic region itself,
not to any of its sub-regions.

This behavior is not indended by any user of symbol_iterator; all users who
cared about such behavior were expecting the iterator to descend into the
symbolic base of an arbitrary region, find the parent symbol of the symbolic
base region, and iterate over that symbol. Lack of such behavior resulted in
bugs demonstarted by the test cases.

Hence the decision to change the API to behave more intuitively.

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

llvm-svn: 328247
clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
clang/test/Analysis/symbol-reaper.c