diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 6f0f4fb3..e4de0c5f 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -1,6 +1,7 @@ package main import ( + "log" "regexp" "strings" ) @@ -17,6 +18,12 @@ type CppParameter struct { QtCppOriginalType *CppParameter // If we rewrote QStringList->QList, this field contains the original QStringList. Otherwise, it's blank } +func (p CppParameter) String() string { + return "Param(" + ifv(p.Const, "const ", "") + p.ParameterType + + ifv(p.Pointer, strings.Repeat("*", p.PointerCount), "") + ifv(p.ByRef, "&", "") + + ifv(p.Optional, "?", "") + " " + p.ParameterName + ")" +} + func (p *CppParameter) ApplyTypedef(matchedUnderlyingType CppParameter) { if p.QtCppOriginalType == nil { tmp := *p // Copy @@ -479,7 +486,8 @@ func (c *CppClass) VirtualMethods() []CppMethod { // m is copied by value. Mutate it applyTypedefs_Method(&m) // Same with astTransformBlocklist - if !blocklist_MethodAllowed(&m) { + if err := blocklist_MethodAllowed(&m); err != nil { + log.Printf("Blocking method %q(%v): %s", m.MethodName, m.Parameters, err) continue } diff --git a/cmd/genbindings/main.go b/cmd/genbindings/main.go index 308915cc..7293355d 100644 --- a/cmd/genbindings/main.go +++ b/cmd/genbindings/main.go @@ -329,6 +329,8 @@ func generateClangCaches(includeFiles []string, clangBin string, cflags []string } func main() { + // data/time flags make logs hard to compare across runs + log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime)) clang := flag.String("clang", "clang", "Custom path to clang") outDir := flag.String("outdir", "../../", "Output directory for generated gen_** files") extraLibsDir := flag.String("extralibs", "/usr/local/src/", "Base directory to find extra library checkouts") diff --git a/cmd/genbindings/transformblocklist.go b/cmd/genbindings/transformblocklist.go index 7d9294a3..4c1ea829 100644 --- a/cmd/genbindings/transformblocklist.go +++ b/cmd/genbindings/transformblocklist.go @@ -1,18 +1,20 @@ package main -func blocklist_MethodAllowed(m *CppMethod) bool { +import "log" + +func blocklist_MethodAllowed(m *CppMethod) error { if err := AllowType(m.ReturnType, true); err != nil { - return false + return err } for _, p := range m.Parameters { if err := AllowType(p, false); err != nil { - return false + return err } } // Nothing was blocked - return true + return nil } // astTransformBlocklist filters out methods using too-complex parameter types, @@ -49,7 +51,9 @@ func astTransformBlocklist(parsed *CppParsedHeader) { j := 0 nextCtor: for _, m := range c.Ctors { - if !blocklist_MethodAllowed(&m) { + if err := blocklist_MethodAllowed(&m); err != nil { + log.Printf("Blocking constructor %q(%v): %s", m.MethodName, m.Parameters, err) + continue nextCtor } @@ -64,7 +68,8 @@ func astTransformBlocklist(parsed *CppParsedHeader) { j = 0 nextMethod: for _, m := range c.Methods { - if !blocklist_MethodAllowed(&m) { + if err := blocklist_MethodAllowed(&m); err != nil { + log.Printf("Blocking method %q(%v): %s", m.MethodName, m.Parameters, err) continue nextMethod }