Skip to content

Index: Expose the logic for deciding whether to index a symbol. NFC. rdar://31350446 #8438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/Index/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void indexSourceFile(SourceFile *SF, StringRef hash,
IndexDataConsumer &consumer);
void indexModule(ModuleDecl *module, StringRef hash,
IndexDataConsumer &consumer);

bool shouldIndex(ValueDecl *D, bool IsRef);
} // end namespace index
} // end namespace swift

Expand Down
21 changes: 10 additions & 11 deletions lib/Index/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,6 @@ class IndexSwiftASTWalker : public SourceEntityWalker {
return SrcMgr.getLineAndColumn(Loc, BufferID);
}

bool shouldIndex(ValueDecl *D, bool IsRef) const {
if (D->isImplicit())
return false;
if (isLocalSymbol(D) && (!isa<ParamDecl>(D) || IsRef))
return false;
if (D->isPrivateStdlibDecl())
return false;

return true;
}

void getModuleHash(SourceFileOrModule SFOrMod, llvm::raw_ostream &OS);
llvm::hash_code hashModule(llvm::hash_code code, SourceFileOrModule SFOrMod);
llvm::hash_code hashFileReference(llvm::hash_code code,
Expand Down Expand Up @@ -1260,3 +1249,13 @@ void index::indexModule(ModuleDecl *module, StringRef hash,
walker.visitModule(*module, hash);
consumer.finish();
}

bool index::shouldIndex(ValueDecl *D, bool IsRef) {
if (D->isImplicit())
return false;
if (isLocalSymbol(D) && (!isa<ParamDecl>(D) || IsRef))
return false;
if (D->isPrivateStdlibDecl())
return false;
return true;
}