diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/lupdate/cpp.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 6bd9108..2d5620e 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -260,6 +260,8 @@ private: bool qualifyOneCallbackOwn(const Namespace *ns, void *context) const; bool qualifyOneCallbackUsing(const Namespace *ns, void *context) const; bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved, QSet<HashStringList> *visitedUsings) const; + bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, NamespaceList *resolved) const; bool fullyQualify(const NamespaceList &namespaces, int nsCnt, const QList<HashString> &segments, bool isDeclaration, @@ -1036,15 +1038,16 @@ QStringList CppParser::stringListifySegments(const QList<HashString> &segments) } struct QualifyOneData { - QualifyOneData(const NamespaceList &ns, int nsc, const HashString &seg, NamespaceList *rslvd) - : namespaces(ns), nsCount(nsc), segment(seg), resolved(rslvd) + QualifyOneData(const NamespaceList &ns, int nsc, const HashString &seg, NamespaceList *rslvd, + QSet<HashStringList> *visited) + : namespaces(ns), nsCount(nsc), segment(seg), resolved(rslvd), visitedUsings(visited) {} const NamespaceList &namespaces; int nsCount; const HashString &segment; NamespaceList *resolved; - QSet<HashStringList> visitedUsings; + QSet<HashStringList> *visitedUsings; }; bool CppParser::qualifyOneCallbackOwn(const Namespace *ns, void *context) const @@ -1078,18 +1081,19 @@ bool CppParser::qualifyOneCallbackUsing(const Namespace *ns, void *context) cons { QualifyOneData *data = (QualifyOneData *)context; foreach (const HashStringList &use, ns->usings) - if (!data->visitedUsings.contains(use)) { - data->visitedUsings.insert(use); - if (qualifyOne(use.value(), use.value().count(), data->segment, data->resolved)) + if (!data->visitedUsings->contains(use)) { + data->visitedUsings->insert(use); + if (qualifyOne(use.value(), use.value().count(), data->segment, data->resolved, + data->visitedUsings)) return true; } return false; } bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, - NamespaceList *resolved) const + NamespaceList *resolved, QSet<HashStringList> *visitedUsings) const { - QualifyOneData data(namespaces, nsCnt, segment, resolved); + QualifyOneData data(namespaces, nsCnt, segment, resolved, visitedUsings); if (visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackOwn, &data)) return true; @@ -1097,6 +1101,14 @@ bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const Has return visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackUsing, &data); } +bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved) const +{ + QSet<HashStringList> visitedUsings; + + return qualifyOne(namespaces, nsCnt, segment, resolved, &visitedUsings); +} + bool CppParser::fullyQualify(const NamespaceList &namespaces, int nsCnt, const QList<HashString> &segments, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const |