diff --git a/cmd/genbindings/clang2il.go b/cmd/genbindings/clang2il.go index 1068090a..c2e2122f 100644 --- a/cmd/genbindings/clang2il.go +++ b/cmd/genbindings/clang2il.go @@ -283,6 +283,11 @@ nextMethod: mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject` + if mm.IsReceiverMethod() { + log.Printf("Skipping method %q using non-projectable receiver pattern parameters", mm.MethodName) + continue nextMethod + } + ret.Methods = append(ret.Methods, mm) default: diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 350578c9..4b8c5c29 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -81,6 +81,26 @@ func IsArgcArgv(params []CppParameter, pos int) bool { params[pos+1].ParameterType == "char **") } +func IsReceiverMethod(params []CppParameter, pos int) bool { + // Check if the arguments starting at position=pos are the receiver/member pattern. + // QMenu->addAction is the main example of this + return (len(params) > pos+1 && + params[pos].ParameterName == "receiver" && + params[pos].ParameterType == "QObject" && + params[pos].Pointer && + params[pos+1].ParameterName == "member" && + params[pos+1].ParameterType == "char" && + params[pos+1].Pointer) +} + +func (nm CppMethod) IsReceiverMethod() bool { + // Returns true if any of the parameters use the receiever-method pattern + for i := 0; i < len(nm.Parameters); i++ { + if IsReceiverMethod(nm.Parameters, i) { + return true + } + } + return false } func (nm CppMethod) SafeMethodName() string {