forked from qt-creator/qt-creator
Clang: Don't index already indexed symbols
We don't index system headers any more and introduce a first step to decrease double indexing. For that we introduces the SourcesManager which so far tells you only if a file was already indexed for a certain time stamp. Change-Id: Icde54465693ca84a622764c595635cac365c0111 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -98,6 +98,12 @@ SymbolKindAndTags symbolKindAndTags(const clang::Decl *declaration)
|
||||
static IndexingDeclVisitor visitor;
|
||||
return visitor.Visit(declaration);
|
||||
}
|
||||
|
||||
bool isContextIndependentDeclaration(const clang::Decl *declaration)
|
||||
{
|
||||
return clang::dyn_cast<clang::ValueDecl>(declaration)
|
||||
|| clang::dyn_cast<clang::TypeDecl>(declaration);
|
||||
}
|
||||
}
|
||||
|
||||
bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
||||
@@ -107,12 +113,14 @@ bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration,
|
||||
unsigned offset,
|
||||
IndexDataConsumer::ASTNodeInfo astNodeInfo)
|
||||
{
|
||||
|
||||
const auto *namedDeclaration = clang::dyn_cast<clang::NamedDecl>(declaration);
|
||||
if (namedDeclaration) {
|
||||
if (!namedDeclaration->getIdentifier())
|
||||
return true;
|
||||
|
||||
if (alreadyParsed(fileId) && isContextIndependentDeclaration(declaration))
|
||||
return true;
|
||||
|
||||
SymbolIndex globalId = toSymbolIndex(declaration->getCanonicalDecl());
|
||||
clang::SourceLocation sourceLocation = m_sourceManager->getLocForStartOfFile(fileId).getLocWithOffset(offset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user