summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/scope.h
blob: 3fc0fcc869914685ed7fbb79b6c79761848b5cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include "data.h"

#include "minicc.h"

#include <cstddef>
#include <memory>
#include <vector>

namespace FlowGraph {

 class Storage; ///< Forward declaration

 // Provide a context for local temporaries name generation
 class LocalScope
 {
 public:
  LocalScope();
  ~LocalScope();

  void push_back(std::shared_ptr<Data> data);
  void append(const LocalScope& other);
  index_t indexOfData(const FlowGraph::Data& data) const;

  size_t size() const;

 private:
  std::vector<std::shared_ptr<Data>> m_variables;
 };

}