Commit 1bdbbc60 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 705499 - Nested namespace causes incorrect display when referenced via .tag file

parent 2ed3d33a
...@@ -996,8 +996,9 @@ static Definition *findScope(Entry *root,int level=0) ...@@ -996,8 +996,9 @@ static Definition *findScope(Entry *root,int level=0)
* full qualified name \a name. Creates an artificial scope if the scope is * full qualified name \a name. Creates an artificial scope if the scope is
* not found and set the parent/child scope relation if the scope is found. * not found and set the parent/child scope relation if the scope is found.
*/ */
static Definition *buildScopeFromQualifiedName(const QCString name,int level,SrcLangExt lang) static Definition *buildScopeFromQualifiedName(const QCString name,int level,SrcLangExt lang,TagInfo *tagInfo)
{ {
//printf("buildScopeFromQualifiedName(%s) level=%d\n",name.data(),level);
int i=0; int i=0;
int p=0,l; int p=0,l;
Definition *prevScope=Doxygen::globalScope; Definition *prevScope=Doxygen::globalScope;
...@@ -1020,9 +1021,11 @@ static Definition *buildScopeFromQualifiedName(const QCString name,int level,Src ...@@ -1020,9 +1021,11 @@ static Definition *buildScopeFromQualifiedName(const QCString name,int level,Src
else if (nd==0 && cd==0) // scope is not known! else if (nd==0 && cd==0) // scope is not known!
{ {
// introduce bogus namespace // introduce bogus namespace
//printf("++ adding dummy namespace %s to %s\n",nsName.data(),prevScope->name().data()); //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",nsName.data(),prevScope->name().data(),tagInfo);
nd=new NamespaceDef( nd=new NamespaceDef(
"[generated]",1,1,fullScope); "[generated]",1,1,fullScope,
tagInfo?tagInfo->tagName:QCString(),
tagInfo?tagInfo->fileName:QCString());
nd->setLanguage(lang); nd->setLanguage(lang);
// add namespace to the list // add namespace to the list
...@@ -1109,7 +1112,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr ...@@ -1109,7 +1112,7 @@ static Definition *findScopeFromQualifiedName(Definition *startScope,const QCStr
// so use this instead. // so use this instead.
QCString fqn = QCString(ui.currentKey())+ QCString fqn = QCString(ui.currentKey())+
scope.right(scope.length()-p); scope.right(scope.length()-p);
resultScope = buildScopeFromQualifiedName(fqn,fqn.contains("::"),startScope->getLanguage()); resultScope = buildScopeFromQualifiedName(fqn,fqn.contains("::"),startScope->getLanguage(),0);
//printf("Creating scope from fqn=%s result %p\n",fqn.data(),resultScope); //printf("Creating scope from fqn=%s result %p\n",fqn.data(),resultScope);
if (resultScope) if (resultScope)
{ {
...@@ -1295,22 +1298,23 @@ static void addClassToContext(EntryNav *rootNav) ...@@ -1295,22 +1298,23 @@ static void addClassToContext(EntryNav *rootNav)
QCString tagName; QCString tagName;
QCString refFileName; QCString refFileName;
if (rootNav->tagInfo()) TagInfo *tagInfo = rootNav->tagInfo();
if (tagInfo)
{ {
tagName = rootNav->tagInfo()->tagName; tagName = tagInfo->tagName;
refFileName = rootNav->tagInfo()->fileName; refFileName = tagInfo->fileName;
int i; int i;
if ((i=fullName.find("::"))!=-1) if ((i=fullName.find("::"))!=-1)
// symbols imported via tag files may come without the parent scope, // symbols imported via tag files may come without the parent scope,
// so we artificially create it here // so we artificially create it here
{ {
buildScopeFromQualifiedName(fullName,fullName.contains("::"),root->lang); buildScopeFromQualifiedName(fullName,fullName.contains("::"),root->lang,tagInfo);
} }
} }
cd=new ClassDef(root->fileName,root->startLine,root->startColumn, cd=new ClassDef(root->fileName,root->startLine,root->startColumn,
fullName,sec,tagName,refFileName,TRUE,root->spec&Entry::Enum); fullName,sec,tagName,refFileName,TRUE,root->spec&Entry::Enum);
Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d\n", Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d tagInfo=%p\n",
fullName.data(),sec,root->tArgLists ? (int)root->tArgLists->count() : -1); fullName.data(),sec,root->tArgLists ? (int)root->tArgLists->count() : -1, tagInfo);
cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition cd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
cd->setBriefDescription(root->brief,root->briefFile,root->briefLine); cd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
cd->setLanguage(root->lang); cd->setLanguage(root->lang);
...@@ -1443,7 +1447,7 @@ static void resolveClassNestingRelations() ...@@ -1443,7 +1447,7 @@ static void resolveClassNestingRelations()
//printf("processing unresolved=%s, iteration=%d\n",cd->name().data(),iteration); //printf("processing unresolved=%s, iteration=%d\n",cd->name().data(),iteration);
/// create the scope artificially /// create the scope artificially
// anyway, so we can at least relate scopes properly. // anyway, so we can at least relate scopes properly.
Definition *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage()); Definition *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage(),0);
if (d!=cd && !cd->getDefFileName().isEmpty()) if (d!=cd && !cd->getDefFileName().isEmpty())
// avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; } // avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; }
// for this case doxygen assumes the exitance of a namespace N::N in which C is to be found! // for this case doxygen assumes the exitance of a namespace N::N in which C is to be found!
...@@ -1748,13 +1752,16 @@ static void buildNamespaceList(EntryNav *rootNav) ...@@ -1748,13 +1752,16 @@ static void buildNamespaceList(EntryNav *rootNav)
{ {
QCString tagName; QCString tagName;
QCString tagFileName; QCString tagFileName;
if (rootNav->tagInfo()) TagInfo *tagInfo = rootNav->tagInfo();
if (tagInfo)
{ {
tagName=rootNav->tagInfo()->tagName; tagName = tagInfo->tagName;
tagFileName=rootNav->tagInfo()->fileName; tagFileName = tagInfo->fileName;
} }
//printf("++ new namespace %s lang=%s\n",fullName.data(),langToString(root->lang).data()); //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data());
NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine,root->startColumn,fullName,tagName,tagFileName,root->type,root->spec&Entry::Published); NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine,
root->startColumn,fullName,tagName,tagFileName,
root->type,root->spec&Entry::Published);
nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition
nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->setBriefDescription(root->brief,root->briefFile,root->briefLine);
nd->addSectionsToDefinition(root->anchors); nd->addSectionsToDefinition(root->anchors);
...@@ -1786,7 +1793,7 @@ static void buildNamespaceList(EntryNav *rootNav) ...@@ -1786,7 +1793,7 @@ static void buildNamespaceList(EntryNav *rootNav)
if (d==0) // we didn't find anything, create the scope artificially if (d==0) // we didn't find anything, create the scope artificially
// anyway, so we can at least relate scopes properly. // anyway, so we can at least relate scopes properly.
{ {
Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage()); Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo);
d->addInnerCompound(nd); d->addInnerCompound(nd);
nd->setOuterScope(d); nd->setOuterScope(d);
// TODO: Due to the order in which the tag file is written // TODO: Due to the order in which the tag file is written
......
...@@ -8093,7 +8093,7 @@ bool namespaceHasVisibleChild(NamespaceDef *nd,bool includeClasses) ...@@ -8093,7 +8093,7 @@ bool namespaceHasVisibleChild(NamespaceDef *nd,bool includeClasses)
NamespaceDef *cnd; NamespaceDef *cnd;
for (cnli.toFirst();(cnd=cnli.current());++cnli) for (cnli.toFirst();(cnd=cnli.current());++cnli)
{ {
if (cnd->isLinkable() && cnd->localName().find('@')==-1) if (cnd->isLinkableInProject() && cnd->localName().find('@')==-1)
{ {
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment