From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- .../src/callgraph/parent-graph-visitor.hh | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tiger-compiler/src/callgraph/parent-graph-visitor.hh (limited to 'tiger-compiler/src/callgraph/parent-graph-visitor.hh') diff --git a/tiger-compiler/src/callgraph/parent-graph-visitor.hh b/tiger-compiler/src/callgraph/parent-graph-visitor.hh new file mode 100644 index 0000000..be16987 --- /dev/null +++ b/tiger-compiler/src/callgraph/parent-graph-visitor.hh @@ -0,0 +1,36 @@ +/** + ** \file callgraph/parent-graph-visitor.hh + ** \brief Definition of callgraph::ParentGraphVisitor. + **/ +#pragma once + +#include +#include +#include +#include + +namespace callgraph +{ + /// Compute the ParentGraph. + class ParentGraphVisitor + : public ast::DefaultVisitor + , public ast::NonObjectVisitor + , public ast::NonAssertVisitor + { + using super_type = ast::DefaultVisitor; + using super_type::operator(); + + public: + ParentGraph* create(ast::Ast& tree); + + void operator()(ast::FunctionChunk& e) override; + void operator()(ast::FunctionDec& e) override; + + protected: + /// Current function. + ast::FunctionDec* parent = nullptr; + /// Parent graph. + ParentGraph* parentgraph = nullptr; + }; + +} // namespace callgraph -- cgit v1.2.3