analyzer: validate region subclasses
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 20 Feb 2020 13:44:23 +0000 (08:44 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 4 Mar 2020 21:58:34 +0000 (16:58 -0500)
commit3c1645a379e405c7ce33060846fa424373b1f5f4
treed15cebb76591ee00442da33d42fd40dfe18d3712
parent4ac3eb5c5f157bea22b5ae34b0df254d729dac25
analyzer: validate region subclasses

This patch converts region::validate to a vfunc, implementing
additional checking per subclass: verifying that various
region_id fields within map_region, array_region, stack_region and
root_region are valid, rather than just those within the base class.

Doing so caught bugs earlier in follow-up work I have on
canonicalization and purging of region_model.

gcc/analyzer/ChangeLog:
* region-model.cc (region::validate): Convert model param from ptr
to reference.  Update comment to reflect that it's now a vfunc.
(map_region::validate): New vfunc implementation.
(array_region::validate): New vfunc implementation.
(stack_region::validate): New vfunc implementation.
(root_region::validate): New vfunc implementation.
(region_model::validate): Pass a reference rather than a pointer
to the region::validate vfunc.
* region-model.h (region::validate): Make virtual.  Convert model
param from ptr to reference.
(map_region::validate): New vfunc decl.
(array_region::validate): New vfunc decl.
(stack_region::validate): New vfunc decl.
(root_region::validate): New vfunc decl.
gcc/analyzer/ChangeLog
gcc/analyzer/region-model.cc
gcc/analyzer/region-model.h