[cfe-dev] Symbolic Extents
Jordy Rose
jediknil at belkadan.com
Wed Jun 30 23:00:07 PDT 2010
On Wed, 30 Jun 2010 21:11:26 -0700, Ted Kremenek <kremenek at apple.com>
wrote:
> On Jun 30, 2010, at 5:47 PM, Jordy Rose wrote:
>> 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?<symbolic-extents.patch>
>
> Great work Jordy. In response to your last point, instead of explicitly
> marking extent symbols live, how about we just define them as live if
the
> corresponding region is live? That is, put the smarts in
> SymbolManager::isLive(), and don't even bother marking them as live.
<snip>
> See my comment above. We can define a SymbolExtent as live if the
region
> is live. This involves changing:
>
> bool SymbolReaper::isLive(SymbolRef sym) {
>
> to:
>
> bool SymbolReaper::isLive(const Stmt* Loc, SymbolRef sym) {
>
> and then querying the region of SymbolExtent:
>
> if (const SymbolExtent *extent = dyn_cast<SymbolExtent>(sym)) {
> const SubRegion *R = extent->getRegion();
> while (R) {
> if (const VarRegion *VR = dyn_cast<VarRegion>(R))
> return isLive(Loc, VR);
> if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(R))
> return isLive(SR->getSymbol());
> R = dyn_cast<SubRegion>(R->getSuperRegion());
> }
> return false;
> }
Can we make the current statement a SymbolReaper ivar? We're already
creating one per statement in GRExprEngine, and we pass the statement
around to most -- but not quite all -- of the dead-symbol-clearing code, so
it's not much functional difference. And it would let us take /out/ the Loc
parameter from the other isLive() methods.
More information about the cfe-dev
mailing list