diff --git a/src/qdoc/node.cpp b/src/qdoc/node.cpp
index 5c834abdfc7ae4fcdc201b6ad4ee0f2bce38760f..9fe4596908ea18d39584d30236db8263197a5bf6 100644
--- a/src/qdoc/node.cpp
+++ b/src/qdoc/node.cpp
@@ -797,6 +797,15 @@ void Node::setSharedCommentNode(SharedCommentNode* t)
     t->append(this);
 }
 
+/*!
+  Returns true if this node is sharing a comment and the
+  shared comment is not empty.
+ */
+bool Node::hasSharedDoc() const
+{
+    return (sharedCommentNode_ && sharedCommentNode_->hasDoc());
+}
+
 /*!
   \class Aggregate
  */
@@ -1044,7 +1053,7 @@ QStringList Aggregate::secondaryKeys()
 void Aggregate::makeUndocumentedChildrenInternal()
 {
     foreach (Node *child, childNodes()) {
-        if (child->doc().isEmpty() && child->status() != Node::Intermediate) {
+        if (!child->isSharingComment() && child->doc().isEmpty() && child->status() != Node::Intermediate) {
             child->setAccess(Node::Private);
             child->setStatus(Node::Internal);
         }
@@ -3089,4 +3098,26 @@ void SharedCommentNode::setOverloadFlag(bool b)
         n->setOverloadFlag(b);
 }
 
+/*!
+  Sets the pointer to the node that this node relates to
+  in each of the nodes in this shared comment node's collective.
+ */
+void SharedCommentNode::setRelates(Aggregate *pseudoParent)
+{
+    Node::setRelates(pseudoParent);
+    for (Node *n : collective_)
+        n->setRelates(pseudoParent);
+}
+
+/*!
+  Sets the (unresolved) entity \a name that this node relates to
+  in each of the nodes in this shared comment node's collective.
+ */
+void SharedCommentNode::setRelates(const QString& name)
+{
+    Node::setRelates(name);
+    for (Node *n : collective_)
+        n->setRelates(name);
+}
+
 QT_END_NAMESPACE
diff --git a/src/qdoc/node.h b/src/qdoc/node.h
index b4e2e5823708a260534f3fc5a2ce17d8b332fd9d..51f4b46ee0083c93941a669378db0dc56405ecc2 100644
--- a/src/qdoc/node.h
+++ b/src/qdoc/node.h
@@ -178,8 +178,8 @@ public:
     }
     void setThreadSafeness(ThreadSafeness t) { safeness_ = (unsigned char) t; }
     void setSince(const QString &since);
-    void setRelates(Aggregate* pseudoParent);
-    void setRelates(const QString &name);
+    virtual void setRelates(Aggregate* pseudoParent);
+    virtual void setRelates(const QString &name);
     void setPhysicalModuleName(const QString &name) { physicalModuleName_ = name; }
     void setUrl(const QString& url) { url_ = url; }
     void setTemplateStuff(const QString &t) { templateStuff_ = t; }
@@ -311,6 +311,7 @@ public:
     void clearRelated() { relatesTo_ = 0; }
 
     bool isSharingComment() const { return (sharedCommentNode_ != 0); }
+    bool hasSharedDoc() const;
     void setSharedCommentNode(SharedCommentNode* t);
 
     //QString guid() const;
@@ -895,6 +896,8 @@ class SharedCommentNode : public LeafNode
     void append(Node* n) { collective_.append(n); }
     const QVector<Node*>& collective() const { return collective_; }
     void setOverloadFlag(bool b) override;
+    void setRelates(Aggregate* pseudoParent) override;
+    void setRelates(const QString &name) override;
 
  private:
     QVector<Node*> collective_;