From bfbaeaf514a3a8508462ef37cbf5fd0a0c2615aa Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 26 Nov 2024 20:09:30 +1300 Subject: [PATCH] genbindings: add missing header includes for some container types --- cmd/genbindings/emitcabi.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/cmd/genbindings/emitcabi.go b/cmd/genbindings/emitcabi.go index 7b051134..14ba3532 100644 --- a/cmd/genbindings/emitcabi.go +++ b/cmd/genbindings/emitcabi.go @@ -557,24 +557,28 @@ func getReferencedTypes(src *CppParsedHeader) []string { foundTypes := map[string]struct{}{} - maybeAddType := func(p CppParameter) { + var maybeAddType func(p CppParameter) + maybeAddType = func(p CppParameter) { if p.QtClassType() { foundTypes[p.ParameterType] = struct{}{} } if t, ok := p.QListOf(); ok { foundTypes["QList"] = struct{}{} // FIXME or QVector? - if t.QtClassType() { - foundTypes[t.ParameterType] = struct{}{} - } + maybeAddType(t) } if kType, vType, ok := p.QMapOf(); ok { foundTypes["QMap"] = struct{}{} // FIXME or QHash? - if kType.QtClassType() { - foundTypes[kType.ParameterType] = struct{}{} - } - if vType.QtClassType() { - foundTypes[vType.ParameterType] = struct{}{} - } + maybeAddType(kType) + maybeAddType(vType) + } + if kType, vType, ok := p.QPairOf(); ok { + foundTypes["QPair"] = struct{}{} + maybeAddType(kType) + maybeAddType(vType) + } + if t, ok := p.QSetOf(); ok { + foundTypes["QSet"] = struct{}{} + maybeAddType(t) } } @@ -640,7 +644,7 @@ func cabiClassName(className string) string { func cabiPreventStructDeclaration(className string) bool { switch className { - case "QList", "QString", "QSet", "QMap", "QHash": + case "QList", "QString", "QSet", "QMap", "QHash", "QPair", "QVector", "QByteArray": return true // These types are reprojected default: return false