data: parse partial template specializations

* fixed: implicit template specializations will be found even if the original template definition is located in a different file (that gets included).
* implemented correct extraction of template parameters, template arguments and template specialization edges.
* added token locations for template parameters of partial template specializations.
* graph view displays full names of template parameters and template arguments.
* added test code for features
This commit is contained in:
malte_langkabel
2015-02-03 13:10:56 +01:00
parent 944554d034
commit e17341fc43
18 changed files with 363 additions and 126 deletions
+2
View File
@@ -133,6 +133,8 @@ std::string Edge::getTypeString(EdgeType type) const
return "typedef";
case EDGE_TEMPLATE_PARAMETER_OF:
return "template parameter";
case EDGE_TEMPLATE_ARGUMENT_OF:
return "template argument";
case EDGE_TEMPLATE_SPECIALIZATION_OF:
return "template specialization";
case EDGE_AGGREGATION:
+3 -2
View File
@@ -27,9 +27,10 @@ public:
EDGE_INHERITANCE = 0x80,
EDGE_TYPEDEF_OF = 0x100,
EDGE_TEMPLATE_PARAMETER_OF = 0x200,
EDGE_TEMPLATE_SPECIALIZATION_OF = 0x400,
EDGE_TEMPLATE_ARGUMENT_OF = 0x400,
EDGE_TEMPLATE_SPECIALIZATION_OF = 0x800,
EDGE_AGGREGATION = 0x800
EDGE_AGGREGATION = 0x1000
};
Edge(EdgeType type, Node* from, Node* to);
-6
View File
@@ -9,12 +9,6 @@
#include "data/graph/token_component/TokenComponentSignature.h"
#include "utility/logging/logging.h"
Node::Node(NodeType type, const std::string& name)
: m_type(type)
, m_nameComponent(std::make_shared<TokenComponentNameCached>(name))
{
}
Node::Node(NodeType type, std::shared_ptr<TokenComponentName> nameComponent)
: m_type(type)
, m_nameComponent(nameComponent)
-1
View File
@@ -38,7 +38,6 @@ public:
NODE_TEMPLATE_PARAMETER_TYPE = 0x2000
};
Node(NodeType type, const std::string& name);
Node(NodeType type, std::shared_ptr<TokenComponentName> nameComponent);
Node(const Node& other);
virtual ~Node();
@@ -29,7 +29,7 @@ TokenComponentNameReferenced::~TokenComponentNameReferenced()
std::shared_ptr<TokenComponent> TokenComponentNameReferenced::copy() const
{
return std::make_shared<TokenComponentNameCached>(getFullName());
return std::make_shared<TokenComponentNameCached>(m_searchNode->getNameHierarchy());
}
std::string TokenComponentNameReferenced::getName() const
@@ -47,8 +47,8 @@ const SearchNode* TokenComponentNameReferenced::getSearchNode() const
return m_searchNode;
}
TokenComponentNameCached::TokenComponentNameCached(const std::string& fullName)
: m_fullName(fullName)
TokenComponentNameCached::TokenComponentNameCached(const std::vector<std::string>& nameHierarchy)
: m_nameHierarchy(nameHierarchy)
{
}
@@ -58,17 +58,17 @@ TokenComponentNameCached::~TokenComponentNameCached()
std::shared_ptr<TokenComponent> TokenComponentNameCached::copy() const
{
return std::make_shared<TokenComponentNameCached>(m_fullName);
return std::make_shared<TokenComponentNameCached>(m_nameHierarchy);
}
std::string TokenComponentNameCached::getName() const
{
return utility::split(m_fullName, SearchIndex::DELIMITER).back();
return m_nameHierarchy.back();
}
std::string TokenComponentNameCached::getFullName() const
{
return m_fullName;
return utility::join(m_nameHierarchy, "::");
}
const SearchNode* TokenComponentNameCached::getSearchNode() const
@@ -45,7 +45,7 @@ class TokenComponentNameCached
: public TokenComponentName
{
public:
TokenComponentNameCached(const std::string& fullName);
TokenComponentNameCached(const std::vector<std::string>& nameHierarchy);
virtual ~TokenComponentNameCached();
virtual std::shared_ptr<TokenComponent> copy() const;
@@ -56,7 +56,7 @@ public:
virtual const SearchNode* getSearchNode() const;
private:
const std::string m_fullName;
const std::vector<std::string> m_nameHierarchy;
};
#endif // TOKEN_COMPONENT_NAME_H