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:
Xi Ge
2016-02-24 20:32:31 -08:00
parent 90ca7be73f
commit a1d885c348
2 changed files with 9 additions and 1 deletions

View File

@@ -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.