[cfe-dev] Symbolic Extents

Jordy Rose jediknil at belkadan.com
Wed Jun 30 17:47:19 PDT 2010


New version, with SymbolExtent! New API:

- SymbolExtent *SymbolManager::getExtentSymbol(const MemRegion *MR)
- virtual SVal MemRegion::getExtent(ValueManager &ValMgr). This uses a
ValueManager rather than just a SymbolManager because some types return
plain integer values.
- virtual const llvm::APSInt *SValuator::getKnownValue(SVal V). This can
be used in more places, such as GRState::isEqual, but I'll save that for a
separate commit.

Extent values are size_ts, since that's how they come in.
RegionStore::getSizeInElements() still returns a signed value, but any code
that eventually compares an extent to an index should use
ValueManager::convertToArrayIndex() on the extent first.

I also pushed static bounds checking up to DeclRegion, rather than just
VarRegion. This catches overflows in FieldRegions as well (with a case to
handle the zero-length array idiom).

I wasn't sure how to implement the liveness tracking for SymbolExtent. We
can't just say "SR.markLive(R->getExtent().getAsSymbol())" since that will
create the extent symbol if it doesn't already exist. Any ideas?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbolic-extents.patch
Type: text/x-diff
Size: 17575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100630/6f0dfa54/attachment.patch>


More information about the cfe-dev mailing list