mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 11:08:20 +00:00
reworked AST optimizers analysis of side effects during aggregate operations & calls
This commit is contained in:
parent
c028901146
commit
740a087765
13 changed files with 1119 additions and 223 deletions
|
@ -7,11 +7,32 @@
|
|||
|
||||
namespace zeek::detail {
|
||||
|
||||
// Class for tracking whether a given expression has side effects. Currently,
|
||||
// we just need to know whether Yes-it-does or No-it-doesn't, so the structure
|
||||
// is very simple.
|
||||
|
||||
class ExprSideEffects {
|
||||
public:
|
||||
ExprSideEffects(bool _has_side_effects) : has_side_effects(_has_side_effects) {}
|
||||
|
||||
bool HasSideEffects() const { return has_side_effects; }
|
||||
|
||||
protected:
|
||||
bool has_side_effects;
|
||||
};
|
||||
|
||||
class ExprOptInfo {
|
||||
public:
|
||||
// The AST number of the statement in which this expression
|
||||
// appears.
|
||||
int stmt_num = -1; // -1 = not assigned yet
|
||||
|
||||
auto& SideEffects() { return side_effects; }
|
||||
|
||||
protected:
|
||||
// This optional value missing means "we haven't yet determined the
|
||||
// side effects".
|
||||
std::optional<ExprSideEffects> side_effects;
|
||||
};
|
||||
|
||||
} // namespace zeek::detail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue