data: Refactored ParserClient API to return and use Ids instead of NameHierarchies for faster indexing

* Pass NameHierarchy to record new symbol returning an Id
* Cache symbol Ids in Parser implementation
* Reuse symbol Ids as reference when recording related data
* Pass FilePath to record new file returning an Id
* Cache file Ids in CanonicalFilePathCache
* Store file Id in ParseLocation instead of FilePath

fortune cookie message = You know a silent way to impose your will.
This commit is contained in:
Eberhard Graether
2018-10-16 00:54:38 +02:00
parent aab29b241e
commit 4ae052cb9c
169 changed files with 43427 additions and 43502 deletions
+8 -7
View File
@@ -124,7 +124,8 @@ std::wstring utility::getFileNameOfFileEntry(const clang::FileEntry* entry)
}
else
{
fileName = FilePath(utility::decodeFromUtf8(entry->getName().str())).getParentDirectory().concatenate(FilePath(fileName).fileName()).wstr();
fileName = FilePath(utility::decodeFromUtf8(entry->getName().str()))
.getParentDirectory().concatenate(FilePath(fileName).fileName()).wstr();
}
}
return fileName;
@@ -161,7 +162,7 @@ ParseLocation utility::getParseLocation(
const unsigned int endOffset = sourceManager.getFileOffset(endSloc);
return ParseLocation(
canonicalFilePathCache->getCanonicalFilePath(fileId, sourceManager),
canonicalFilePathCache->getFileSymbolId(fileId),
sourceManager.getLineNumber(fileId, startOffset),
sourceManager.getColumnNumber(fileId, startOffset),
sourceManager.getLineNumber(fileId, endOffset),
@@ -171,7 +172,7 @@ ParseLocation utility::getParseLocation(
else
{
return ParseLocation(
canonicalFilePathCache->getCanonicalFilePath(fileId, sourceManager),
canonicalFilePathCache->getFileSymbolId(fileId),
sourceManager.getLineNumber(fileId, startOffset),
sourceManager.getColumnNumber(fileId, startOffset)
);
@@ -219,14 +220,14 @@ ParseLocation utility::getParseLocation(
const clang::PresumedLoc presumedBegin = sourceManager.getPresumedLoc(beginLoc, false);
const clang::PresumedLoc presumedEnd = sourceManager.getPresumedLoc(endLoc.isValid() ? endLoc : range.getEnd(), false);
FilePath filePath = canonicalFilePathCache->getCanonicalFilePath(sourceManager.getFileID(beginLoc), sourceManager);
if (filePath.empty())
Id fileSymbolId = canonicalFilePathCache->getFileSymbolId(sourceManager.getFileID(beginLoc));
if (!fileSymbolId)
{
filePath = canonicalFilePathCache->getCanonicalFilePath(utility::decodeFromUtf8(presumedBegin.getFilename()));
fileSymbolId = canonicalFilePathCache->getFileSymbolId(utility::decodeFromUtf8(presumedBegin.getFilename()));
}
return ParseLocation(
std::move(filePath),
fileSymbolId,
presumedBegin.getLine(),
presumedBegin.getColumn(),
presumedEnd.getLine(),