track more information about temporary variables

This commit is contained in:
Vern Paxson 2021-02-27 11:08:34 -08:00
parent 64ef7f0eb2
commit b581c6435e
2 changed files with 45 additions and 1 deletions

View file

@ -11,7 +11,31 @@ TempVar::TempVar(int num, const TypePtr& t, ExprPtr _rhs) : type(t)
char buf[8192];
snprintf(buf, sizeof buf, "#%d", num);
name = buf;
id = nullptr;
rhs = _rhs;
}
void TempVar::SetAlias(IDPtr _alias, const DefPoints* _dps)
{
if ( alias )
reporter->InternalError("Re-aliasing a temporary");
if ( ! _dps )
{
printf("trying to alias %s to %s\n", name.c_str(), _alias->Name());
reporter->InternalError("Empty dps for alias");
}
if ( alias == id )
reporter->InternalError("Creating alias loop");
alias = _alias;
dps = _dps;
}
void TempVar::SetDPs(const DefPoints* _dps)
{
ASSERT(_dps->length() == 1);
dps = _dps;
}
} // zeek::detail