data: parsing file dependencies
This change adds the node NODE_FILE to the graph and the edge EDGE_INCLUDE, which determine the dependencies between files by parsing the include preprocessor directive. File nodes can be searched and displayed in the GraphView as file dependency graph. The filter "file" allows for selecting all files. The file depency information is used on project refresh do determine which files need to get reparsed.
This commit is contained in:
@@ -141,6 +141,8 @@ std::string Edge::getTypeString(EdgeType type) const
|
||||
return "template default argument";
|
||||
case EDGE_TEMPLATE_SPECIALIZATION_OF:
|
||||
return "template specialization";
|
||||
case EDGE_INCLUDE:
|
||||
return "include";
|
||||
case EDGE_AGGREGATION:
|
||||
return "aggregation";
|
||||
}
|
||||
@@ -270,6 +272,13 @@ bool Edge::checkType() const
|
||||
}
|
||||
return true;
|
||||
|
||||
case EDGE_INCLUDE:
|
||||
if (!m_from->isType(Node::NODE_FILE) || !m_to->isType(Node::NODE_FILE))
|
||||
{
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
case EDGE_AGGREGATION:
|
||||
if (!m_from->isType(typeMask | variableMask | functionMask) || !m_to->isType(typeMask | variableMask | functionMask))
|
||||
{
|
||||
|
||||
@@ -32,7 +32,9 @@ public:
|
||||
EDGE_TEMPLATE_DEFAULT_ARGUMENT_OF = 0x1000,
|
||||
EDGE_TEMPLATE_SPECIALIZATION_OF = 0x2000,
|
||||
|
||||
EDGE_AGGREGATION = 0x4000
|
||||
EDGE_INCLUDE = 0x4000,
|
||||
|
||||
EDGE_AGGREGATION = 0x8000
|
||||
};
|
||||
|
||||
Edge(EdgeType type, Node* from, Node* to);
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "data/graph/token_component/TokenComponentAbstraction.h"
|
||||
#include "data/graph/token_component/TokenComponentConst.h"
|
||||
#include "data/graph/token_component/TokenComponentName.h"
|
||||
#include "data/graph/token_component/TokenComponentStatic.h"
|
||||
#include "data/graph/token_component/TokenComponentSignature.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
Node::Node(NodeType type, std::shared_ptr<TokenComponentName> nameComponent)
|
||||
: m_type(type)
|
||||
@@ -50,7 +52,14 @@ bool Node::isType(NodeTypeMask mask) const
|
||||
|
||||
std::string Node::getName() const
|
||||
{
|
||||
return m_nameComponent->getName();
|
||||
if (isType(NODE_FILE))
|
||||
{
|
||||
return FileSystem::fileName(m_nameComponent->getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_nameComponent->getName();
|
||||
}
|
||||
}
|
||||
|
||||
std::string Node::getFullName() const
|
||||
@@ -342,6 +351,8 @@ std::string Node::getTypeString(NodeType type) const
|
||||
return "typedef";
|
||||
case NODE_TEMPLATE_PARAMETER_TYPE:
|
||||
return "template parameter type";
|
||||
case NODE_FILE:
|
||||
return "file";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ public:
|
||||
NODE_ENUM = 0x800,
|
||||
NODE_ENUM_CONSTANT = 0x1000,
|
||||
NODE_TYPEDEF = 0x2000,
|
||||
NODE_TEMPLATE_PARAMETER_TYPE = 0x4000
|
||||
NODE_TEMPLATE_PARAMETER_TYPE = 0x4000,
|
||||
|
||||
NODE_FILE = 0x8000
|
||||
};
|
||||
|
||||
Node(NodeType type, std::shared_ptr<TokenComponentName> nameComponent);
|
||||
|
||||
@@ -174,6 +174,10 @@ void GraphFilterConductor::filterCommandNode(const QueryCommand* node, const Fil
|
||||
GraphFilterCommandInheritance(false).apply(in, out);
|
||||
break;
|
||||
|
||||
case QueryCommand::COMMAND_FILE:
|
||||
GraphFilterCommandNodeType(Node::NODE_FILE).apply(in, out);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_ERROR_STREAM(<< "QueryCommand not supported: " << node->getType());
|
||||
GraphFilter().apply(in, out);
|
||||
|
||||
Reference in New Issue
Block a user