mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Module groups: if group name collector is enabled, we continuously serialize doc-comment table for comment-free decls to preserve the group information.
This commit is contained in:
@@ -3607,6 +3607,9 @@ class DeclGroupNameContext {
|
||||
GroupNameCollectorFromJson(StringRef RecordPath) :
|
||||
GroupNameCollector(!RecordPath.empty()), RecordPath(RecordPath) {}
|
||||
StringRef getGroupNameInternal(const ValueDecl *VD) override {
|
||||
// We need the file path, so there has to be a location.
|
||||
if (VD->getLoc().isInvalid())
|
||||
return NullGroupName;
|
||||
auto PathOp = VD->getDeclContext()->getParentSourceFile()->getBufferID();
|
||||
if (!PathOp.hasValue())
|
||||
return NullGroupName;
|
||||
@@ -3647,6 +3650,10 @@ public:
|
||||
}
|
||||
return llvm::makeArrayRef(ViewBuffer);
|
||||
}
|
||||
|
||||
bool isEnable() {
|
||||
return pNameCollector->Enable;
|
||||
}
|
||||
};
|
||||
|
||||
static void writeGroupNames(const comment_block::GroupNamesLayout &GroupNames,
|
||||
@@ -3691,7 +3698,7 @@ static void writeDeclCommentTable(
|
||||
|
||||
// Skip the decl if it does not have a comment.
|
||||
RawComment Raw = VD->getRawComment();
|
||||
if (Raw.Comments.empty())
|
||||
if (Raw.Comments.empty() && !GroupContext.isEnable())
|
||||
return true;
|
||||
|
||||
// Compute USR.
|
||||
|
||||
Reference in New Issue
Block a user