summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-05-23 12:19:31 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-05-23 12:19:31 (GMT)
commite965e5da00bce6076d7009e4a48acee76fc84a7c (patch)
tree7d359e095ae2413b2e36b8d9dc5cd34400b971cd
parent5ee697da531e020e5f0354f22ef2b929cce7c823 (diff)
downloadDoxygen-e965e5da00bce6076d7009e4a48acee76fc84a7c.zip
Doxygen-e965e5da00bce6076d7009e4a48acee76fc84a7c.tar.gz
Doxygen-e965e5da00bce6076d7009e4a48acee76fc84a7c.tar.bz2
issue #8560: Regression: In Python/xml output, refid and qualified name of base compound not resolved under certain conditions (part 3)
-rw-r--r--src/doxygen.cpp23
-rw-r--r--src/qcstring.h13
2 files changed, 29 insertions, 7 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index e4ec017..9e2f737 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -741,7 +741,7 @@ static Definition *buildScopeFromQualifiedName(const QCString &name_,SrcLangExt
else if (nd==0 && cd==0 && fullScope.find('<')==-1) // scope is not known and could be a namespace!
{
// introduce bogus namespace
- //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),tagInfo);
+ //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",qPrint(nsName),qPrint(prevScope->name()),(void*)tagInfo);
NamespaceDefMutable *newNd=
toNamespaceDefMutable(
Doxygen::namespaceLinkedMap->add(fullScope,
@@ -1976,15 +1976,16 @@ static void buildListOfUsingDecls(const Entry *root)
}
-static void findUsingDeclarations(const Entry *root)
+static void findUsingDeclarations(const Entry *root,bool filterPythonPackages)
{
if (root->section==Entry::USINGDECL_SEC &&
- !(root->parent()->section&Entry::COMPOUND_MASK) // not a class/struct member
+ !(root->parent()->section&Entry::COMPOUND_MASK) && // not a class/struct member
+ (!filterPythonPackages || (root->lang==SrcLangExt_Python && root->fileName.endsWith("__init__.py")))
)
{
//printf("Found using declaration %s at line %d of %s inside section %x\n",
// qPrint(root->name),root->startLine,qPrint(root->fileName),
- // rootNav->parent()->section());
+ // root->parent()->section);
if (!root->name.isEmpty())
{
ClassDefMutable *usingCd = 0;
@@ -2023,7 +2024,7 @@ static void findUsingDeclarations(const Entry *root)
usingCd = toClassDefMutable(Doxygen::hiddenClassLinkedMap->find(name)); // check if it is already hidden
}
- //printf("%s -> %p\n",qPrint(root->name),usingCd);
+ //printf("%s -> %p\n",qPrint(root->name),(void*)usingCd);
if (usingCd==0) // definition not in the input => add an artificial class
{
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)
}
}
}
- for (const auto &e : root->children()) findUsingDeclarations(e.get());
+ for (const auto &e : root->children()) findUsingDeclarations(e.get(),filterPythonPackages);
}
//----------------------------------------------------------------------
@@ -9935,6 +9936,13 @@ static void readDir(FileInfo *fi,
}
}
}
+ if (resultList)
+ {
+ // sort the resulting list to make the order platform independent.
+ std::sort(resultList->begin(),
+ resultList->end(),
+ [](const auto &f1,const auto &f2) { return qstricmp(f1.c_str(),f2.c_str())<0; });
+ }
}
@@ -11515,7 +11523,8 @@ void parseInput()
g_s.begin("Searching for members imported via using declarations...\n");
// this should be after buildTypedefList in order to properly import
// used typedefs
- findUsingDeclarations(root.get());
+ findUsingDeclarations(root.get(),TRUE); // do for python packages first
+ findUsingDeclarations(root.get(),FALSE); // then the rest
g_s.end();
g_s.begin("Searching for included using directives...\n");
diff --git a/src/qcstring.h b/src/qcstring.h
index ba5ac95..0b23071 100644
--- a/src/qcstring.h
+++ b/src/qcstring.h
@@ -398,6 +398,19 @@ class QCString
return m_rep.rfind(s.str(),0)==0; // looking "backward" starting and ending at index 0
}
+ bool endsWith(const char *s) const
+ {
+ if (m_rep.empty() || s==0) return s==0;
+ size_t l = strlen(s);
+ return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s, l)==0;
+ }
+
+ bool endsWith(const QCString &s) const
+ {
+ size_t l = s.length();
+ return m_rep.length()>=l && m_rep.compare(m_rep.length()-l, l, s.str())==0;
+ }
+
#define HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING 0
#if HAS_IMPLICIT_CAST_TO_PLAIN_C_STRING
/** Converts the string to a plain C string */