data: Macro handling

Macros have now edges from Files where they are usesd
This commit is contained in:
Andreas Stallinger
2015-09-28 15:25:52 +02:00
parent dd4d74a1d9
commit e3696df5e1
19 changed files with 272 additions and 69 deletions
+36
View File
@@ -664,6 +664,42 @@ Id Storage::onFileIncludeParsed(const ParseLocation& location, const FileInfo& f
return fileNodeId;
}
Id Storage::onMacroDefineParsed(const ParseLocation &location, const NameHierarchy& macroNameHierarchy) {
Id macroId = 0;
Id fileId = m_sqliteStorage.getFileByName(location.filePath.fileName()).id;
if(fileId != 0)
{
macroId = addNodeHierarchy(Node::NODE_MACRO, macroNameHierarchy);
addSourceLocation(macroId, location);
}
else
{
//TODO: What to do with this ones?
//LOG_ERROR("External MacroDefined :" + macroNameHierarchy.getFullName());
}
return macroId;
}
Id Storage::onMacroExpandParsed(const ParseLocation &location, const NameHierarchy& macroNameHierarchy) {
Id macroExpandId = addNodeHierarchy(Node::NODE_UNDEFINED, macroNameHierarchy);
Id fileId = m_sqliteStorage.getFileByName(location.filePath.fileName()).id;
if(fileId != 0)
{
addEdge(fileId, macroExpandId,Edge::EDGE_MACRO_USAGE, location);
}
else
{
//TODO: What to do with this ones?
//LOG_ERROR("External MacroExpand :" + macroNameHierarchy.getFullName());
}
return 0;
}
Id Storage::getIdForNodeWithName(const std::string& fullName) const // use name hierarchy here
{
std::vector<std::string> nameParts = utility::splitToVector(fullName, "::");