/src/solidity/libsolidity/ast/CallGraph.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 | | // SPDX-License-Identifier: GPL-3.0 |
18 | | |
19 | | #include <libsolidity/ast/CallGraph.h> |
20 | | |
21 | | using namespace std; |
22 | | using namespace solidity::frontend; |
23 | | |
24 | | bool CallGraph::CompareByID::operator()(Node const& _lhs, Node const& _rhs) const |
25 | 2.12M | { |
26 | 2.12M | if (_lhs.index() != _rhs.index()) |
27 | 199k | return _lhs.index() < _rhs.index(); |
28 | | |
29 | 1.92M | if (holds_alternative<SpecialNode>(_lhs)) |
30 | 50.5k | return get<SpecialNode>(_lhs) < get<SpecialNode>(_rhs); |
31 | 1.87M | return get<CallableDeclaration const*>(_lhs)->id() < get<CallableDeclaration const*>(_rhs)->id(); |
32 | 1.92M | } |
33 | | |
34 | | bool CallGraph::CompareByID::operator()(Node const& _lhs, int64_t _rhs) const |
35 | 0 | { |
36 | 0 | solAssert(!holds_alternative<SpecialNode>(_lhs), ""); |
37 | | |
38 | 0 | return get<CallableDeclaration const*>(_lhs)->id() < _rhs; |
39 | 0 | } |
40 | | |
41 | | bool CallGraph::CompareByID::operator()(int64_t _lhs, Node const& _rhs) const |
42 | 0 | { |
43 | 0 | solAssert(!holds_alternative<SpecialNode>(_rhs), ""); |
44 | | |
45 | 0 | return _lhs < get<CallableDeclaration const*>(_rhs)->id(); |
46 | 0 | } |