[analyzer] When invalidating symbolic offset regions, take fields into account.
authorJordan Rose <jordan_rose@apple.com>
Sat, 10 Nov 2012 01:40:08 +0000 (01:40 +0000)
committerJordan Rose <jordan_rose@apple.com>
Sat, 10 Nov 2012 01:40:08 +0000 (01:40 +0000)
commit9eb409ace9952626d4be15753616ec5acf7b3396
tree2d4fccf21fefb8b3d066f7a1a5d46b1d48c534b1
parent43df4cc568f4b66cc226d8a301cecf27f76a288c
[analyzer] When invalidating symbolic offset regions, take fields into account.

Previously, RegionStore was being VERY conservative in saying that because
p[i].x and p[i].y have a concrete base region of 'p', they might overlap.
Now, we check the chain of fields back up to the base object and check if
they match.

This only kicks in when dealing with symbolic offset regions because
RegionStore's "base+offset" representation of concrete offset regions loses
all information about fields. In cases where all offsets are concrete
(s.x and s.y), RegionStore will already do the right thing, but mixing
concrete and symbolic offsets can cause bindings to be invalidated that
are known to not overlap (e.g. p[0].x and p[i].y).
This additional refinement is tracked by <rdar://problem/12676180>.

<rdar://problem/12530149>

llvm-svn: 167654
clang/lib/StaticAnalyzer/Core/RegionStore.cpp
clang/test/Analysis/array-struct-region.c