@@ -81,27 +81,23 @@ void ControlFlowRevertPruner::findRevertStates()
81
81
if (_node == functionFlow.exit )
82
82
foundExit = true ;
83
83
84
- if (auto const * functionCall = _node->functionCall )
84
+ auto const * resolvedFunction = _node->functionDefinition ;
85
+ if (resolvedFunction && resolvedFunction->isImplemented ())
85
86
{
86
- auto const * resolvedFunction = ASTNode::resolveFunctionCall (*functionCall, item.contract );
87
-
88
- if (resolvedFunction && resolvedFunction->isImplemented ())
87
+ CFG::FunctionContractTuple calledFunctionTuple{
88
+ findScopeContract (*resolvedFunction, item.contract ),
89
+ resolvedFunction
90
+ };
91
+ switch (m_functions.at (calledFunctionTuple))
89
92
{
90
- CFG::FunctionContractTuple calledFunctionTuple{
91
- findScopeContract (*resolvedFunction, item.contract ),
92
- resolvedFunction
93
- };
94
- switch (m_functions.at (calledFunctionTuple))
95
- {
96
- case RevertState::Unknown:
97
- wakeUp[calledFunctionTuple].insert (item);
98
- foundUnknown = true ;
99
- return ;
100
- case RevertState::AllPathsRevert:
101
- return ;
102
- case RevertState::HasNonRevertingPath:
103
- break ;
104
- }
93
+ case RevertState::Unknown:
94
+ wakeUp[calledFunctionTuple].insert (item);
95
+ foundUnknown = true ;
96
+ return ;
97
+ case RevertState::AllPathsRevert:
98
+ return ;
99
+ case RevertState::HasNonRevertingPath:
100
+ break ;
105
101
}
106
102
}
107
103
@@ -135,30 +131,26 @@ void ControlFlowRevertPruner::modifyFunctionFlows()
135
131
FunctionFlow const & functionFlow = m_cfg.functionFlow (*item.first .function , item.first .contract );
136
132
solidity::util::BreadthFirstSearch<CFGNode*>{{functionFlow.entry }}.run (
137
133
[&](CFGNode* _node, auto && _addChild) {
138
- if (auto const * functionCall = _node->functionCall )
139
- {
140
- auto const * resolvedFunction = ASTNode::resolveFunctionCall (*functionCall, item.first .contract );
141
-
142
- if (resolvedFunction && resolvedFunction->isImplemented ())
143
- switch (m_functions.at ({findScopeContract (*resolvedFunction, item.first .contract ), resolvedFunction}))
144
- {
145
- case RevertState::Unknown:
146
- [[fallthrough]];
147
- case RevertState::AllPathsRevert:
148
- // If the revert states of the functions do not
149
- // change anymore, we treat all "unknown" states as
150
- // "reverting", since they can only be caused by
151
- // recursion.
152
- for (CFGNode * node: _node->exits )
153
- ranges::remove (node->entries , _node);
154
-
155
- _node->exits = {functionFlow.revert };
156
- functionFlow.revert ->entries .push_back (_node);
157
- return ;
158
- default :
159
- break ;
160
- }
161
- }
134
+ auto const * resolvedFunction = _node->functionDefinition ;
135
+ if (resolvedFunction && resolvedFunction->isImplemented ())
136
+ switch (m_functions.at ({findScopeContract (*resolvedFunction, item.first .contract ), resolvedFunction}))
137
+ {
138
+ case RevertState::Unknown:
139
+ [[fallthrough]];
140
+ case RevertState::AllPathsRevert:
141
+ // If the revert states of the functions do not
142
+ // change anymore, we treat all "unknown" states as
143
+ // "reverting", since they can only be caused by
144
+ // recursion.
145
+ for (CFGNode * node: _node->exits )
146
+ ranges::remove (node->entries , _node);
147
+
148
+ _node->exits = {functionFlow.revert };
149
+ functionFlow.revert ->entries .push_back (_node);
150
+ return ;
151
+ default :
152
+ break ;
153
+ }
162
154
163
155
for (CFGNode* exit: _node->exits )
164
156
_addChild (exit);
0 commit comments