aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-04-27 12:44:10 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-04-28 10:55:56 +0200
commit075d8ad4660f05e6d2583ff1c05e9987ad624bfe (patch)
tree4c8dca98e7502180435f66a6904f30d4434989a7 /sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
parent9203d7f88071797d72ef057a68ab160a28160277 (diff)
shiboken6/clang: Record scope resolution of arguments/function return
Add a flag indicating whether a type was specified with a leading "::" (scope resolution). Such parameters previously caused the function to rejected due to the "::TypeName" not being found. The type resolution added for clang 16 strips these qualifiers though, so, the information needs to be stored. Task-number: PYSIDE-2288 Pick-to: 6.5 5.15 Change-Id: I27d27c94ec43bcc4cb3b79e6e9ce6706c749a1e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
index 874ba4945..dbea15f3d 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
@@ -8,6 +8,8 @@
#include <QtCore/QHashFunctions>
#include <QtCore/QProcess>
+#include <string_view>
+
bool operator==(const CXCursor &c1, const CXCursor &c2)
{
return c1.kind == c2.kind
@@ -130,6 +132,17 @@ QString getTypeName(const CXType &type)
return result;
}
+// Quick check for "::Type"
+bool hasScopeResolution(const CXType &type)
+{
+ CXString typeSpelling = clang_getTypeSpelling(type);
+ std::string_view spelling = clang_getCString(typeSpelling);
+ const bool result = spelling.compare(0, 2, "::") == 0
+ || spelling.find(" ::") != std::string::npos;
+ clang_disposeString(typeSpelling);
+ return result;
+}
+
// Resolve elaborated types occurring with clang 16
QString getResolvedTypeName(const CXType &type)
{