mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adjust BriefCommentRequest to only query swiftdoc if we have it
If we have both loaded a swiftdoc, and the decl we have should have had its doc comment serialized into it, we can check it without needing to fall back to the swiftsourceinfo. This requires a couple of refactorings: - Factoring out the `shouldIncludeDecl` logic into `getDocCommentSerializationTargetFor` for determining whether a doc comment should end up in the swiftdoc or not. - Factoring out `CommentProviderFinder` for searching for the doc providing comment decl for brief comments, in order to allow us to avoid querying the raw comment when searching for it. This has the added bonus of meaning we no longer need to fall back to parsing the raw comment for the brief comment if the comment is provided by another decl in the swiftdoc. This diff is best viewed without whitespace.
This commit is contained in:
@@ -1065,6 +1065,10 @@ Optional<CommentInfo> ModuleFile::getCommentForDecl(const Decl *D) const {
|
||||
return getCommentForDeclByUSR(USRBuffer.str());
|
||||
}
|
||||
|
||||
bool ModuleFile::hasLoadedSwiftDoc() const {
|
||||
return Core->DeclCommentTable != nullptr;
|
||||
}
|
||||
|
||||
void ModuleFile::collectSerializedSearchPath(
|
||||
llvm::function_ref<void(StringRef)> callback) const {
|
||||
for (auto path: Core->SearchPaths) {
|
||||
|
||||
Reference in New Issue
Block a user