aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
index dbea15f3d..aafa79cca 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
@@ -113,7 +113,7 @@ static inline bool isBuiltinType(CXTypeKind kind)
}
// Resolve elaborated types occurring with clang 16
-static CXType resolveType(const CXType &type)
+static CXType resolveElaboratedType(const CXType &type)
{
if (!isBuiltinType(type.kind)) {
CXCursor decl = clang_getTypeDeclaration(type);
@@ -124,6 +124,26 @@ static CXType resolveType(const CXType &type)
return type;
}
+// Resolve typedefs
+static CXType resolveTypedef(const CXType &type)
+{
+ auto result = type;
+ while (result.kind == CXType_Typedef) {
+ auto decl = clang_getTypeDeclaration(result);
+ auto resolved = clang_getTypedefDeclUnderlyingType(decl);
+ if (resolved.kind == CXType_Invalid)
+ break;
+ result = resolved;
+ }
+ return result;
+}
+
+// Fully resolve a type from elaborated & typedefs
+CXType fullyResolveType(const CXType &type)
+{
+ return resolveTypedef(resolveElaboratedType(type));
+}
+
QString getTypeName(const CXType &type)
{
CXString typeSpelling = clang_getTypeSpelling(type);
@@ -146,7 +166,7 @@ bool hasScopeResolution(const CXType &type)
// Resolve elaborated types occurring with clang 16
QString getResolvedTypeName(const CXType &type)
{
- return getTypeName(resolveType(type));
+ return getTypeName(resolveElaboratedType(type));
}
Diagnostic::Diagnostic(const QString &m, const CXCursor &c, CXDiagnosticSeverity s)