diff options
Diffstat (limited to 'flowgraph/node.cpp')
-rw-r--r-- | flowgraph/node.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp index e0912dc..2d757f9 100644 --- a/flowgraph/node.cpp +++ b/flowgraph/node.cpp @@ -4,6 +4,8 @@ #include <boost/endian/conversion.hpp> +#include <memory> + using namespace FlowGraph; FlowGraph::Data& Node::destination() @@ -19,22 +21,28 @@ Data FlowGraph::MakeConstantInt(int i) { std::vector<uint8_t> value(size_t(4), uint8_t(0)); *(reinterpret_cast<int32_t*>(value.data())) = boost::endian::native_to_little(static_cast<int32_t>(i)); - return Data(DataType::Int, std::make_shared<Constant>(value)); + return Data{DataType::Int, std::make_shared<Constant>(value)}; } Data FlowGraph::MakeLocalPointer(FlowGraph::LocalScope& scope, const std::string& name) { - return Data(DataType::Pointer, std::make_shared<LocalStorage>(scope, name)); + Data data{DataType::Pointer, std::make_shared<LocalStorage>(scope, name)}; + scope.push_back(std::make_shared<Data>(data)); + return data; } Data FlowGraph::MakeLocalSize(FlowGraph::LocalScope& scope, const std::string& name) { - return Data(DataType::Size, std::make_shared<LocalStorage>(scope, name)); + Data data{DataType::Size, std::make_shared<LocalStorage>(scope, name)}; + scope.push_back(std::make_shared<Data>(data)); + return data; } Data FlowGraph::MakeTemporaryInt(FlowGraph::LocalScope& scope) { - return Data(DataType::Int, std::make_shared<TemporaryStorage>(scope)); + Data data{DataType::Int, std::make_shared<TemporaryStorage>(scope)}; + scope.push_back(std::make_shared<Data>(data)); + return data; } LocalScope& CreateScopeOp::scope() |