Coverage Report

Created: 2022-08-24 06:38

/src/solidity/libyul/optimiser/FunctionCallFinder.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
  This file is part of solidity.
3
4
  solidity is free software: you can redistribute it and/or modify
5
  it under the terms of the GNU General Public License as published by
6
  the Free Software Foundation, either version 3 of the License, or
7
  (at your option) any later version.
8
9
  solidity is distributed in the hope that it will be useful,
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
  GNU General Public License for more details.
13
14
  You should have received a copy of the GNU General Public License
15
  along with solidity.  If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#include <libyul/optimiser/FunctionCallFinder.h>
19
#include <libyul/AST.h>
20
21
using namespace std;
22
using namespace solidity;
23
using namespace solidity::yul;
24
25
vector<FunctionCall*> FunctionCallFinder::run(Block& _block, YulString _functionName)
26
43.7k
{
27
43.7k
  FunctionCallFinder functionCallFinder(_functionName);
28
43.7k
  functionCallFinder(_block);
29
43.7k
  return functionCallFinder.m_calls;
30
43.7k
}
31
32
43.7k
FunctionCallFinder::FunctionCallFinder(YulString _functionName): m_functionName(_functionName) {}
33
34
void FunctionCallFinder::operator()(FunctionCall& _functionCall)
35
1.44M
{
36
1.44M
  ASTModifier::operator()(_functionCall);
37
1.44M
  if (_functionCall.functionName.name == m_functionName)
38
0
    m_calls.emplace_back(&_functionCall);
39
1.44M
}