data: saving typedef to Storage

This change save typedef expressions to the Storage using a node of type Node::NODE_TYPEDEF and an edge of type
Edge::EDGE_TYPEDEF_OF that leads to the original type, with the qualifiers saved as DataType on the edge.
This commit is contained in:
Eberhard Graether
2014-07-14 16:47:40 +02:00
parent b7cbef3772
commit bbe5874a89
6 changed files with 19 additions and 6 deletions
+4 -3
View File
@@ -13,6 +13,10 @@ y fooy();
z fooz();
*/
class A {};
class B : public A {};
typedef A* C;
const bool *ab(int a, int b);
bool const *abc(int a, int b);
@@ -23,6 +27,3 @@ int main();
void foo();
int sum(int a, int b);
int diff(int a, int b);
class A {};
class B : public A {};
+7 -1
View File
@@ -47,7 +47,13 @@ void Storage::onTypedefParsed(
){
log("typedef", fullName + " -> " + underlyingType.getFullTypeName(), location);
// TODO: save Typedef
Node* node = m_graph.createNodeHierarchy(fullName);
node->setType(Node::NODE_TYPEDEF);
node->setAccess(convertAccessType(access));
addTokenLocation(node, location);
addTypeEdge(node, Edge::EDGE_TYPEDEF_OF, underlyingType);
}
void Storage::onClassParsed(const ParseLocation& location, const std::string& fullName, AccessType access)
+2
View File
@@ -103,6 +103,8 @@ std::string Edge::getTypeString() const
return "is derived from";
case EDGE_CALL:
return "calls";
case EDGE_TYPEDEF_OF:
return "is typedef of";
default:
LOG_ERROR("TypeString not implemented for edge type.");
}
+2 -1
View File
@@ -20,7 +20,8 @@ public:
EDGE_PARAMETER_TYPE_OF,
EDGE_USAGE,
EDGE_CALL,
EDGE_INHERITANCE
EDGE_INHERITANCE,
EDGE_TYPEDEF_OF
};
enum AccessType
+2
View File
@@ -266,6 +266,8 @@ std::string Node::getTypeString(NodeType type) const
return "namespace";
case NODE_ENUM:
return "enum";
case NODE_TYPEDEF:
return "typedef";
}
return "";
}
+2 -1
View File
@@ -22,7 +22,8 @@ public:
NODE_FUNCTION,
NODE_METHOD,
NODE_NAMESPACE,
NODE_ENUM
NODE_ENUM,
NODE_TYPEDEF
};
Node(NodeType type, const std::string& name);