[analyzer] Special-case bitfields when finding sub-region bindings.
authorJordan Rose <jordan_rose@apple.com>
Fri, 1 Mar 2013 23:03:17 +0000 (23:03 +0000)
committerJordan Rose <jordan_rose@apple.com>
Fri, 1 Mar 2013 23:03:17 +0000 (23:03 +0000)
commite185d73101dc6b1637ee103133cd6b07057661da
tree9c2aa045bb93b3fc0d1edfdee00494d53e2bba6f
parentd49963609d58ceaf85de6ad90170a359258a3a2c
[analyzer] Special-case bitfields when finding sub-region bindings.

Previously we were assuming that we'd never ask for the sub-region bindings
of a bitfield, since a bitfield cannot have subregions. However,
unification of code paths has made that assumption invalid. While we could
take advantage of this by just checking for the single possible binding,
it's probably better to do the right thing, so that if/when we someday
support unions we'll do the right thing there, too.

This fixes a handful of false positives in analyzing LLVM.

<rdar://problem/13325522>

llvm-svn: 176388
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/lib/StaticAnalyzer/Core/RegionStore.cpp
clang/test/Analysis/fields.c