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

@ -9,6 +9,7 @@
#include "zeek/ID.h"
#include "zeek/Expr.h"
#include "zeek/script_opt/ReachingDefs.h"
namespace zeek::detail {
@ -25,12 +26,31 @@ public:
void Deactivate() { active = false; }
bool IsActive() const { return active; }
// Associated constant expression, if any.
const ConstExpr* Const() const { return const_expr; }
// The most use of "const" in any single line in the Zeek
// codebase :-P ... though only by one!
void SetConst(const ConstExpr* _const) { const_expr = _const; }
IDPtr Alias() const { return alias; }
const DefPoints* DPs() const { return dps; }
void SetAlias(IDPtr id, const DefPoints* dps);
void SetDPs(const DefPoints* _dps);
const RDPtr& MaxRDs() const { return max_rds; }
void SetMaxRDs(RDPtr rds) { max_rds = rds; }
protected:
std::string name;
IDPtr id;
const TypePtr& type;
ExprPtr rhs;
bool active = true;
const ConstExpr* const_expr = nullptr;
IDPtr alias;
const DefPoints* dps = nullptr;
RDPtr max_rds;
};
} // zeek::detail