data: Speed up include parsing by reusing current path in PreprocessorCallbacks
This commit is contained in:
@@ -50,21 +50,14 @@ void PreprocessorCallbacks::InclusionDirective(
|
|||||||
clang::CharSourceRange fileNameRange, const clang::FileEntry* fileEntry, llvm::StringRef searchPath,
|
clang::CharSourceRange fileNameRange, const clang::FileEntry* fileEntry, llvm::StringRef searchPath,
|
||||||
llvm::StringRef relativePath, const clang::Module* imported
|
llvm::StringRef relativePath, const clang::Module* imported
|
||||||
){
|
){
|
||||||
const clang::FileEntry* baseFileEntry = m_sourceManager.getFileEntryForID(m_sourceManager.getFileID(hashLocation));
|
if (!m_currentPath.empty())
|
||||||
if (fileEntry && baseFileEntry)
|
|
||||||
{
|
{
|
||||||
FilePath baseFilePath = FilePath(baseFileEntry->getName()).canonical();
|
|
||||||
if (!m_fileRegister->hasFilePath(baseFilePath) || m_fileRegister->fileIsParsed(baseFilePath))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FilePath includedFilePath = FilePath(fileEntry->getName()).canonical();
|
FilePath includedFilePath = FilePath(fileEntry->getName()).canonical();
|
||||||
if (m_fileRegister->hasFilePath(includedFilePath))
|
if (m_fileRegister->hasFilePath(includedFilePath))
|
||||||
{
|
{
|
||||||
m_client->onFileIncludeParsed(
|
m_client->onFileIncludeParsed(
|
||||||
getParseLocation(fileNameRange.getAsRange()),
|
getParseLocation(fileNameRange.getAsRange()),
|
||||||
m_fileRegister->getFileInfo(baseFilePath),
|
m_fileRegister->getFileInfo(m_currentPath),
|
||||||
m_fileRegister->getFileInfo(includedFilePath)
|
m_fileRegister->getFileInfo(includedFilePath)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user