Skip to content

Commit e965e5d

Browse files
committed
issue #8560: Regression: In Python/xml output, refid and qualified name of base compound not resolved under certain conditions (part 3)
1 parent 5ee697d commit e965e5d

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

src/doxygen.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static Definition *buildScopeFromQualifiedName(const QCString &name_,SrcLangExt
741741
else if (nd==0 && cd==0 && fullScope.find('<')==-1) // scope is not known and could be a namespace!
742742
{
743743
// introduce bogus namespace
744-
//printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),tagInfo);
744+
//printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),(void*)tagInfo);
745745
NamespaceDefMutable *newNd=
746746
toNamespaceDefMutable(
747747
Doxygen::namespaceLinkedMap->add(fullScope,
@@ -1976,15 +1976,16 @@ static void buildListOfUsingDecls(const Entry *root)
19761976
}
19771977

19781978

1979-
static void findUsingDeclarations(const Entry *root)
1979+
static void findUsingDeclarations(const Entry *root,bool filterPythonPackages)
19801980
{
19811981
if (root->section==Entry::USINGDECL_SEC &&
1982-
!(root->parent()->section&Entry::COMPOUND_MASK) // not a class/struct member
1982+
!(root->parent()->section&Entry::COMPOUND_MASK) && // not a class/struct member
1983+
(!filterPythonPackages || (root->lang==SrcLangExt_Python && root->fileName.endsWith("__init__.py")))
19831984
)
19841985
{
19851986
//printf("Found using declaration %s at line %d of %s inside section %x\n",
19861987
// qPrint(root->name),root->startLine,qPrint(root->fileName),
1987-
// rootNav->parent()->section());
1988+
// root->parent()->section);
19881989
if (!root->name.isEmpty())
19891990
{
19901991
ClassDefMutable *usingCd = 0;
@@ -2023,7 +2024,7 @@ static void findUsingDeclarations(const Entry *root)
20232024
usingCd = toClassDefMutable(Doxygen::hiddenClassLinkedMap->find(name)); // check if it is already hidden
20242025
}
20252026

2026-
//printf("%s -> %p\n",qPrint(root->name),usingCd);
2027+
//printf("%s -> %p\n",qPrint(root->name),(void*)usingCd);
20272028
if (usingCd==0) // definition not in the input => add an artificial class
20282029
{
20292030
Debug::print(Debug::Classes,0," New using class '%s' (sec=0x%08x)! #tArgLists=%d\n",
@@ -2059,7 +2060,7 @@ static void findUsingDeclarations(const Entry *root)
20592060
}
20602061
}
20612062
}
2062-
for (const auto &e : root->children()) findUsingDeclarations(e.get());
2063+
for (const auto &e : root->children()) findUsingDeclarations(e.get(),filterPythonPackages);
20632064
}
20642065

20652066
//----------------------------------------------------------------------
@@ -9935,6 +9936,13 @@ static void readDir(FileInfo *fi,
99359936
}
99369937
}
99379938
}
9939+
if (resultList)
9940+
{
9941+
// sort the resulting list to make the order platform independent.
9942+
std::sort(resultList->begin(),
9943+
resultList->end(),
9944+
[](const auto &f1,const auto &f2) { return qstricmp(f1.c_str(),f2.c_str())<0; });
9945+
}
99389946
}
99399947

99409948

@@ -11515,7 +11523,8 @@ void parseInput()
1151511523
g_s.begin("Searching for members imported via using declarations...\n");
1151611524
// this should be after buildTypedefList in order to properly import
1151711525
// used typedefs
11518-
findUsingDeclarations(root.get());
11526+
findUsingDeclarations(root.get(),TRUE); // do for python packages first
11527+
findUsingDeclarations(root.get(),FALSE); // then the rest
1151911528
g_s.end();
1152011529

1152111530
g_s.begin("Searching for included using directives...\n");

src/qcstring.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,19 @@ class QCString
398398
return m_rep.rfind(s.str(),0)==0; // looking "backward" starting and ending at index 0
399399
}
400400

401+
bool endsWith(const char *s) const
402+
{
403+
if (m_rep.empty() || s==0) return s==0;
404+
size_t l = strlen(s);
405+
return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s, l)==0;
406+
}
407+
408+
bool endsWith(const QCString &s) const
409+
{
410+
size_t l = s.length();
411+
return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s.str())==0;
412+
}
413+
401414
#define HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING 0
402415
#if HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING
403416
/** Converts the string to a plain C string */

0 commit comments

Comments
 (0)