mirror of
https://github.com/mappu/miqt.git
synced 2025-01-20 21:50:38 +00:00
Log blocked methods
Blocked methods are the source of many gaps in the binding - in particular, they block qt_metacall/activate/etc that is necessary for implementing meta-object support. This change makes them visible in logs and also removes log timestamps so that logs from two runs easily can be diffed.
This commit is contained in:
parent
3d864cdb7b
commit
5cbbec5619
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
@ -17,6 +18,12 @@ type CppParameter struct {
|
||||
QtCppOriginalType *CppParameter // If we rewrote QStringList->QList<String>, 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
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user