aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-21 09:59:19 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-09-21 19:18:28 +0200
commit26a50da482c12bbbfcc8cea46aecd9f0c8305ca6 (patch)
tree84f53a8df01856d03b6ba28c59af68e28bd98d9a /sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
parentea89199e0ec036957dd103bb55ff480979be8622 (diff)
shiboken2: Add namespace variables
They were ignored in the code parser. Take them into account and add a test. Task-number: PYSIDE-1224 Change-Id: I3baca95556129d695db294fdcc1ad92fc831672d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 6eb7e7b0c..73b1aca63 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -59,6 +59,11 @@ static inline bool isClassCursor(const CXCursor &c)
|| c.kind == CXCursor_ClassTemplatePartialSpecialization;
}
+static inline bool isClassOrNamespaceCursor(const CXCursor &c)
+{
+ return c.kind == CXCursor_Namespace || isClassCursor(c);
+}
+
static inline bool withinClassDeclaration(const CXCursor &cursor)
{
return isClassCursor(clang_getCursorLexicalParent(cursor));
@@ -972,7 +977,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
break;
case CXCursor_VarDecl:
// static class members are seen as CXCursor_VarDecl
- if (!d->m_currentClass.isNull() && isClassCursor(clang_getCursorSemanticParent(cursor))) {
+ if (isClassOrNamespaceCursor(clang_getCursorSemanticParent(cursor))) {
d->addField(cursor);
d->m_currentField->setStatic(true);
}