From ab9c015501af4ea11a76be483ade0835eb5440b3 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 10 Aug 2024 14:04:52 +1200 Subject: [PATCH] genbindings: minor compatibility improvements for qwidget.h --- cmd/genbindings/clang2il.go | 11 +++++++++++ cmd/genbindings/emitgo.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/genbindings/clang2il.go b/cmd/genbindings/clang2il.go index b3d0aabb..29564ee2 100644 --- a/cmd/genbindings/clang2il.go +++ b/cmd/genbindings/clang2il.go @@ -58,6 +58,13 @@ func parseHeader(inner []interface{}) (*CppParsedHeader, error) { case "NamespaceDecl": // ignore + case "FunctionDecl": + // TODO + + case "CXXMethodDecl": + // A C++ class method implementation directly in the header + // Skip over these + default: return nil, fmt.Errorf("missing handling for clang ast node type %q", kind) } @@ -306,6 +313,10 @@ func parseTypeString(typeString string) (CppParameter, []CppParameter, error) { return CppParameter{}, nil, ErrTooComplex } + if strings.Contains(typeString, `&&`) { // TODO Rvalue references + return CppParameter{}, nil, ErrTooComplex + } + // Cut to exterior-most (, ) pair opos := strings.Index(typeString, `(`) epos := strings.LastIndex(typeString, `)`) diff --git a/cmd/genbindings/emitgo.go b/cmd/genbindings/emitgo.go index be424319..58dd9043 100644 --- a/cmd/genbindings/emitgo.go +++ b/cmd/genbindings/emitgo.go @@ -214,7 +214,7 @@ import "C" formattedSrc, err := format.Source([]byte(goSrc)) if err != nil { log.Printf("gofmt failure: %v", err) - formattedSrc = []byte(ret.String()) + formattedSrc = []byte(goSrc) } return string(formattedSrc), nil