logic: fixed names of file nodes that are target of macro use edge
* fixed name of macro use edge target * fixed generating a file nodes full path in SqliteStorage
This commit is contained in:
@@ -962,12 +962,13 @@ std::vector<Id> PersistentStorage::getLocalSymbolIdsForLocationIds(const std::ve
|
||||
|
||||
std::vector<Id> PersistentStorage::getTokenIdsForMatches(const std::vector<SearchMatch>& matches) const
|
||||
{
|
||||
FilePath rootPath = getDbFilePath().parentDirectory();
|
||||
std::set<Id> idSet;
|
||||
for (const SearchMatch& match : matches)
|
||||
{
|
||||
if (match.nodeType == Node::NODE_FILE)
|
||||
{
|
||||
idSet.insert(m_sqliteStorage.getFileByPath(match.name).id);
|
||||
idSet.insert(m_sqliteStorage.getFileByPath(rootPath.concat(match.subtext).str()).id);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
const size_t SqliteStorage::STORAGE_VERSION = 8;
|
||||
|
||||
SqliteStorage::SqliteStorage(const FilePath& dbFilePath)
|
||||
: m_dbFilePath(dbFilePath)
|
||||
: m_dbFilePath(dbFilePath.canonical())
|
||||
{
|
||||
m_database.open(m_dbFilePath.str().c_str());
|
||||
|
||||
|
||||
@@ -59,12 +59,8 @@ void PreprocessorCallbacks::InclusionDirective(
|
||||
FilePath includedFilePath = FilePath(fileEntry->getName()).canonical();
|
||||
if (m_fileRegister->hasFilePath(includedFilePath))
|
||||
{
|
||||
|
||||
NameHierarchy referencedNameHierarchy;
|
||||
referencedNameHierarchy.push(std::make_shared<NameElement>(includedFilePath.str()));
|
||||
|
||||
NameHierarchy contextNameHierarchy;
|
||||
contextNameHierarchy.push(std::make_shared<NameElement>(m_currentPath.str()));
|
||||
const NameHierarchy referencedNameHierarchy(includedFilePath.str());
|
||||
const NameHierarchy contextNameHierarchy(m_currentPath.str());
|
||||
|
||||
m_client->recordReference(
|
||||
REFERENCE_INCLUDE,
|
||||
@@ -86,8 +82,7 @@ void PreprocessorCallbacks::MacroDefined(const clang::Token& macroNameToken, con
|
||||
return;
|
||||
}
|
||||
|
||||
NameHierarchy nameHierarchy;
|
||||
nameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
|
||||
const NameHierarchy nameHierarchy(macroNameToken.getIdentifierInfo()->getName().str());
|
||||
|
||||
m_client->recordSymbol(
|
||||
nameHierarchy,
|
||||
@@ -136,11 +131,8 @@ void PreprocessorCallbacks::onMacroUsage(const clang::Token& macroNameToken)
|
||||
{
|
||||
const ParseLocation loc = getParseLocation(macroNameToken);
|
||||
|
||||
NameHierarchy referencedNameHierarchy;
|
||||
referencedNameHierarchy.push(std::make_shared<NameElement>(macroNameToken.getIdentifierInfo()->getName().str()));
|
||||
|
||||
NameHierarchy contextNameHierarchy;
|
||||
contextNameHierarchy.push(std::make_shared<NameElement>(loc.filePath.fileName()));
|
||||
const NameHierarchy referencedNameHierarchy(macroNameToken.getIdentifierInfo()->getName().str());
|
||||
const NameHierarchy contextNameHierarchy(loc.filePath.str());
|
||||
|
||||
m_client->recordReference(
|
||||
REFERENCE_MACRO_USAGE,
|
||||
|
||||
Reference in New Issue
Block a user