blob: 30a06095f3350d67f2c512ebd81047fd3787d9ea (
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 inlining/pruner.hh
** \brief Declaration of inlining::Pruner.
*/
#pragma once
#include <map>
#include <astclone/cloner.hh>
#include <misc/set.hh>
namespace inlining
{
/// Prune useless function declarations within an AST.
class Pruner : public astclone::Cloner
{
public:
using super_type = astclone::Cloner;
// Import overloaded virtual functions.
using super_type::operator();
using func_vect = std::vector<ast::FunctionDec*>;
using func_count = std::map<misc::symbol, int>;
/// \name Visit methods.
/// \{
// FIXME: Some code was deleted here.
/// \}
ast::FunctionChunk* prune(ast::FunctionChunk& e);
private:
// Keep track of current nested functions
std::vector<const ast::FunctionDec*> current_functions_;
// Associate function dec with the number of CallExp calling it
func_count called_functions_;
};
} // namespace inlining
|