Spicy
optimizer.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <memory>
6 #include <utility>
7 #include <vector>
8 
9 #include <hilti/ast/id.h>
10 #include <hilti/compiler/unit.h>
11 
12 namespace hilti {
13 
14 struct Optimizer {
15 public:
16  Optimizer(const std::vector<std::shared_ptr<Unit>>& units, const std::shared_ptr<Context> ctx)
17  : _units(units), _ctx(std::move(ctx)) {}
18  ~Optimizer() {}
19 
20  void run();
21 
22  auto context() const { return _ctx.lock(); }
23 
24 private:
25  const std::vector<std::shared_ptr<Unit>>& _units;
26  std::weak_ptr<Context> _ctx;
27 };
28 
29 } // namespace hilti
Definition: optimizer.h:14