mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[FIXUP] Don't skip edges to functions that have already been visited
This commit is contained in:
parent
20933f5f13
commit
7411742dad
@ -177,18 +177,13 @@ void FunctionCallGraphBuilder::endVisit(ModifierInvocation const& _modifierInvoc
|
||||
}
|
||||
}
|
||||
|
||||
void FunctionCallGraphBuilder::visitCallable(CallableDeclaration const* _callable, bool _directCall)
|
||||
void FunctionCallGraphBuilder::visitCallable(CallableDeclaration const* _callable)
|
||||
{
|
||||
solAssert(!m_graph->edges.count(_callable), "");
|
||||
|
||||
optional<Node> previousNode = m_currentNode;
|
||||
m_currentNode = _callable;
|
||||
|
||||
if (previousNode.has_value() && _directCall)
|
||||
add(*previousNode, _callable);
|
||||
if (!_directCall)
|
||||
add(*m_currentNode, m_currentDispatch);
|
||||
|
||||
_callable->accept(*this);
|
||||
|
||||
m_currentNode = previousNode;
|
||||
@ -201,12 +196,16 @@ bool FunctionCallGraphBuilder::add(Node _caller, Node _callee)
|
||||
|
||||
void FunctionCallGraphBuilder::processFunction(CallableDeclaration const& _callable, bool _calledDirectly)
|
||||
{
|
||||
if (m_graph->edges.count(&_callable))
|
||||
return;
|
||||
if (m_currentNode.has_value() && _calledDirectly)
|
||||
add(*m_currentNode, &_callable);
|
||||
|
||||
// Create edge to creation dispatch
|
||||
if (!_calledDirectly)
|
||||
{
|
||||
add(m_currentDispatch, &_callable);
|
||||
|
||||
visitCallable(&_callable, _calledDirectly);
|
||||
add(&_callable, m_currentDispatch);
|
||||
}
|
||||
|
||||
if (!m_graph->edges.count(&_callable))
|
||||
visitCallable(&_callable);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ private:
|
||||
void endVisit(MemberAccess const& _memberAccess) override;
|
||||
void endVisit(ModifierInvocation const& _modifierInvocation) override;
|
||||
|
||||
void visitCallable(CallableDeclaration const* _callable, bool _directCall = true);
|
||||
void visitCallable(CallableDeclaration const* _callable);
|
||||
|
||||
bool add(Node _caller, Node _callee);
|
||||
void processFunction(CallableDeclaration const& _callable, bool _calledDirectly = true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user