Move CallGraph structure to a separate module

This commit is contained in:
Kamil Śliwak
2021-02-23 10:47:02 +01:00
parent 769a7687c6
commit 6c28120f19
10 changed files with 171 additions and 116 deletions
+3 -6
View File
@@ -78,11 +78,11 @@ void verifyCallGraph(
}
set<CallableDeclaration const*, ASTNode::CompareByID> collectReachableCallables(
FunctionCallGraphBuilder::ContractCallGraph const& _graph
CallGraph const& _graph
)
{
set<CallableDeclaration const*, ASTNode::CompareByID> reachableCallables;
for (FunctionCallGraphBuilder::Node const& reachableNode: _graph.edges | views::keys)
for (CallGraph::Node const& reachableNode: _graph.edges | views::keys)
if (holds_alternative<CallableDeclaration const*>(reachableNode))
reachableCallables.emplace(get<CallableDeclaration const*>(reachableNode));
@@ -119,10 +119,7 @@ pair<string, string> IRGenerator::run(
return {warning + ir, warning + asmStack.print()};
}
void IRGenerator::verifyCallGraphs(
FunctionCallGraphBuilder::ContractCallGraph const& _creationGraph,
FunctionCallGraphBuilder::ContractCallGraph const& _deployedGraph
)
void IRGenerator::verifyCallGraphs(CallGraph const& _creationGraph, CallGraph const& _deployedGraph)
{
// m_creationFunctionList and m_deployedFunctionList are not used for any other purpose so
// we can just destroy them without bothering to make a copy.
+2 -5
View File
@@ -25,7 +25,7 @@
#include <libsolidity/interface/OptimiserSettings.h>
#include <libsolidity/ast/ASTForward.h>
#include <libsolidity/analysis/FunctionCallGraph.h>
#include <libsolidity/ast/CallGraph.h>
#include <libsolidity/codegen/ir/IRGenerationContext.h>
#include <libsolidity/codegen/YulUtilFunctions.h>
#include <liblangutil/EVMVersion.h>
@@ -57,10 +57,7 @@ public:
std::map<ContractDefinition const*, std::string_view const> const& _otherYulSources
);
void verifyCallGraphs(
FunctionCallGraphBuilder::ContractCallGraph const& _creationGraph,
FunctionCallGraphBuilder::ContractCallGraph const& _deployedGraph
);
void verifyCallGraphs(CallGraph const& _creationGraph, CallGraph const& _deployedGraph);
private:
std::string generate(