zaks.anna added a comment.
The analyzer has a notion of ConstPointerEscape, see checkConstPointerEscape
callback.
All the pointers to const parameters are escaped this way. The implementation
for that is in CallEvent::invalidateRegions, right below the code you've added:
for (unsigned Idx = 0, Count = getNumArgs(); Idx != Count; ++Idx) {
// Mark this region for invalidation. We batch invalidate regions
// below for efficiency.
if (PreserveArgs.count(Idx))
if (const MemRegion *MR = getArgSVal(Idx).getAsRegion())
ETraits.setTrait(MR->StripCasts(),
RegionAndSymbolInvalidationTraits::TK_PreserveContents);
// TODO: Factor this out + handle the lower level const pointers.
ValuesToInvalidate.push_back(getArgSVal(Idx));
}
I think we should const escape all non-mutable fields as well as 'this'.
(A motivation behind this callback is that one can call delete on pointers of
const *void type.)
http://reviews.llvm.org/D13099
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits