@@ -2080,6 +2080,55 @@ static void applyMemberOverrideOptions(const Entry *root,MemberDefMutable *md)
20802080
20812081// ----------------------------------------------------------------------
20822082
2083+ static void createUsingMemberImportForClass (const Entry *root,ClassDefMutable *cd,const MemberDef *md,
2084+ const QCString &fileName,const QCString &memName)
2085+ {
2086+ AUTO_TRACE (" creating new member {} for class {}" ,memName,cd->name ());
2087+ const ArgumentList &templAl = md->templateArguments ();
2088+ const ArgumentList &al = md->argumentList ();
2089+ auto newMd = createMemberDef (
2090+ fileName,root->startLine ,root->startColumn ,
2091+ md->typeString (),memName,md->argsString (),
2092+ md->excpString (),root->protection ,root->virt ,
2093+ md->isStatic (),Relationship::Member,md->memberType (),
2094+ templAl,al,root->metaData
2095+ );
2096+ auto newMmd = toMemberDefMutable (newMd.get ());
2097+ newMmd->setMemberClass (cd);
2098+ cd->insertMember (newMd.get ());
2099+ if (!root->doc .isEmpty () || !root->brief .isEmpty ())
2100+ {
2101+ newMmd->setDocumentation (root->doc ,root->docFile ,root->docLine );
2102+ newMmd->setBriefDescription (root->brief ,root->briefFile ,root->briefLine );
2103+ newMmd->setInbodyDocumentation (root->inbodyDocs ,root->inbodyFile ,root->inbodyLine );
2104+ }
2105+ else
2106+ {
2107+ newMmd->setDocumentation (md->documentation (),md->docFile (),md->docLine ());
2108+ newMmd->setBriefDescription (md->briefDescription (),md->briefFile (),md->briefLine ());
2109+ newMmd->setInbodyDocumentation (md->inbodyDocumentation (),md->inbodyFile (),md->inbodyLine ());
2110+ }
2111+ newMmd->setDefinition (md->definition ());
2112+ applyMemberOverrideOptions (root,newMmd);
2113+ newMmd->addQualifiers (root->qualifiers );
2114+ newMmd->setBitfields (md->bitfieldString ());
2115+ newMmd->addSectionsToDefinition (root->anchors );
2116+ newMmd->setBodySegment (md->getDefLine (),md->getStartBodyLine (),md->getEndBodyLine ());
2117+ newMmd->setBodyDef (md->getBodyDef ());
2118+ newMmd->setInitializer (md->initializer ());
2119+ newMmd->setRequiresClause (md->requiresClause ());
2120+ newMmd->setMaxInitLines (md->initializerLines ());
2121+ newMmd->setMemberGroupId (root->mGrpId );
2122+ newMmd->setMemberSpecifiers (md->getMemberSpecifiers ());
2123+ newMmd->setVhdlSpecifiers (md->getVhdlSpecifiers ());
2124+ newMmd->setLanguage (root->lang );
2125+ newMmd->setId (root->id );
2126+ MemberName *mn = Doxygen::memberNameLinkedMap->add (memName);
2127+ mn->push_back (std::move (newMd));
2128+ }
2129+
2130+ static std::unordered_map<std::string,std::vector<ClassDefMutable*>> g_usingClassMap;
2131+
20832132static void findUsingDeclImports (const Entry *root)
20842133{
20852134 if (root->section .isUsingDecl () &&
@@ -2120,51 +2169,18 @@ static void findUsingDeclImports(const Entry *root)
21202169 {
21212170 fileName = root->tagInfo ()->tagName ;
21222171 }
2123- const ArgumentList &templAl = md->templateArguments ();
2124- const ArgumentList &al = md->argumentList ();
2125-
21262172 if (!cd->containsOverload (md))
21272173 {
2128- AUTO_TRACE_ADD (" creating new member {} for class {}" ,memName,cd->name ());
2129- auto newMd = createMemberDef (
2130- fileName,root->startLine ,root->startColumn ,
2131- md->typeString (),memName,md->argsString (),
2132- md->excpString (),root->protection ,root->virt ,
2133- md->isStatic (),Relationship::Member,md->memberType (),
2134- templAl,al,root->metaData
2135- );
2136- auto newMmd = toMemberDefMutable (newMd.get ());
2137- newMmd->setMemberClass (cd);
2138- cd->insertMember (newMd.get ());
2139- if (!root->doc .isEmpty () || !root->brief .isEmpty ())
2140- {
2141- newMmd->setDocumentation (root->doc ,root->docFile ,root->docLine );
2142- newMmd->setBriefDescription (root->brief ,root->briefFile ,root->briefLine );
2143- newMmd->setInbodyDocumentation (root->inbodyDocs ,root->inbodyFile ,root->inbodyLine );
2144- }
2145- else
2174+ createUsingMemberImportForClass (root,cd,md,fileName,memName);
2175+ // also insert the member into copies of the class
2176+ auto it = g_usingClassMap.find (cd->qualifiedName ().str ());
2177+ if (it != g_usingClassMap.end ())
21462178 {
2147- newMmd->setDocumentation (md->documentation (),md->docFile (),md->docLine ());
2148- newMmd->setBriefDescription (md->briefDescription (),md->briefFile (),md->briefLine ());
2149- newMmd->setInbodyDocumentation (md->inbodyDocumentation (),md->inbodyFile (),md->inbodyLine ());
2179+ for (const auto ©Cd : it->second )
2180+ {
2181+ createUsingMemberImportForClass (root,copyCd,md,fileName,memName);
2182+ }
21502183 }
2151- newMmd->setDefinition (md->definition ());
2152- applyMemberOverrideOptions (root,newMmd);
2153- newMmd->addQualifiers (root->qualifiers );
2154- newMmd->setBitfields (md->bitfieldString ());
2155- newMmd->addSectionsToDefinition (root->anchors );
2156- newMmd->setBodySegment (md->getDefLine (),md->getStartBodyLine (),md->getEndBodyLine ());
2157- newMmd->setBodyDef (md->getBodyDef ());
2158- newMmd->setInitializer (md->initializer ());
2159- newMmd->setRequiresClause (md->requiresClause ());
2160- newMmd->setMaxInitLines (md->initializerLines ());
2161- newMmd->setMemberGroupId (root->mGrpId );
2162- newMmd->setMemberSpecifiers (md->getMemberSpecifiers ());
2163- newMmd->setVhdlSpecifiers (md->getVhdlSpecifiers ());
2164- newMmd->setLanguage (root->lang );
2165- newMmd->setId (root->id );
2166- MemberName *mn = Doxygen::memberNameLinkedMap->add (memName);
2167- mn->push_back (std::move (newMd));
21682184 }
21692185 }
21702186 }
@@ -2302,6 +2318,7 @@ static void findUsingDeclImports(const Entry *root)
23022318 Doxygen::classLinkedMap->add (copyFullName,
23032319 cd->deepCopy (copyFullName)));
23042320 AUTO_TRACE_ADD (" found class '{}' for name '{}' copy '{}' obj={}" ,cd->qualifiedName (),root->name ,copyFullName,(void *)ncdm);
2321+ g_usingClassMap[cd->qualifiedName ().str ()].push_back (ncdm);
23052322 if (ncdm)
23062323 {
23072324 if (nd) ncdm->moveTo (nd);
@@ -12745,6 +12762,7 @@ void parseInput()
1274512762 findObjCMethodDefinitions (root.get ());
1274612763 findMemberDocumentation (root.get ()); // may introduce new members !
1274712764 findUsingDeclImports (root.get ()); // may introduce new members !
12765+ g_usingClassMap.clear ();
1274812766 transferRelatedFunctionDocumentation ();
1274912767 transferFunctionDocumentation ();
1275012768 transferStaticInstanceInitializers ();
0 commit comments