blob: d62fea9bc65635f83c429f86ef4d83a38554b5d5 (
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
33
34
35
36
37
38
39
40
41
42
|
/**
** \file astclone/libastclone.hh
** \brief Declare functions and variables exported by the Astclone module.
*/
#pragma once
#include <memory>
#include <ast/fwd.hh>
/// Cloning an ast::Ast.
namespace astclone
{
/** \brief Make a deep copy of an AST.
** \param tree abstract syntax tree's root.
** \return the cloned AST. */
template <typename T> T* clone(const T& tree);
template <typename A> using applicable = auto(const A&) -> A*;
template <typename A>
using applicable_with_bools = auto(const A&, bool, bool) -> A*;
template <typename A, typename B>
using applicable_object = auto(const A&, const B&) -> A*;
/// Have the pure function \a f side effect on \a t.
template <typename A> void apply(applicable<A> f, std::unique_ptr<A>& t1);
template <typename A>
void apply(applicable_with_bools<A> f,
std::unique_ptr<A>& t1,
bool cond_1,
bool cond_2);
template <typename A, typename B>
void apply(applicable_object<A, B> f, std::unique_ptr<A>& t1, const B& t3);
} // namespace astclone
#include <astclone/libastclone.hxx>
|