Skip to content

Commit 9e6d584

Browse files
authored
Index: Expose the logic for deciding whether to index a symbol. NFC. (#8438)
1 parent 268cbba commit 9e6d584

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

include/swift/Index/Index.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void indexSourceFile(SourceFile *SF, StringRef hash,
2525
IndexDataConsumer &consumer);
2626
void indexModule(ModuleDecl *module, StringRef hash,
2727
IndexDataConsumer &consumer);
28-
28+
bool shouldIndex(ValueDecl *D, bool IsRef);
2929
} // end namespace index
3030
} // end namespace swift
3131

lib/Index/Index.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -403,17 +403,6 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
403403
return SrcMgr.getLineAndColumn(Loc, BufferID);
404404
}
405405

406-
bool shouldIndex(ValueDecl *D, bool IsRef) const {
407-
if (D->isImplicit())
408-
return false;
409-
if (isLocalSymbol(D) && (!isa<ParamDecl>(D) || IsRef))
410-
return false;
411-
if (D->isPrivateStdlibDecl())
412-
return false;
413-
414-
return true;
415-
}
416-
417406
void getModuleHash(SourceFileOrModule SFOrMod, llvm::raw_ostream &OS);
418407
llvm::hash_code hashModule(llvm::hash_code code, SourceFileOrModule SFOrMod);
419408
llvm::hash_code hashFileReference(llvm::hash_code code,
@@ -1260,3 +1249,13 @@ void index::indexModule(ModuleDecl *module, StringRef hash,
12601249
walker.visitModule(*module, hash);
12611250
consumer.finish();
12621251
}
1252+
1253+
bool index::shouldIndex(ValueDecl *D, bool IsRef) {
1254+
if (D->isImplicit())
1255+
return false;
1256+
if (isLocalSymbol(D) && (!isa<ParamDecl>(D) || IsRef))
1257+
return false;
1258+
if (D->isPrivateStdlibDecl())
1259+
return false;
1260+
return true;
1261+
}

0 commit comments

Comments
 (0)