diff options
Diffstat (limited to 'tiger-compiler/src/callgraph/parent-graph-visitor.hh')
| -rw-r--r-- | tiger-compiler/src/callgraph/parent-graph-visitor.hh | 36 |
1 files changed, 36 insertions, 0 deletions
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 <ast/default-visitor.hh> +#include <ast/non-assert-visitor.hh> +#include <ast/non-object-visitor.hh> +#include <callgraph/fundec-graph.hh> + +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 |
