From 518befb98b3747dc6789ca6954ef4433cc9601fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:09:10 +0000 Subject: [PATCH 1/5] Initial plan From 3c614011bbf3ea8bdb9687da72cd6e517dddacd1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:19:48 +0000 Subject: [PATCH 2/5] fix(tool): emit CPython thread type with its definition Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com> --- cl/compile.go | 9 +++++++++ tool/_testc/python-3.14.8/cpython-pythread.go | 9 +++++++-- tool/_testc/python-3.14.8/pythread.go | 4 ---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cl/compile.go b/cl/compile.go index be978fc43..7aea9a450 100644 --- a/cl/compile.go +++ b/cl/compile.go @@ -23,6 +23,7 @@ import ( "github.com/goplus/gogen" "github.com/goplus/llcppg/clang" + lc "github.com/llarhub/clang-c" ) const ( @@ -286,6 +287,14 @@ func loadFiles(ctx *pkgCtx, files []Source, myPkgPath string, goFileOf func(head clang.VisitChildren(f.Cursor(), func(decl, parent clang.Cursor) clang.ChildVisitResult { if pkgOf != nil { at := clang.PresumedFile(decl.Location()) + switch decl.Kind { + case lc.Cursor_ClassDecl, lc.Cursor_StructDecl: + if decl.IsCursorDefinition() == 0 { + if definition := decl.Definition(); definition.IsNull() == 0 { + at = clang.PresumedFile(definition.Location()) + } + } + } if _, ok := lastSeen[at]; ok { return clang.Continue // already loaded } diff --git a/tool/_testc/python-3.14.8/cpython-pythread.go b/tool/_testc/python-3.14.8/cpython-pythread.go index 461353b06..2a58460e0 100644 --- a/tool/_testc/python-3.14.8/cpython-pythread.go +++ b/tool/_testc/python-3.14.8/cpython-pythread.go @@ -3,10 +3,15 @@ package py import ( - c1 "github.com/goplus/lib/c" + "github.com/goplus/lib/c" "github.com/goplus/lib/c/pthread" _ "unsafe" ) +type X_PyTssT struct { + X_isInitialized c.Int + X_key pthread.Key +} + //go:linkname PY_TIMEOUT_MAX C.PY_TIMEOUT_MAX -var PY_TIMEOUT_MAX c1.LongLong +var PY_TIMEOUT_MAX c.LongLong diff --git a/tool/_testc/python-3.14.8/pythread.go b/tool/_testc/python-3.14.8/pythread.go index 8ab5457d6..5691553b7 100644 --- a/tool/_testc/python-3.14.8/pythread.go +++ b/tool/_testc/python-3.14.8/pythread.go @@ -13,8 +13,4 @@ const ( ) type PyThreadTypeLock uintptr -type X_PyTssT struct { - X_isInitialized c1.Int - X_key pthread.Key -} type PyTssT = X_PyTssT From 63e7a278af96f8de785c8643b7c5ae8d53d6a200 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:21:23 +0000 Subject: [PATCH 3/5] Apply remaining changes Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com> --- tool/_testcpp/llvm-22.1.8-support/go.mod | 6 +----- tool/_testcpp/llvm-22.1.8-support/go.sum | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/tool/_testcpp/llvm-22.1.8-support/go.mod b/tool/_testcpp/llvm-22.1.8-support/go.mod index f01dc51a9..c10378236 100644 --- a/tool/_testcpp/llvm-22.1.8-support/go.mod +++ b/tool/_testcpp/llvm-22.1.8-support/go.mod @@ -2,10 +2,6 @@ module llvm go 1.23 -require ( - github.com/goplus/lib v0.5.9 - github.com/llarhub/libcxx v0.1.1 - github.com/llarhub/llvm-c v0.2.0 -) +require github.com/goplus/lib v0.5.9 require github.com/qiniu/x v1.18.3 // indirect diff --git a/tool/_testcpp/llvm-22.1.8-support/go.sum b/tool/_testcpp/llvm-22.1.8-support/go.sum index f279ba905..8b6af0496 100644 --- a/tool/_testcpp/llvm-22.1.8-support/go.sum +++ b/tool/_testcpp/llvm-22.1.8-support/go.sum @@ -1,8 +1,4 @@ github.com/goplus/lib v0.5.9 h1:XTUGEBqzrqMKmN7n+bCsLSq2MxK0pnP+Ea+gjcfBMjM= github.com/goplus/lib v0.5.9/go.mod h1:t4Cgs4QYbPzpI1RnYRA0iXWTgUFUuE09TrE2PvuU0VM= -github.com/llarhub/libcxx v0.1.1 h1:pq/qd3sgtDsima+rrgwOEHYGd/YnyePe6p86rHFD+Xs= -github.com/llarhub/libcxx v0.1.1/go.mod h1:5ANUOJMknbqPXhwxbXnLLA8NbHHyfYWUVQNCPiz04f8= -github.com/llarhub/llvm-c v0.2.0 h1:KXSm+1A9AjyxOcVTtZnlgvWDaWwBySMR27xSouaOaGg= -github.com/llarhub/llvm-c v0.2.0/go.mod h1:5Z6A6u+TghfHdA82zNAhYZHlUkzra7YdUJWc8q3IoJ4= github.com/qiniu/x v1.18.3 h1:trrBKBNszHGwV8XynnbddJr+A7Vca8/xlWP4F/Z4my8= github.com/qiniu/x v1.18.3/go.mod h1:Sx3Wy+0GI9OsX4a53mYj6A0o7mHJ94PUvraqGYb4EIs= From eea6704fc34e54814627e12cbe8e1dcbfc18ca51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:43:00 +0000 Subject: [PATCH 4/5] restore LLVM fixture dependencies Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com> --- go.mod | 6 +++++- go.sum | 4 ++++ tool/_testcpp/llvm-22.1.8-support/go.mod | 6 +++++- tool/_testcpp/llvm-22.1.8-support/go.sum | 4 ++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 9eecb1977..2214bba51 100644 --- a/go.mod +++ b/go.mod @@ -10,4 +10,8 @@ require ( github.com/qiniu/x v1.18.3 ) -require golang.org/x/mod v0.40.0 // indirect +require ( + github.com/llarhub/libcxx/c v0.1.1 // indirect + github.com/llarhub/llvm-c/c v0.2.0 // indirect + golang.org/x/mod v0.40.0 // indirect +) diff --git a/go.sum b/go.sum index d365298d7..01a324631 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,10 @@ github.com/goplus/mod v0.22.1 h1:3GQZqKlcQAiMpRUDAHvFryGYie+mT0JMjguEqOtIjkE= github.com/goplus/mod v0.22.1/go.mod h1:APrczG2FtFcQelU4vTq9xw+GrVs4sPPKnRfGidWBlXY= github.com/llarhub/clang-c v0.7.0 h1:YkO1FR1R1ScKJijF1PUVIpHnIC4uNgsSg/7CLzEBpFE= github.com/llarhub/clang-c v0.7.0/go.mod h1:sZhzXACY6REPetdPrGWcSvRmVkl9RgMHbGWHGeOTchI= +github.com/llarhub/libcxx/c v0.1.1 h1:sKT69wKJPjTgaokhmPM01Lk5PBYGKqRlQaxyl7weMwM= +github.com/llarhub/libcxx/c v0.1.1/go.mod h1:Tix1SwtfMlmDyFghXCjy2tTYW9GG3pvTY7MlYRSrZys= +github.com/llarhub/llvm-c/c v0.2.0 h1:OJTyQvaHVDKv+pM0wCMtj/Qs5pcJtTovOAA3dhUePoU= +github.com/llarhub/llvm-c/c v0.2.0/go.mod h1:vci7IHhvWBfxWRZzV6fBfiIWNMYJja5NNXqR7426XBo= github.com/qiniu/x v1.18.3 h1:trrBKBNszHGwV8XynnbddJr+A7Vca8/xlWP4F/Z4my8= github.com/qiniu/x v1.18.3/go.mod h1:Sx3Wy+0GI9OsX4a53mYj6A0o7mHJ94PUvraqGYb4EIs= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs= diff --git a/tool/_testcpp/llvm-22.1.8-support/go.mod b/tool/_testcpp/llvm-22.1.8-support/go.mod index c10378236..f01dc51a9 100644 --- a/tool/_testcpp/llvm-22.1.8-support/go.mod +++ b/tool/_testcpp/llvm-22.1.8-support/go.mod @@ -2,6 +2,10 @@ module llvm go 1.23 -require github.com/goplus/lib v0.5.9 +require ( + github.com/goplus/lib v0.5.9 + github.com/llarhub/libcxx v0.1.1 + github.com/llarhub/llvm-c v0.2.0 +) require github.com/qiniu/x v1.18.3 // indirect diff --git a/tool/_testcpp/llvm-22.1.8-support/go.sum b/tool/_testcpp/llvm-22.1.8-support/go.sum index 8b6af0496..f279ba905 100644 --- a/tool/_testcpp/llvm-22.1.8-support/go.sum +++ b/tool/_testcpp/llvm-22.1.8-support/go.sum @@ -1,4 +1,8 @@ github.com/goplus/lib v0.5.9 h1:XTUGEBqzrqMKmN7n+bCsLSq2MxK0pnP+Ea+gjcfBMjM= github.com/goplus/lib v0.5.9/go.mod h1:t4Cgs4QYbPzpI1RnYRA0iXWTgUFUuE09TrE2PvuU0VM= +github.com/llarhub/libcxx v0.1.1 h1:pq/qd3sgtDsima+rrgwOEHYGd/YnyePe6p86rHFD+Xs= +github.com/llarhub/libcxx v0.1.1/go.mod h1:5ANUOJMknbqPXhwxbXnLLA8NbHHyfYWUVQNCPiz04f8= +github.com/llarhub/llvm-c v0.2.0 h1:KXSm+1A9AjyxOcVTtZnlgvWDaWwBySMR27xSouaOaGg= +github.com/llarhub/llvm-c v0.2.0/go.mod h1:5Z6A6u+TghfHdA82zNAhYZHlUkzra7YdUJWc8q3IoJ4= github.com/qiniu/x v1.18.3 h1:trrBKBNszHGwV8XynnbddJr+A7Vca8/xlWP4F/Z4my8= github.com/qiniu/x v1.18.3/go.mod h1:Sx3Wy+0GI9OsX4a53mYj6A0o7mHJ94PUvraqGYb4EIs= From 9b67a2e16089b8e17955bc37805e6e8b580999b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 5 Oct 2026 08:43:25 +0000 Subject: [PATCH 5/5] remove installer-generated module changes Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com> --- go.mod | 6 +----- go.sum | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 2214bba51..9eecb1977 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,4 @@ require ( github.com/qiniu/x v1.18.3 ) -require ( - github.com/llarhub/libcxx/c v0.1.1 // indirect - github.com/llarhub/llvm-c/c v0.2.0 // indirect - golang.org/x/mod v0.40.0 // indirect -) +require golang.org/x/mod v0.40.0 // indirect diff --git a/go.sum b/go.sum index 01a324631..d365298d7 100644 --- a/go.sum +++ b/go.sum @@ -6,10 +6,6 @@ github.com/goplus/mod v0.22.1 h1:3GQZqKlcQAiMpRUDAHvFryGYie+mT0JMjguEqOtIjkE= github.com/goplus/mod v0.22.1/go.mod h1:APrczG2FtFcQelU4vTq9xw+GrVs4sPPKnRfGidWBlXY= github.com/llarhub/clang-c v0.7.0 h1:YkO1FR1R1ScKJijF1PUVIpHnIC4uNgsSg/7CLzEBpFE= github.com/llarhub/clang-c v0.7.0/go.mod h1:sZhzXACY6REPetdPrGWcSvRmVkl9RgMHbGWHGeOTchI= -github.com/llarhub/libcxx/c v0.1.1 h1:sKT69wKJPjTgaokhmPM01Lk5PBYGKqRlQaxyl7weMwM= -github.com/llarhub/libcxx/c v0.1.1/go.mod h1:Tix1SwtfMlmDyFghXCjy2tTYW9GG3pvTY7MlYRSrZys= -github.com/llarhub/llvm-c/c v0.2.0 h1:OJTyQvaHVDKv+pM0wCMtj/Qs5pcJtTovOAA3dhUePoU= -github.com/llarhub/llvm-c/c v0.2.0/go.mod h1:vci7IHhvWBfxWRZzV6fBfiIWNMYJja5NNXqR7426XBo= github.com/qiniu/x v1.18.3 h1:trrBKBNszHGwV8XynnbddJr+A7Vca8/xlWP4F/Z4my8= github.com/qiniu/x v1.18.3/go.mod h1:Sx3Wy+0GI9OsX4a53mYj6A0o7mHJ94PUvraqGYb4EIs= golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=