data: compare signatures when storing overloaded functions and methods

Function and method nodes are now distincted by their signature when added to the graph. A different node for each
overloaded declaration is created with the signature as member field.

fortune cookie message = Deine harte Arbeit wird schnell belohnt werden.
This commit is contained in:
Eberhard Graether
2014-07-10 16:08:59 +02:00
parent cdeece6231
commit e2ec5ffee2
11 changed files with 283 additions and 106 deletions
+37 -8
View File
@@ -74,6 +74,27 @@ Node* Graph::createNodeHierarchy(const std::string& fullName)
return insertNodeHierarchy(fullName);
}
Node* Graph::createNodeHierarchyWithDistinctSignature(const std::string& fullName, const std::string& signature)
{
Node* node = getNode(fullName);
if (node)
{
if (node->getSignature() == signature)
{
return node;
}
node = insertNode(fullName, node->getParentNode());
}
else
{
node = insertNodeHierarchy(fullName);
}
node->setSignature(signature);
return node;
}
Edge* Graph::createEdge(Edge::EdgeType type, Node* from, Node* to)
{
Edge* edge = getEdge(type, from, to);
@@ -288,14 +309,7 @@ Node* Graph::insertNodeHierarchy(const std::string& fullName)
if (!childNode)
{
std::shared_ptr<Node> childNodePtr = std::make_shared<Node>(Node::NODE_UNDEFINED, name);
m_nodes.push_back(childNodePtr);
childNode = childNodePtr.get();
if (node)
{
createEdge(Edge::EDGE_MEMBER, node, childNode);
}
childNode = insertNode(name, node);
}
node = childNode;
@@ -304,6 +318,21 @@ Node* Graph::insertNodeHierarchy(const std::string& fullName)
return node;
}
Node* Graph::insertNode(const std::string& fullName, Node* parentNode)
{
std::shared_ptr<Node> nodePtr = std::make_shared<Node>(Node::NODE_UNDEFINED, fullName);
m_nodes.push_back(nodePtr);
Node* node = nodePtr.get();
if (parentNode)
{
createEdge(Edge::EDGE_MEMBER, parentNode, node);
}
return node;
}
Edge* Graph::insertEdge(Edge::EdgeType type, Node* from, Node* to)
{
std::shared_ptr<Edge> edgePtr = std::make_shared<Edge>(type, from, to);