Compare commits

..

1149 Commits

Author SHA1 Message Date
xushiwei
9203c366e7 Merge pull request #1121 from visualfc/closure
fix reflect.pointer  for closure; fix runtime unsafe.pointer ptrBytes
2025-05-17 01:19:40 +08:00
xushiwei
11a8af1db2 Merge pull request #1122 from visualfc/syscall
runtime/internal/clite/syscall: fix init
2025-05-17 01:19:04 +08:00
visualfc
c8fb7eafa0 runtime/internal/clite/os: fix stat for macOS 2025-05-16 20:36:43 +08:00
visualfc
ffc1f712a3 runtime/internal/clite/syscall: fix init 2025-05-16 16:29:31 +08:00
visualfc
cfc8687851 lib/reflect: fix closure pointer 2025-05-16 12:00:59 +08:00
visualfc
953699b2fd internal/runtime: fix abi.UnsafePointer PtrBytes 2025-05-16 12:00:59 +08:00
xushiwei
9a16fff27e Merge pull request #1118 from tsingbx/llgo.buildflag
fix gop run . flag provided but not defined: -ldflags
2025-05-16 11:21:24 +08:00
xushiwei
ac0d104231 Merge pull request #1117 from visualfc/bound
cl: funcName check $bound
2025-05-16 10:59:25 +08:00
xushiwei
881efea006 Merge pull request #1119 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.18.1
build(deps): bump github.com/goplus/gogen from 1.18.0 to 1.18.1
2025-05-16 10:47:17 +08:00
dependabot[bot]
f6a380d293 build(deps): bump github.com/goplus/gogen from 1.18.0 to 1.18.1
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.18.0 to 1.18.1.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.18.0...v1.18.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.18.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-16 00:57:11 +00:00
tsingbx
a971b93994 fix gop run . flag provided but not defined: -ldflags 2025-05-16 00:44:37 +08:00
visualfc
c4f0dd124d cl: funcName check $bound 2025-05-15 21:12:18 +08:00
xushiwei
93b9b7d44c Merge pull request #1112 from goplus/dependabot/go_modules/github.com/qiniu/x-1.14.6
build(deps): bump github.com/qiniu/x from 1.14.0 to 1.14.6
2025-05-13 11:03:01 +08:00
dependabot[bot]
7552bfe39b build(deps): bump github.com/qiniu/x from 1.14.0 to 1.14.6
Bumps [github.com/qiniu/x](https://github.com/qiniu/x) from 1.14.0 to 1.14.6.
- [Release notes](https://github.com/qiniu/x/releases)
- [Commits](https://github.com/qiniu/x/compare/v1.14.0...v1.14.6)

---
updated-dependencies:
- dependency-name: github.com/qiniu/x
  dependency-version: 1.14.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-13 00:30:42 +00:00
xushiwei
2601faaff2 Merge pull request #1111 from goplus/dependabot/go_modules/github.com/goplus/cobra-1.9.12
build(deps): bump github.com/goplus/cobra from 1.9.11 to 1.9.12
2025-05-13 01:02:28 +08:00
dependabot[bot]
cb2e28d086 build(deps): bump github.com/goplus/cobra from 1.9.11 to 1.9.12
Bumps [github.com/goplus/cobra](https://github.com/goplus/cobra) from 1.9.11 to 1.9.12.
- [Release notes](https://github.com/goplus/cobra/releases)
- [Commits](https://github.com/goplus/cobra/compare/v1.9.11...v1.9.12)

---
updated-dependencies:
- dependency-name: github.com/goplus/cobra
  dependency-version: 1.9.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 00:59:41 +00:00
xushiwei
337877313a Merge pull request #1109 from xushiwei/q
rm xtool/{cppkg,cpgithubpkg}
2025-05-12 04:04:08 +08:00
xushiwei
1693942cee rm xtool/{cppkg,cpgithubpkg} 2025-05-12 03:50:07 +08:00
xushiwei
867a1ce2f4 Merge pull request #1108 from xushiwei/q
github api: release/asset id => int64
2025-05-12 02:28:34 +08:00
xushiwei
26b997537f getAppManager: rm notFoundMgs 2025-05-12 02:26:46 +08:00
xushiwei
19056b8a19 Merge remote-tracking branch 'gop/main' into q 2025-05-12 02:25:26 +08:00
xushiwei
10d603b377 Merge pull request #1104 from luoliwoshang/unix/install
xtool/cppkg:install in linux
2025-05-12 02:24:36 +08:00
xushiwei
3f41c313ad github api: release/asset id => int64 2025-05-11 20:55:59 +08:00
xushiwei
d440949c1d Merge pull request #1103 from tsingbx/llgo.usage
add usage for llgo
2025-05-10 11:29:30 +08:00
xushiwei
64314dc6cf Merge pull request #1107 from xushiwei/q
github api: EnumTags
2025-05-10 11:28:17 +08:00
xushiwei
decb9d7f11 github api: EnumTags 2025-05-10 11:27:50 +08:00
tsingbx
975b0b74ee panic err => return 2025-05-10 07:15:48 +08:00
xushiwei
9aa7807b02 Merge pull request #1106 from xushiwei/q
xtool/cppkg: ConanStderr
2025-05-09 23:36:12 +08:00
xushiwei
337c6cfa25 xtool/cppkg: ConanStderr 2025-05-09 23:31:31 +08:00
luoliwoshang
f09a423ee7 xtool/cppkg:tips when app managers not found 2025-05-09 14:25:44 +08:00
tsingbx
3bf28f52c4 add usage for llgo 2025-05-09 12:59:11 +08:00
luoliwoshang
f794592f42 xtool/cppkg install by pipx 2025-05-09 10:20:05 +08:00
xushiwei
98bd05b47b Merge pull request #1102 from xushiwei/q
cmd/llog: main_cmd.gox => main_app.gox
2025-05-08 09:41:20 +08:00
xushiwei
3edbde0839 cmd/llog: main_cmd.gox => main_app.gox 2025-05-08 09:34:01 +08:00
xushiwei
a2d92eac0b Merge pull request #1100 from goplus/dependabot/go_modules/github.com/goplus/cobra-1.9.11
build(deps): bump github.com/goplus/cobra from 1.9.9 to 1.9.11
2025-05-08 09:31:35 +08:00
xushiwei
eb47c545ec Merge pull request #1101 from xushiwei/q
xtool/cppkg: InstallPkg allows to customize cacheDir
2025-05-08 09:30:06 +08:00
xushiwei
c858f79449 xtool/cppkg: InstallPkg allows to customize cacheDir 2025-05-08 09:26:45 +08:00
dependabot[bot]
27f6efbdec build(deps): bump github.com/goplus/cobra from 1.9.9 to 1.9.11
Bumps [github.com/goplus/cobra](https://github.com/goplus/cobra) from 1.9.9 to 1.9.11.
- [Release notes](https://github.com/goplus/cobra/releases)
- [Commits](https://github.com/goplus/cobra/compare/v1.9.9...v1.9.11)

---
updated-dependencies:
- dependency-name: github.com/goplus/cobra
  dependency-version: 1.9.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-08 00:59:40 +00:00
xushiwei
bba7494ffd Merge pull request #1099 from xushiwei/q
xtool/cppkg: InstallPkg KnownLatestVersion
2025-05-08 08:17:20 +08:00
xushiwei
0f79cad5a7 xtool/cppkg: InstallPkg KnownLatestVersion 2025-05-08 08:10:56 +08:00
xushiwei
9e7bacbe23 Merge pull request #1098 from xushiwei/q
cmd/llgo: main cmd
2025-05-07 22:31:39 +08:00
xushiwei
2301a4834d cmd/llog: main cmd 2025-05-07 22:30:54 +08:00
xushiwei
40e0f58079 Merge pull request #1094 from goplus/dependabot/go_modules/github.com/goplus/cobra-1.9.9
build(deps): bump github.com/goplus/cobra from 1.9.8 to 1.9.9
2025-05-07 03:40:46 +08:00
xushiwei
c23fb144cf Merge branch 'main' into dependabot/go_modules/github.com/goplus/cobra-1.9.9 2025-05-07 03:33:04 +08:00
xushiwei
caac681ac3 Merge pull request #1095 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.18.0
build(deps): bump github.com/goplus/gogen from 1.17.3 to 1.18.0
2025-05-07 03:32:18 +08:00
xushiwei
9ba3b3ef8f Merge pull request #1097 from goplus/dependabot/go_modules/github.com/goplus/mod-0.16.1
build(deps): bump github.com/goplus/mod from 0.16.0 to 0.16.1
2025-05-07 03:24:15 +08:00
dependabot[bot]
d7e523948b build(deps): bump github.com/goplus/mod from 0.16.0 to 0.16.1
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.16.0 to 0.16.1.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.16.0...v0.16.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-version: 0.16.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-06 15:00:31 +00:00
dependabot[bot]
10a75138d1 build(deps): bump github.com/goplus/gogen from 1.17.3 to 1.18.0
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.17.3 to 1.18.0.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.17.3...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-06 15:00:25 +00:00
dependabot[bot]
d48b19c866 build(deps): bump github.com/goplus/cobra from 1.9.8 to 1.9.9
Bumps [github.com/goplus/cobra](https://github.com/goplus/cobra) from 1.9.8 to 1.9.9.
- [Release notes](https://github.com/goplus/cobra/releases)
- [Commits](https://github.com/goplus/cobra/compare/v1.9.8...v1.9.9)

---
updated-dependencies:
- dependency-name: github.com/goplus/cobra
  dependency-version: 1.9.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-06 15:00:21 +00:00
xushiwei
1fdcb55eba Merge pull request #1080 from xushiwei/q
xtool/cpgithubpkg
2025-05-06 09:44:05 +08:00
xushiwei
16cec9f045 merge upstream 2025-05-06 09:41:19 +08:00
xushiwei
438b0bd1b0 Merge pull request #1091 from visualfc/go123
go.mod go1.23
2025-05-06 08:32:06 +08:00
visualfc
e8a91696d6 go.mod go1.23 2025-05-05 10:19:23 +08:00
xushiwei
8882c31eb4 Merge pull request #1090 from xushiwei/cppkg
xtool/cppkg: support latest version
2025-05-04 17:40:07 +08:00
xushiwei
8455ee8226 xtool/cppkg: support latest version 2025-05-04 17:34:02 +08:00
xushiwei
3f74aded8a Merge pull request #1089 from xushiwei/cppkg
llgo cppkg: remove unused import
2025-05-04 16:44:38 +08:00
xushiwei
2e19c2013c llgo cppkg: remove unused import 2025-05-04 16:43:07 +08:00
xushiwei
1edaa2d09b Merge pull request #1088 from xushiwei/cppkg
cmd: llgo cppkg install
2025-05-04 16:06:20 +08:00
xushiwei
beee018287 cmd: llgo cppkg install 2025-05-04 16:01:58 +08:00
xushiwei
34266ea59d Merge pull request #1087 from xushiwei/cppkg
llgo.next => llgo
2025-05-04 15:39:50 +08:00
xushiwei
f26127ce98 llgo.next => llgo 2025-05-04 15:34:32 +08:00
xushiwei
ccf321d178 Merge pull request #1086 from xushiwei/cppkg
llgo.next: support build, run, cmptest
2025-05-04 15:23:40 +08:00
xushiwei
355721c47a llgo.next: support build, run, cmptest 2025-05-04 15:18:49 +08:00
xushiwei
d400663e5d Merge pull request #1085 from xushiwei/cppkg
cmd: llgo.next
2025-05-04 14:14:10 +08:00
xushiwei
2203be945a codecov: ignore llgo.next 2025-05-04 14:10:43 +08:00
xushiwei
b9a2bf4b42 fmt: ignore gop_autogen.go 2025-05-04 14:08:43 +08:00
xushiwei
cc08195cf2 cmd: llgo.next 2025-05-04 14:04:43 +08:00
xushiwei
50c40a7828 Merge pull request #1084 from xushiwei/cppkg
go mod tidy
2025-05-04 10:41:57 +08:00
xushiwei
158be3f949 go mod tidy 2025-05-04 10:28:24 +08:00
xushiwei
0f87c322ca Merge pull request #1082 from xushiwei/cppkg
xtool/cppkg: Main => Install
2025-05-04 00:15:26 +08:00
xushiwei
d5dd19b64c xtool/cppkg: Main => Install 2025-05-04 00:08:20 +08:00
xushiwei
3ac9055493 xtool/cpgithubpkg 2025-05-03 23:30:29 +08:00
xushiwei
3032d730b7 Merge pull request #1079 from xushiwei/q
package: xtool/cppkg
2025-05-03 23:22:55 +08:00
xushiwei
e93e7126b6 package: xtool/cppkg 2025-05-03 23:13:10 +08:00
xushiwei
9bcf41d28f Merge pull request #1078 from xushiwei/q
github api: release, tag, commit
2025-05-03 22:58:01 +08:00
xushiwei
604ce47d5e github api: release, tag, commit 2025-05-03 22:50:04 +08:00
xushiwei
e1ebe150d4 Merge pull request #1077 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.17.3
build(deps): bump github.com/goplus/gogen from 1.17.2 to 1.17.3
2025-04-28 08:28:56 +08:00
dependabot[bot]
ae992737e8 build(deps): bump github.com/goplus/gogen from 1.17.2 to 1.17.3
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.17.2 to 1.17.3.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.17.2...v1.17.3)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.17.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-28 00:15:49 +00:00
xushiwei
c59d609eb8 Merge pull request #1076 from xushiwei/t
_cmptest: mathbigdemo
2025-04-28 01:18:10 +08:00
xushiwei
9f26d12a3e _cmptest: mathbigdemo 2025-04-28 01:03:13 +08:00
xushiwei
9102577eba Merge pull request #1075 from xushiwei/t
go/parser demo
2025-04-28 00:46:00 +08:00
xushiwei
f0fcfde22b README: go/parser 2025-04-28 00:37:11 +08:00
xushiwei
d9d813db56 go/parser demo 2025-04-28 00:35:45 +08:00
xushiwei
a8808855ae Merge pull request #1074 from visualfc/fix_amd64
runtime/internal/clite/pthread/sync/sync_darwin_amd64: PthreadMutexSize = 64
2025-04-27 16:20:35 +08:00
visualfc
5583f9418a runtime/internal/clite/pthread/sync/sync_darwin_amd64: PthreadMutexSize = 64 2025-04-27 12:40:32 +08:00
xushiwei
7369ffd2aa Merge pull request #1073 from xushiwei/t
_demo: hello
2025-04-26 23:04:06 +08:00
xushiwei
ab15f30b13 _demo: hello 2025-04-26 22:55:46 +08:00
xushiwei
8bff07d66b Merge pull request #1072 from xushiwei/t
fix #965 Dead loop in cl/blocks.Infos
2025-04-26 22:38:45 +08:00
xushiwei
e2e2cb38be fix #965 2025-04-26 22:23:36 +08:00
xushiwei
10d84a6a6b Merge pull request #1070 from goplus/dependabot/go_modules/github.com/goplus/mod-0.16.0
build(deps): bump github.com/goplus/mod from 0.15.1 to 0.16.0
2025-04-26 06:40:51 +08:00
dependabot[bot]
a4b4c1574b build(deps): bump github.com/goplus/mod from 0.15.1 to 0.16.0
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.15.1 to 0.16.0.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.15.1...v0.16.0)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-version: 0.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-25 22:33:17 +00:00
xushiwei
94bc39bdb2 Merge pull request #1071 from goplus/dependabot/go_modules/github.com/qiniu/x-1.13.19
build(deps): bump github.com/qiniu/x from 1.13.18 to 1.13.19
2025-04-26 06:32:13 +08:00
dependabot[bot]
7c93b37125 build(deps): bump github.com/qiniu/x from 1.13.18 to 1.13.19
Bumps [github.com/qiniu/x](https://github.com/qiniu/x) from 1.13.18 to 1.13.19.
- [Release notes](https://github.com/qiniu/x/releases)
- [Commits](https://github.com/qiniu/x/compare/v1.13.18...v1.13.19)

---
updated-dependencies:
- dependency-name: github.com/qiniu/x
  dependency-version: 1.13.19
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-22 00:11:24 +00:00
xushiwei
4371cc10bd Merge pull request #1068 from goplus/dependabot/go_modules/github.com/qiniu/x-1.13.18
build(deps): bump github.com/qiniu/x from 1.13.17 to 1.13.18
2025-04-22 00:55:37 +08:00
xushiwei
eaa2628934 Merge pull request #1069 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.17.2
build(deps): bump github.com/goplus/gogen from 1.17.1 to 1.17.2
2025-04-21 22:21:09 +08:00
dependabot[bot]
30e247186c build(deps): bump github.com/goplus/gogen from 1.17.1 to 1.17.2
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.17.1 to 1.17.2.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.17.1...v1.17.2)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.17.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 00:49:42 +00:00
dependabot[bot]
2714da8d98 build(deps): bump github.com/qiniu/x from 1.13.17 to 1.13.18
Bumps [github.com/qiniu/x](https://github.com/qiniu/x) from 1.13.17 to 1.13.18.
- [Release notes](https://github.com/qiniu/x/releases)
- [Commits](https://github.com/qiniu/x/compare/v1.13.17...v1.13.18)

---
updated-dependencies:
- dependency-name: github.com/qiniu/x
  dependency-version: 1.13.18
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 00:48:47 +00:00
xushiwei
0ef3a7ec25 Merge pull request #1067 from cpunion/llgo-env
Fix args parsing
2025-04-18 19:42:14 +08:00
Li Jie
489a0069aa extract common cmd flags 2025-04-18 13:12:05 +08:00
xushiwei
a257b7bdfa Merge pull request #1059 from cpunion/wasm-dev
Wasm dev
2025-04-18 08:55:20 +08:00
Li Jie
739cc66d0d test wasm with _demo/hello 2025-04-18 00:37:02 +08:00
Li Jie
28d944c6af remove unused wasm_import 2025-04-17 22:59:34 +08:00
Li Jie
19b98393a6 TODO: defer workaround, should remove after fix 2025-04-17 10:06:59 +08:00
Li Jie
5a13e7400e update outdated github.com/goplus/llgo/c references 2025-04-17 10:06:56 +08:00
Li Jie
a56129d675 blank syscall.SetNonblock on wasm 2025-04-17 09:58:52 +08:00
Li Jie
0d75bbace0 fix itab on 32bit 2025-04-17 09:58:52 +08:00
Li Jie
29ec4a7a0e allow config LLGO_WASM_RUNTIME with args 2025-04-17 09:58:52 +08:00
Li Jie
8b26c48d9b execute clang -v in verbose mode 2025-04-17 09:58:52 +08:00
Li Jie
ddd0535d30 split llfiles and ldflags and extract compileAndLinkLLFiles to prepare multi-phase build 2025-04-17 09:58:52 +08:00
xushiwei
adcd370c27 Merge pull request #1066 from goplus/dependabot/go_modules/github.com/goplus/mod-0.15.1
build(deps): bump github.com/goplus/mod from 0.13.17 to 0.15.1
2025-04-16 01:50:01 +08:00
dependabot[bot]
dbead0d725 build(deps): bump github.com/goplus/mod from 0.13.17 to 0.15.1
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.13.17 to 0.15.1.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.13.17...v0.15.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-version: 0.15.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 04:26:37 +00:00
xushiwei
207aea813b Merge pull request #1065 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.17.1
build(deps): bump github.com/goplus/gogen from 1.16.9 to 1.17.1
2025-04-14 12:25:03 +08:00
xushiwei
7a771154a7 Merge pull request #1063 from goplus/dependabot/go_modules/github.com/qiniu/x-1.13.17
build(deps): bump github.com/qiniu/x from 1.13.12 to 1.13.17
2025-04-14 12:24:38 +08:00
dependabot[bot]
18c6b9b404 build(deps): bump github.com/goplus/gogen from 1.16.9 to 1.17.1
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.9 to 1.17.1.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.9...v1.17.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-version: 1.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 00:40:41 +00:00
Li Jie
3110382d88 fix abi methods crash on wasm 2025-04-11 17:16:02 +08:00
Li Jie
9ee55896e3 update link args for wasm target 2025-04-11 16:28:48 +08:00
Li Jie
ad6f41f312 add LLGO_STDIO_NOBUF to toggle stdout/stderr buffer 2025-04-11 16:28:48 +08:00
Li Jie
8512395985 AllocCStr allocates on heap 2025-04-11 16:28:48 +08:00
Li Jie
7284042823 run wasm with iwasm 2025-04-11 16:28:47 +08:00
Li Jie
0ef683bba9 add LLGO_WASI_THREADS to toggle wasi threads support 2025-04-11 16:28:47 +08:00
Li Jie
d4bf66936a specify setjmp/longjmp function names on wasm 2025-04-11 16:28:47 +08:00
Li Jie
be4737461a make runtime compatible with wasm 2025-04-11 16:28:44 +08:00
dependabot[bot]
0d22b3be05 build(deps): bump github.com/qiniu/x from 1.13.12 to 1.13.17
Bumps [github.com/qiniu/x](https://github.com/qiniu/x) from 1.13.12 to 1.13.17.
- [Release notes](https://github.com/qiniu/x/releases)
- [Commits](https://github.com/qiniu/x/compare/v1.13.12...v1.13.17)

---
updated-dependencies:
- dependency-name: github.com/qiniu/x
  dependency-version: 1.13.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-11 00:33:04 +00:00
Li Jie
7c81d9293b blank ffi for wasm 2025-04-09 14:57:33 +08:00
Li Jie
d1dce65313 update link flags 2025-04-09 14:57:33 +08:00
Li Jie
641f9bbf7c select WASM runtime by LLGO_WASM_RUNTIME 2025-04-09 14:57:32 +08:00
xushiwei
be0e42cf82 Merge pull request #1057 from cpunion/cross-compiling
Cross compiling
2025-04-09 14:26:09 +08:00
Li Jie
3a883b8821 upgrade to github.com/goplus/lib v0.2.0 2025-04-08 19:32:26 +08:00
Li Jie
4bbc58d62d test cross compile on macos 2025-04-08 11:53:21 +08:00
Li Jie
5f4b09bede regenerate snapshot tests 2025-04-08 11:13:00 +08:00
Li Jie
f0ade21155 update docs and CI 2025-04-08 11:12:59 +08:00
Li Jie
f35063ee6e build: download and compile with wasi-sdk 2025-04-08 11:12:57 +08:00
Li Jie
e6c7627ee8 cross compilation 2025-04-08 10:46:14 +08:00
Li Jie
a85d937482 enable command tests 2025-04-08 09:38:00 +08:00
Li Jie
b17632a352 xtool: clang.Cmd supports Env/Verbose/Stdio, add CCFLAGS support 2025-04-08 09:25:49 +08:00
xushiwei
b11eb742cb Merge pull request #1055 from cpunion/fix-ll
fix remote install test
2025-04-03 18:16:09 +08:00
Li Jie
b63a7f64fd fix _readme tests 2025-04-03 17:35:45 +08:00
xushiwei
cafc438972 Merge pull request #1054 from cpunion/fix-ll
fix readme link and tests
2025-04-03 17:29:22 +08:00
Li Jie
33ef7f737b fix doc links 2025-04-03 17:08:13 +08:00
Li Jie
3e26685a44 fix _readme tests 2025-04-03 17:02:06 +08:00
xushiwei
6a306be480 Merge pull request #1052 from cpunion/fix-ll
mv llgo/{c,cpp,py,x} => lib/{c,cpp,py,x}
2025-04-03 16:56:37 +08:00
Li Jie
9defb6289b separate doc/_readme as a module 2025-04-03 16:44:44 +08:00
Li Jie
a47ad2886f fix broken links 2025-04-03 16:43:23 +08:00
Li Jie
c8d791f206 fix llgo test unit test 2025-04-03 16:32:46 +08:00
Li Jie
8c5f915569 update installation scripts and docs 2025-04-03 16:26:15 +08:00
Li Jie
ed366568b4 move out c/cpp/py 2025-04-03 16:26:11 +08:00
xushiwei
0a8a4eb6a6 Merge pull request #1050 from cpunion/llvm-19
Llvm 19
2025-04-03 11:55:32 +08:00
Li Jie
fdc6cf4838 ci: add -mmacosx-version-min=10.13 to goreleaser macos build 2025-04-03 01:00:53 +08:00
Li Jie
e52af0077b doc: brew link lld@19 2025-04-03 00:26:10 +08:00
Li Jie
847f544839 ci: hide sync progress 2025-04-02 23:28:13 +08:00
Li Jie
685d3202d0 ci: update goreleaser config 2025-04-02 21:49:11 +08:00
Li Jie
33a2580cc3 xtool: update llvm@19 env 2025-04-02 21:49:11 +08:00
Li Jie
a8da654597 ci: make doc verify continue on error 2025-04-02 21:06:07 +08:00
Li Jie
ae01a023ad cl: update snapshot tests 2025-04-02 20:13:02 +08:00
Li Jie
ec20af3c4d ci: upgrade to llvm 19 2025-04-02 20:12:41 +08:00
Li Jie
a6f1ad1c2c compiler: upgrade to llvm@v0.8.3 (llvm 19) 2025-04-02 20:07:52 +08:00
xushiwei
c3532f17de Merge pull request #1047 from visualfc/wasm32
wasm32
2025-04-01 23:32:21 +08:00
visualfc
86eac2f04d wasm32 2025-04-01 22:40:04 +08:00
xushiwei
3b9b71643c Merge pull request #1044 from visualfc/wasmsizes
compiler: check wasm sizes
2025-04-01 13:27:26 +08:00
visualfc
19417cdd52 compiler: check wasm sizes 2025-03-31 17:25:40 +08:00
xushiwei
a7c23e25d8 Merge pull request #1040 from goplus/dependabot/go_modules/compiler/github.com/goplus/gogen-1.16.9
build(deps): bump github.com/goplus/gogen from 1.16.8 to 1.16.9 in /compiler
2025-03-27 11:01:41 +08:00
dependabot[bot]
f96ab87536 build(deps): bump github.com/goplus/gogen in /compiler
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.8 to 1.16.9.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.8...v1.16.9)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-27 01:08:20 +00:00
xushiwei
d65d49f504 Merge pull request #1036 from cpunion/split-debug-and-symbols
Split debug and symbols toggle environment variables
2025-03-24 19:04:15 +08:00
Li Jie
8cd5924bf2 compiler: split LLGO_DEBUG into LLGO_DEBUG, LLGO_DBG_SYMBOLS, disableInline 2025-03-23 13:21:58 +08:00
xushiwei
9f38338c58 Merge pull request #1032 from cpunion/fix-linking
Remove LLVM runtime depencendy, better c toolchain integration
2025-03-20 15:47:43 +08:00
Li Jie
8c76436d81 ci: limit concurrency of doc links checker 2025-03-20 12:45:05 +08:00
Li Jie
0e71576265 build: pass CFLAGS and LDFLAGS to clang 2025-03-20 11:17:27 +08:00
Li Jie
71b34003ca debug: rollback unwind to don't depends llvm runtime, solve libunwind linking on homebrew linux in llgo formal 2025-03-19 14:32:32 +08:00
xushiwei
2c417d75a2 Merge pull request #1030 from cpunion/run-llgo-test
ci: run llgo test
2025-03-19 12:47:31 +08:00
Li Jie
74ededd8c8 ci: run llgo test ./... 2025-03-19 11:35:52 +08:00
Li Jie
a732fa237c test: reduce unnecessary pkgs compilation for llgo test 2025-03-19 11:35:51 +08:00
Li Jie
fd4c22308d ssa: removed unused ssa.Program.goStrs 2025-03-19 11:25:51 +08:00
Li Jie
d6f18894e6 test: add llgo build tag to compiler test cases 2025-03-19 11:25:50 +08:00
xushiwei
992d54693f Merge pull request #1029 from visualfc/gogen
update gogen v1.16.8
2025-03-19 08:51:12 +08:00
visualfc
9be1bd0775 update gogen 2025-03-19 08:32:00 +08:00
xushiwei
29cc689abd Merge pull request #1023 from cpunion/toggle-rpath-change
link: don't run install_name_tool -change by default
2025-03-13 23:15:47 +08:00
xushiwei
39d28e507d Merge pull request #1022 from goplus/dependabot/go_modules/compiler/github.com/goplus/gogen-1.16.7
build(deps): bump github.com/goplus/gogen from 1.16.6 to 1.16.7 in /compiler
2025-03-13 23:12:38 +08:00
Li Jie
eacb5bc6f8 link: don't run install_name_tool -change by default 2025-03-13 19:55:48 +08:00
dependabot[bot]
19658454bd build(deps): bump github.com/goplus/gogen in /compiler
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.6 to 1.16.7.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.6...v1.16.7)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 00:17:09 +00:00
xushiwei
02e3a6ae8b Merge pull request #1018 from cpunion/fix-libunwind
runtime: fix libunwind to compatible with homebrew linux
2025-03-04 19:46:35 +08:00
Li Jie
77376087db ci: optimize model download to avoid Huggingface blocking
Download the LLaMA model as a separate job and share it as an artifact to prevent
repeated downloads from Huggingface which could lead to rate limiting or blocking.

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-03-04 11:20:16 +08:00
Li Jie
52a77f9efb runtime: fix libunwind to compatible with homebrew linux 2025-03-04 10:52:18 +08:00
xushiwei
d483b13107 Merge pull request #1011 from visualfc/deferargs2
support defer args
2025-02-28 18:14:16 +08:00
xushiwei
dea4d9df63 Merge pull request #1015 from luoliwoshang/runtime/rmlog
runtime:rm log of StartProcess
2025-02-28 18:10:54 +08:00
xushiwei
b7601a7f08 Merge pull request #1016 from luoliwoshang/ctype
c:some type & stat's pub
2025-02-28 18:10:27 +08:00
luoliwoshang
2e148d6d0e c/pub:fix stat 2025-02-28 16:45:42 +08:00
luoliwoshang
8835a1a232 c:some type 2025-02-28 16:18:27 +08:00
visualfc
00e3b6b5a0 _demo/defer 2025-02-27 14:38:25 +08:00
visualfc
3bb51c5d51 ssa: defer load/store func and args 2025-02-27 14:32:21 +08:00
luoliwoshang
433df05858 runtime:rm log of StartProcess 2025-02-27 14:18:44 +08:00
xushiwei
22524b03c8 Merge pull request #1013 from tsingbx/llgo/llcppg.pub
add all llcppg.pub for clib
2025-02-27 10:41:44 +08:00
tsingbx
508fa62a48 delete llcppg.pub for debug,llama2,neco,setjmp,sys,syscall 2025-02-26 15:30:45 +08:00
tsingbx
e7f7f98c02 add all llcppg.pub for clib 2025-02-26 15:25:06 +08:00
xushiwei
9edaa8eb93 Merge pull request #1010 from cpunion/fix-empty-content
build: fix empty .ll file name generation
2025-02-22 17:46:36 +08:00
Li Jie
32587c1a40 build: fix empty .ll file name generation 2025-02-22 09:25:44 +08:00
xushiwei
019c482d18 Merge pull request #995 from cpunion/fix-llgo-test-crash
Build on Go 1.24, compatible with Go version directive 1.20-1.24 in go.mod
2025-02-21 06:04:21 +08:00
Li Jie
ca906d9c71 test: add byte and append coverage 2025-02-19 12:27:46 +08:00
Li Jie
35ba8476b0 runtime: net/textproto/textproto.go overlay don't import llgo runtime 2025-02-19 12:09:03 +08:00
Li Jie
a473901cfd runtime: patching testing/testing.go for go1.24 2025-02-19 11:46:47 +08:00
Li Jie
b163d71aed test: 3 attempts to avoid clang errors 2025-02-19 11:35:24 +08:00
Li Jie
d561f1399a test: test compiler/internal/build with verbose to show clang command line 2025-02-19 11:35:24 +08:00
Li Jie
00406e08fb ssa: record NeedRuntime, NeedPyInit in Package to compatible multi-packages building 2025-02-19 11:35:24 +08:00
Li Jie
0e4ca910d6 build: building multi packages outputs to temporary path 2025-02-19 11:35:24 +08:00
Li Jie
b00f52472b build: don't output pkg path 2025-02-19 11:35:24 +08:00
Li Jie
95a6e356ee build: let llgo build without -o outputs executable 2025-02-19 11:35:24 +08:00
Li Jie
f4da8e8876 runtime: disable godebug unimplemented warnings 2025-02-19 11:35:23 +08:00
Li Jie
1a08a59b49 env: fix devel version name 2025-02-19 11:35:23 +08:00
Li Jie
758ceb791b compiler: upgrade x/tools 0.30.0 2025-02-19 11:35:23 +08:00
Li Jie
6a1e0084f4 ssa: support len([]func()) 2025-02-19 11:35:23 +08:00
Li Jie
e318cab252 compiler: add internal/build tests 2025-02-19 11:35:23 +08:00
Li Jie
6b12547303 ci: filter out uncollected packages 2025-02-19 11:35:23 +08:00
Li Jie
96d6c00815 cl: regenerate test snapshots 2025-02-19 11:35:22 +08:00
Li Jie
7be79d81f9 ssa: uniform byte and uint8 name on different platforms 2025-02-19 11:35:22 +08:00
Li Jie
2be558d554 runtime: reflect.Value.Equal 2025-02-19 11:35:22 +08:00
Li Jie
60fac0a010 ci: test on go1.24 2025-02-19 11:35:21 +08:00
Li Jie
df0f239929 runtime: fix patch for testing 2025-02-17 07:50:37 +08:00
Li Jie
4e1aea4597 ci: run llgo test 2025-02-17 07:50:36 +08:00
xushiwei
60224dd77d Merge pull request #1003 from cpunion/fix-sleep
runtime: fix time.Sleep
2025-02-17 06:15:08 +08:00
xushiwei
ded408f145 Merge pull request #1004 from visualfc/goexit2
runtime: goexit use thread key
2025-02-17 06:12:28 +08:00
xushiwei
69deeca321 Merge pull request #1002 from cpunion/fix-global-var-type
cl: fix wrong global variable type patching
2025-02-17 06:09:10 +08:00
xushiwei
5e1e7bdad0 Merge pull request #1005 from cpunion/safe-mutex-init
runtime: safe mutex initialization
2025-02-17 06:08:21 +08:00
Li Jie
22f4924d8e runtime: safe mutex initialization 2025-02-16 20:52:22 +08:00
visualfc
8591275eb2 runtime: goexit use thread key 2025-02-16 19:53:38 +08:00
Li Jie
d91bb33178 runtime: fix time.Sleep 2025-02-16 19:25:59 +08:00
Li Jie
d8e782f3f1 cl: fix wrong global variable type patching 2025-02-16 12:53:42 +08:00
xushiwei
51755b8da3 Merge pull request #998 from visualfc/goexit
runtime: support Goexit
2025-02-16 08:52:10 +08:00
xushiwei
e5c0aed75e Merge pull request #997 from cpunion/fix-release
Fix release build
2025-02-16 08:44:48 +08:00
visualfc
6d7e984238 runtime: support Goexit 2025-02-16 08:24:33 +08:00
Li Jie
4dcc944f53 ci: lock tonistiigi/binfmt:qemu-v7.0.0-28 to avoid binfmt crash 2025-02-15 19:31:01 +08:00
Li Jie
fbb978e8a5 ci: populate linux sysroot in parallel 2025-02-15 19:30:32 +08:00
Li Jie
46a3a4f7e3 ci: disable populate cache 2025-02-15 19:30:07 +08:00
xushiwei
e74d2b45c0 Merge pull request #996 from xushiwei/q
qiniu/x v1.13.12
2025-02-15 18:45:00 +08:00
xushiwei
d40298ac58 qiniu/x v1.13.12 2025-02-15 18:30:57 +08:00
xushiwei
87d7a4862e Merge pull request #978 from visualfc/llruntime
runtime: config hasAltPkg and overlay
2025-02-15 15:26:50 +08:00
visualfc
8be9a560e9 runtime: rm ignoreName 2025-02-15 14:56:59 +08:00
visualfc
0d218bb4b9 runtime: config overlay 2025-02-15 13:25:25 +08:00
visualfc
1b3464b610 runtime: config hasAltPkg and ignoreName 2025-02-15 13:22:28 +08:00
xushiwei
c4e66a104b Merge pull request #994 from xushiwei/q
README: Key modules move into compiler directory
2025-02-15 13:20:19 +08:00
xushiwei
d4eaef6ac8 README: Key modules move into compiler directory 2025-02-15 13:19:38 +08:00
xushiwei
9a634b22a7 Merge pull request #991 from cpunion/update-doc
doc: update install instructions
2025-02-15 12:02:45 +08:00
xushiwei
54f5f38637 Merge pull request #946 from cpunion/testing
llgo test
2025-02-15 12:01:49 +08:00
Li Jie
21a5180b2f cl: regenerate test snapshots 2025-02-15 11:18:03 +08:00
Li Jie
8116d34a60 runtime: runtime.Callers, runtime.CallersFrames 2025-02-15 11:18:03 +08:00
Li Jie
c6462cbcc7 ssa: fix type assertion of same type 2025-02-15 11:18:03 +08:00
Li Jie
4e34ce7470 runtime: fix incorrect function signature 2025-02-15 11:18:03 +08:00
Li Jie
c2299818cd compiler: fix llgo build test 2025-02-14 19:02:35 +08:00
Li Jie
2d06dc5cfe demo: call println, c.Printf, fmt.Println 2025-02-14 19:02:35 +08:00
Li Jie
5329f28580 runtime: testing runtime 2025-02-14 19:02:32 +08:00
Li Jie
66909b3000 ci: continue on error 2025-02-14 15:56:19 +08:00
Li Jie
ae92904e7d ssa: show type assertion failed details 2025-02-14 15:56:19 +08:00
Li Jie
70fb5ec7e1 ci: replace setup-go with custom action to avoid cache error and test pre-release go 2025-02-14 15:56:19 +08:00
Li Jie
058f74c12c deps: add libuv into system deps 2025-02-14 15:56:18 +08:00
Li Jie
3a2d24d7cc doc: update doc test for installation instructions 2025-02-13 16:16:25 +08:00
Li Jie
49f2f0dbfd doc: update install instructions 2025-02-13 15:52:11 +08:00
Li Jie
5b216153e9 cl: LLGO_TRACE 2025-02-13 15:47:53 +08:00
Li Jie
43175bb642 build: supports LLGoFiles in patches 2025-02-13 15:47:53 +08:00
Li Jie
c1da220a99 ssa: toType(ssa.TypeParam) 2025-02-13 15:47:53 +08:00
Li Jie
164c3e0e7b cl: fix null pointer in processing debug location 2025-02-13 15:47:52 +08:00
Li Jie
491a23b21e cl: don't ignore standard libraries 2025-02-13 15:47:52 +08:00
Li Jie
727ec8a5cf build: weak syscall.init for syscall imported but not compiled 2025-02-13 15:47:52 +08:00
Li Jie
28b3ec322c build: show cgo compile errors 2025-02-13 15:47:52 +08:00
Li Jie
38cb89a946 build: show full link errors 2025-02-13 15:47:52 +08:00
Li Jie
b07116f302 build: patch packages supports cgo 2025-02-13 15:47:15 +08:00
Li Jie
623b5a511a cl: process llgo:skip on const, type declaration, deprecate llgo:skip on import 2025-02-13 15:47:15 +08:00
Li Jie
d5d2d6826f build: patch package with ID 2025-02-13 15:47:14 +08:00
Li Jie
227f6a4ed7 build: update go/parser/resolve.go (compatible go 1.23) 2025-02-13 15:47:14 +08:00
Li Jie
e23d7082fe build: overlay testing/testing.go for defer in loop 2025-02-13 15:47:14 +08:00
Li Jie
569a29454e build: run llgo test 2025-02-13 15:47:14 +08:00
Li Jie
a07f711e22 build: only limit run command to single package 2025-02-13 15:47:13 +08:00
Li Jie
946f304bb2 compiler: add go test command 2025-02-13 15:47:13 +08:00
Li Jie
6b11c100ba cl: process all go directives 2025-02-13 15:47:13 +08:00
Li Jie
6048693423 ssa: remove unused funcs 2025-02-13 15:47:13 +08:00
Li Jie
a7287754be compiler: remove unused func llgoRuntimeImported 2025-02-13 15:47:13 +08:00
Li Jie
d9037a7fce build: remove generated code after link 2025-02-13 15:47:12 +08:00
Li Jie
f06d292382 test: regenerate test files with gentests 2025-02-13 15:47:12 +08:00
Li Jie
85d01d6f28 compiler: make main function normally to compatible multiple main functions in testing mode 2025-02-13 15:47:12 +08:00
xushiwei
5cfeddef73 Merge pull request #988 from visualfc/reflect_typeof
runtime/internal/lib/reflect: fix TypeOf check nil
2025-02-13 15:20:24 +08:00
xushiwei
b975e77a63 Merge pull request #990 from cpunion/install-and-devel
Install and devel scripts
2025-02-13 15:19:52 +08:00
Li Jie
ba46181365 add llgo.sh for ease development 2025-02-13 13:46:44 +08:00
Li Jie
370604f8eb add install.sh for local and remote installation 2025-02-13 13:34:45 +08:00
visualfc
368c7d6cda runtime/internal/lib/reflect: fix TypeOf check closure 2025-02-13 10:28:36 +08:00
xushiwei
0a9dfdc5c0 Merge pull request #986 from goplus/dependabot/go_modules/compiler/github.com/goplus/mod-0.13.17
build(deps): bump github.com/goplus/mod from 0.13.16 to 0.13.17 in /compiler
2025-02-12 17:28:06 +08:00
dependabot[bot]
72d0d4e274 build(deps): bump github.com/goplus/mod in /compiler
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.13.16 to 0.13.17.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.13.16...v0.13.17)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-11 00:29:06 +00:00
xushiwei
d0067ccf68 Merge pull request #981 from visualfc/reflectlite
runtime/internal/lib/reflectlite: implement func
2025-02-10 13:55:16 +08:00
xushiwei
409793cb21 Merge pull request #980 from cpunion/fix-env-injection
build: fix goreleaser env injection
2025-02-10 13:52:16 +08:00
xushiwei
a9eb65926f Merge pull request #984 from goplus/dependabot/go_modules/compiler/github.com/qiniu/x-1.13.12
build(deps): bump github.com/qiniu/x from 1.13.11 to 1.13.12 in /compiler
2025-02-10 13:51:08 +08:00
dependabot[bot]
18d8677fe6 build(deps): bump github.com/qiniu/x in /compiler
Bumps [github.com/qiniu/x](https://github.com/qiniu/x) from 1.13.11 to 1.13.12.
- [Release notes](https://github.com/qiniu/x/releases)
- [Commits](https://github.com/qiniu/x/compare/v1.13.11...v1.13.12)

---
updated-dependencies:
- dependency-name: github.com/qiniu/x
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 00:46:38 +00:00
visualfc
09c8567e39 runtime/internal/lib/reflectlite: implement func 2025-02-07 12:04:54 +08:00
Li Jie
6bbd4b214a build: fix goreleaser env injection 2025-02-07 09:58:23 +08:00
xushiwei
a345746cbd Merge pull request #979 from luoliwoshang/clang/presume
c/clang:presume location
2025-02-06 17:00:32 +08:00
luoliwoshang
0a0bb128d6 c/clang:presume location 2025-02-06 16:37:07 +08:00
xushiwei
29ec3014e7 Merge pull request #911 from visualfc/reflect.conv
internal/lib/reflect: convertOp
2025-02-05 20:12:51 +08:00
visualfc
9ddd4d4161 compiler/cl/_testgo: reflectconv 2025-02-05 16:13:29 +08:00
visualfc
3caae31374 internal/runtime: pointer set abi.KindDirectIface 2025-02-05 15:20:20 +08:00
visualfc
b69abd1058 internal/runtime: find type 2025-02-05 15:20:20 +08:00
visualfc
114c6bd6fc internal/lib/reflect: fix call method 2025-02-05 15:20:20 +08:00
visualfc
d81c5e750d internal/runtime: impl ifaceE2I 2025-02-05 15:20:20 +08:00
visualfc
281d29a100 internal/lib/reflect: DeepEqual 2025-02-05 15:20:20 +08:00
visualfc
46492009a1 internal/lib/reflect: specialChannelAssignability 2025-02-05 15:20:20 +08:00
visualfc
ec549a6a25 internal/lib/reflect: value.convert check func 2025-02-05 15:20:20 +08:00
visualfc
71766d9c55 ssa/abi: StructName not pub 2025-02-05 15:20:20 +08:00
visualfc
d2d8bd550a internal/lib/reflect: fix Int/Uint/Float flagIndir 2025-02-05 15:20:20 +08:00
visualfc
0c2f6c46f6 internal/runtime: newPointer set KindDirectIface 2025-02-05 15:20:20 +08:00
visualfc
c90b93c1b7 internal/lib/reflect: convertOp 2025-02-05 15:20:20 +08:00
xushiwei
faef4fffab Merge pull request #977 from visualfc/test_debug
compiler/ssa: test debug check verbose
2025-02-05 12:19:52 +08:00
visualfc
8e8b97f623 compiler/ssa: test debug check verbose 2025-02-05 10:07:55 +08:00
xushiwei
e23d18dab8 Merge pull request #976 from visualfc/ci
ci: go test remove -v
2025-02-05 09:50:21 +08:00
visualfc
3a0d1466cc ci: go test remove -v 2025-02-05 09:32:42 +08:00
xushiwei
83dd77f4c4 Merge pull request #974 from cpunion/fix-doc-links
Fix doc links
2025-02-04 14:53:32 +08:00
xushiwei
c601c992c1 Merge pull request #975 from visualfc/namedslice
compiler/cl: fix named slice type
2025-02-04 14:52:46 +08:00
visualfc
5727761551 compiler/cl: fix named slice type 2025-02-03 20:13:57 +08:00
Li Jie
08365721de test: increase test times to try to avoid clang error 2025-02-03 18:47:24 +08:00
Li Jie
692c3542d9 doc: update links 2025-02-03 18:26:41 +08:00
Li Jie
60dc1f7d75 ci: verify markdown links by lychee 2025-02-03 18:26:16 +08:00
xushiwei
e5ff33fcc6 Merge pull request #969 from cpunion/find-llgo-root
test: retry failed test to avoid clang error
2025-02-01 21:54:50 +08:00
xushiwei
c60979fff7 Merge pull request #970 from xushiwei/q
README: C/C++, ObjC, Swift
2025-02-01 21:10:38 +08:00
xushiwei
961ad6ebca README: C/C++, ObjC, Swift 2025-02-01 21:00:01 +08:00
Li Jie
f18237a005 test: retry llgo test to avoid clang error 2025-02-01 20:56:55 +08:00
xushiwei
cba93e61b4 Merge pull request #960 from visualfc/instnamed
ssa: abi.NamedName for instance named
2025-02-01 19:23:25 +08:00
xushiwei
e0a6e5d2f9 Merge pull request #968 from cpunion/find-llgo-root
Find llgo root
2025-02-01 19:01:34 +08:00
Li Jie
a9ee323760 test: disable log and output to speed up testing 2025-02-01 14:11:46 +08:00
Li Jie
977db86700 env: warning and fallback if LLGO_ROOT is invalid 2025-02-01 14:11:46 +08:00
Li Jie
93d36d40d8 env: fix version 2025-02-01 14:11:46 +08:00
Li Jie
cabc7ffca8 env: find llgo root for development 2025-02-01 14:11:46 +08:00
Li Jie
521b70c715 test: llgo clean, llgo cmptest, llgo cmptest -gen 2025-02-01 14:11:46 +08:00
Li Jie
b6c5503c5b test: chore/llgen 2025-02-01 14:11:46 +08:00
Li Jie
e7e2ba4790 test: test llgo run -v 2025-02-01 14:11:45 +08:00
Li Jie
8749923f1a test: make cmd testable 2025-02-01 14:11:45 +08:00
Li Jie
25a3e19384 ci: update codecov ignore config 2025-02-01 14:11:40 +08:00
visualfc
b6b686665a compiler/cl: inst named stable sort 2025-02-01 13:52:10 +08:00
visualfc
4f5468469b compiler/cl/_testgo: add tpinst 2025-02-01 12:28:09 +08:00
visualfc
7bc7f23125 ssa: abi.NamedName for instance named 2025-02-01 10:29:35 +08:00
xushiwei
25ed652fc0 Merge pull request #966 from visualfc/reflect_go123
runtime: fix reflect type for go1.23
2025-02-01 03:39:45 +08:00
xushiwei
cc2913352a Merge pull request #955 from visualfc/conv
ssa: fix cvtType check types.Alias
2025-01-30 11:59:35 +08:00
visualfc
ad796ebbec compiler: fix build go1.22 for GODEBUG=gotypesalias=1 2025-01-29 19:07:37 +08:00
visualfc
edd561f8ba runtime: fix reflect type for go1.23 2025-01-29 18:58:36 +08:00
xushiwei
0b1c4fb54f Merge pull request #964 from goplus/dependabot/go_modules/compiler/github.com/goplus/gogen-1.16.6
build(deps): bump github.com/goplus/gogen from 1.16.5 to 1.16.6 in /compiler
2025-01-23 13:44:19 +08:00
dependabot[bot]
9f4eb4f7db build(deps): bump github.com/goplus/gogen in /compiler
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.5 to 1.16.6.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.5...v1.16.6)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 01:15:38 +00:00
xushiwei
f6e3a3917e Merge pull request #959 from luoliwoshang/sys/ExecInChild
syscall(linux): forkAndExecInChild
2025-01-21 07:30:48 +08:00
luoliwoshang
1b536bf5f8 syscall(linux):use clone as go instead fork 2025-01-20 08:30:02 +00:00
xushiwei
e3afdb6c02 Merge pull request #962 from cpunion/fix-abi
fix(ssa): fix incorrectly ABI for uninstantiated generic methods
2025-01-18 23:55:27 +08:00
Li Jie
918b36e28f fix(ssa): fix incorrectly generated ABI for uninstantiated generic methods 2025-01-17 20:36:04 +08:00
luoliwoshang
ce26637410 demo:command run 2025-01-17 08:30:07 +00:00
luoliwoshang
2053c72008 c/os:dup3 2025-01-16 11:00:18 +00:00
luoliwoshang
275bde6461 syscall(linux): forkAndExecInChild 2025-01-16 10:59:38 +00:00
luoliwoshang
f85382edd4 c/syscall: zsysnum 2025-01-14 14:09:52 +00:00
xushiwei
e016e92c41 Merge pull request #949 from goplus/dependabot/go_modules/compiler/github.com/goplus/gogen-1.16.5
build(deps): bump github.com/goplus/gogen from 1.16.4 to 1.16.5 in /compiler
2025-01-13 19:48:20 +08:00
dependabot[bot]
2594b8e3f9 build(deps): bump github.com/goplus/gogen in /compiler
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.4...v1.16.5)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 11:08:50 +00:00
xushiwei
1e1ef594c8 Merge pull request #951 from xushiwei/q
xtool/clang: disable types
2025-01-13 19:08:05 +08:00
xushiwei
01c660faba Merge pull request #952 from goplus/dependabot/go_modules/compiler/github.com/goplus/mod-0.13.16
build(deps): bump github.com/goplus/mod from 0.13.15 to 0.13.16 in /compiler
2025-01-13 19:07:35 +08:00
visualfc
9f76237705 ssa: fix cvtType check types.Alias 2025-01-13 12:38:15 +08:00
dependabot[bot]
59d3e3f3da build(deps): bump github.com/goplus/mod in /compiler
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.13.15 to 0.13.16.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.13.15...v0.13.16)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-13 01:05:42 +00:00
xushiwei
e5dd237f12 xtool/clang: disable types 2025-01-13 09:05:19 +08:00
xushiwei
e9729bea7e Merge pull request #945 from goplus/dependabot/go_modules/compiler/github.com/goplus/mod-0.13.15
build(deps): bump github.com/goplus/mod from 0.13.13 to 0.13.15 in /compiler
2025-01-12 09:11:46 +08:00
dependabot[bot]
d46b17d8a0 build(deps): bump github.com/goplus/mod in /compiler
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.13.13 to 0.13.15.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.13.13...v0.13.15)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-11 19:36:26 +00:00
xushiwei
383d25226e Update dependabot.yml 2025-01-12 03:35:27 +08:00
xushiwei
745eff0783 Merge pull request #943 from goplus/dependabot/github_actions/actions/cache-4
build(deps): bump actions/cache from 3 to 4
2025-01-10 09:59:23 +08:00
dependabot[bot]
ac301045b9 build(deps): bump actions/cache from 3 to 4
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-10 00:58:56 +00:00
xushiwei
e1f3ca8172 Merge pull request #929 from cpunion/go123
Separate compiler, runtime and llgo library
2025-01-09 20:13:35 +08:00
Li Jie
4ff4ceeb22 ssa: show detail message of runtime failed 2025-01-09 19:50:01 +08:00
Li Jie
4126992a8f compiler: remove completed todo 2025-01-09 19:39:12 +08:00
Li Jie
fd99f63bd6 ci: hello world testing with different version declarations in go.mod and go versions 2025-01-09 18:55:22 +08:00
Li Jie
46dc7c3a77 test: increase test coverage 2025-01-09 18:55:22 +08:00
Li Jie
a8cb551465 env: add tests for codecov 2025-01-09 18:55:21 +08:00
Li Jie
5a5674809c ssa: Builder.TypeName processes types.Alias 2025-01-09 16:59:51 +08:00
Li Jie
761e8a2ac6 compiler: make compiler working on go 1.23 project 2025-01-09 16:11:39 +08:00
Li Jie
dfa7effa14 ci: config release build 2025-01-09 15:39:03 +08:00
Li Jie
09c022e209 cmd: fix return value with arguments 2025-01-09 15:32:27 +08:00
Li Jie
8666a75161 ci: remove unused python libraries installation step 2025-01-09 11:58:24 +08:00
Li Jie
68018d8d04 runtime: clean demo 2025-01-09 09:05:45 +08:00
Li Jie
3d2c014801 cl: clean test 2025-01-09 00:47:45 +08:00
Li Jie
4f9c341103 ci: update codecov ignore 2025-01-09 00:23:30 +08:00
Li Jie
563f03554f test: llgo commands 2025-01-09 00:09:47 +08:00
Li Jie
219376044a ci: fix llgo workflow name 2025-01-08 23:23:58 +08:00
Li Jie
591dac8b41 compiler: remove unused packages 2025-01-08 23:02:46 +08:00
Li Jie
2bc96ade33 lldb: test lldb cross go compilers 2025-01-08 22:16:03 +08:00
Li Jie
95c4456ccc env: get GOROOT from env variable or go env GOROOT 2025-01-08 22:16:03 +08:00
Li Jie
6e6b8b404f runtime: rename clite conflicts function names 2025-01-08 22:16:02 +08:00
Li Jie
27052c21be ci: test lldb last 2025-01-08 22:16:02 +08:00
Li Jie
ec744f7385 chore: move compiler/chore/_xtool to _xtool 2025-01-08 22:16:02 +08:00
Li Jie
d8c5105c91 ci: set LLGO_ROOT for doc test 2025-01-08 22:16:01 +08:00
Li Jie
acd5fb19f5 ci: rename llgo test job name 2025-01-08 15:55:38 +08:00
Li Jie
52ac486814 doc: fix llgo installation 2025-01-08 15:40:11 +08:00
Li Jie
a64b32bf9c ci: compile go with go1.23, test llgo with go 1.20-1.23 2025-01-08 15:36:41 +08:00
Li Jie
b299800e64 compiler: move _lldb into compiler/ 2025-01-08 15:22:09 +08:00
Li Jie
60c430abad test: regenerate test snapshots with gentests 2025-01-08 15:19:38 +08:00
Li Jie
255cce4f9a test: move cchan/cchansel into runtime/_test 2025-01-08 15:03:58 +08:00
Li Jie
1ed99c2574 cl: isAny compatible alias 2025-01-08 14:59:02 +08:00
Li Jie
64b54d4380 ssa: make alias working in go 1.22 2025-01-08 14:59:02 +08:00
Li Jie
6170973b48 compiler: build separation runtime with clite 2025-01-08 14:59:01 +08:00
Li Jie
1172e5bdce build: separate compiler and libs 2025-01-08 14:59:01 +08:00
Li Jie
b0123567cd ci: ignore code coverage of llgo libs 2025-01-08 14:59:00 +08:00
Li Jie
81598621e8 ci: codecov report excludes llgo library 2025-01-08 14:59:00 +08:00
Li Jie
239ac496b2 test: map/slice clear 2025-01-08 14:59:00 +08:00
Li Jie
76fb91619a demo: workaround for reflect abi initialization on go@1.23 2025-01-08 14:58:59 +08:00
Li Jie
e3a2d43ffa runtime: add missing SliceClear 2025-01-08 14:58:59 +08:00
Li Jie
b3f4716616 runtime: patch internal/filepathlite 2025-01-08 14:58:59 +08:00
Li Jie
c602038597 demo: don't use symlinks for x/tools compatible 2025-01-08 14:58:59 +08:00
Li Jie
03b469212e feat: upgrade to x/tools 0.28 2025-01-08 14:58:59 +08:00
xushiwei
db3f6e077e Merge pull request #941 from cpunion/fix-doc-verify
doc: fix macos installation doc verify
2025-01-08 08:58:31 +08:00
Li Jie
06816c51a5 doc: fix macos installation doc verify 2025-01-07 21:28:14 +08:00
xushiwei
9e9e8e82b2 Merge pull request #936 from cpunion/optional-llgo-root
build: make llgo root usage optional for runtime loading
2025-01-07 19:47:40 +08:00
xushiwei
031d4ebedc Merge pull request #937 from MeteorsLiu/main
README: fix dependences requirement for macOS
2025-01-07 18:40:03 +08:00
xushiwei
3446715af8 Merge pull request #934 from cpunion/fix-build
build.ParseArgs returns new slices to fix wrong patterns with flags appending
2025-01-07 18:07:13 +08:00
Rick Guo
c7e68dab62 README: fix dependences for macOS 2025-01-06 17:38:36 +08:00
Li Jie
7093ced2d8 build: make llgo root usage optional for runtime loading
When github.com/goplus/llgo is imported in go.mod, use the user-specified
version instead of LLGoROOT. This allows users to upgrade llgo via go.mod
while maintaining backward compatibility for cases without explicit imports.

Note: This is a temporary solution. The runtime's dependency on
github.com/goplus/llgo/c/* needs to be addressed in future improvements.
2025-01-06 16:36:16 +08:00
Li Jie
179f4dfe22 build: ParseArgs return new slices 2025-01-06 10:10:11 +08:00
xushiwei
03517ce22e Merge pull request #933 from cpunion/independent
env: allow compiling code outside llgo directory
2025-01-05 07:10:29 +08:00
Li Jie
290f99b4d1 env: allow compiling code outside llgo directory 2025-01-04 23:40:13 +08:00
xushiwei
7f10bc2a1b Merge pull request #930 from cpunion/panic-stacktrace
runtime: show stacktrace when panic
2025-01-03 12:04:12 +08:00
Li Jie
9cb48003b0 ci: add libunwind-dev on ubuntu 2025-01-02 23:27:45 +08:00
Li Jie
6df961292d doc: install libunwind-dev on ubuntu 2025-01-02 23:27:45 +08:00
Li Jie
65f855b251 runtime: show stacktrace when panic 2025-01-02 23:27:41 +08:00
xushiwei
5131881bf2 Merge pull request #928 from goplus/dependabot/go_modules/github.com/goplus/llvm-0.8.1
build(deps): bump github.com/goplus/llvm from 0.8.0 to 0.8.1
2024-12-31 19:19:16 +08:00
dependabot[bot]
8fbad90e9d build(deps): bump github.com/goplus/llvm from 0.8.0 to 0.8.1
Bumps [github.com/goplus/llvm](https://github.com/goplus/llvm) from 0.8.0 to 0.8.1.
- [Release notes](https://github.com/goplus/llvm/releases)
- [Commits](https://github.com/goplus/llvm/compare/v0.8.0...v0.8.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/llvm
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-31 11:06:15 +00:00
xushiwei
d0aceebaad Merge pull request #926 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.16.4
build(deps): bump github.com/goplus/gogen from 1.16.3 to 1.16.4
2024-12-31 13:57:06 +08:00
dependabot[bot]
01b6680000 build(deps): bump github.com/goplus/gogen from 1.16.3 to 1.16.4
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.3 to 1.16.4.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.3...v1.16.4)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-31 05:40:12 +00:00
xushiwei
638883f352 Merge pull request #925 from goplus/dependabot/go_modules/github.com/goplus/mod-0.13.13
build(deps): bump github.com/goplus/mod from 0.13.12 to 0.13.13
2024-12-31 08:10:07 +08:00
dependabot[bot]
467c2fb28d build(deps): bump github.com/goplus/mod from 0.13.12 to 0.13.13
Bumps [github.com/goplus/mod](https://github.com/goplus/mod) from 0.13.12 to 0.13.13.
- [Release notes](https://github.com/goplus/mod/releases)
- [Commits](https://github.com/goplus/mod/compare/v0.13.12...v0.13.13)

---
updated-dependencies:
- dependency-name: github.com/goplus/mod
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 23:56:08 +00:00
xushiwei
0fd129a0d8 Merge pull request #924 from xushiwei/q
llgo get: todo
2024-12-30 21:17:04 +08:00
xushiwei
282125a84b llgo get: todo 2024-12-30 21:16:22 +08:00
xushiwei
97a2824473 Merge pull request #915 from visualfc/runtime.hash
[WIP] internal/runtime: type hash
2024-12-26 08:30:34 +08:00
xushiwei
eff1333269 Merge pull request #922 from visualfc/fixfloat
ssa: fix bitcast for float32
2024-12-24 20:19:32 +08:00
visualfc
3741a28d94 ssa: fix bitcast for float32 2024-12-24 10:02:30 +08:00
xushiwei
6dd4ec160d Merge pull request #921 from visualfc/runtime.closure
ssa: closure use specific struct field name
2024-12-23 10:53:12 +08:00
visualfc
a6a3c09c05 ssa: closure use specific struct field name { $f ftype, $data unsafe.pointer } 2024-12-22 12:44:33 +08:00
visualfc
620cfeabe0 internal/runtime: type hash 2024-12-21 20:07:28 +08:00
xushiwei
070d64f365 Merge pull request #920 from visualfc/runtime.namedset
[WIP] internal/runtime: named(ptr) type preset for method type
2024-12-21 07:13:39 +08:00
visualfc
1d3c98372a internal/runtime: cache rtypeList 2024-12-20 20:45:46 +08:00
visualfc
c1588d70cd internal/runtime: structStr 2024-12-20 16:09:39 +08:00
visualfc
ef28abe896 internal/runtime: funcStr, interfaceStr, array str 2024-12-20 12:33:34 +08:00
visualfc
d251232f8a internal/runtime: named(ptr) type preset for method type 2024-12-20 11:37:30 +08:00
xushiwei
05334de855 Merge pull request #914 from aofei/README
README: add install instructions for Alpine
2024-12-19 18:14:15 +08:00
xushiwei
539b55f826 Merge pull request #917 from visualfc/conststring
ssa: fix const for named string
2024-12-19 18:13:24 +08:00
xushiwei
0699832240 Merge pull request #919 from visualfc/runtime.named
internal/runtime: NewNamedInterface check exist
2024-12-19 18:12:53 +08:00
visualfc
ce169163b9 internal/runtime: NewNamedInterface check exist 2024-12-17 21:36:51 +08:00
xushiwei
b4af70ada9 Merge pull request #916 from visualfc/runtime.interface
abi: fix named interface init
2024-12-17 14:43:15 +08:00
xushiwei
424670d854 Merge pull request #918 from tsingbx/c/_types
include/_types: add Uint8T, Uint16T, Uint32T, Uint64T, IntmaxT, UintmaxT
2024-12-17 14:41:44 +08:00
tsingbx
6ce4644120 include/_types: add Uint8T, Uint16T, Uint32T, Uint64T, IntmaxT, UintmaxT 2024-12-16 18:15:01 +08:00
visualfc
eaf7e56083 ssa: fix const for named string 2024-12-16 15:00:32 +08:00
visualfc
e55a5d7486 internal/runtime: NewNamedInterface, InitNamedInterface 2024-12-16 12:07:13 +08:00
Aofei Sheng
e1d14b1324 README: add install instructions for Alpine
Fixes #910

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
2024-12-14 18:06:16 +08:00
xushiwei
04d09eb891 Merge pull request #913 from xushiwei/q
README: cgo, c/ffi
2024-12-14 09:16:18 +08:00
xushiwei
09b4f5dffd README: cgo, c/ffi 2024-12-14 08:15:08 +08:00
xushiwei
29ad96862f Merge pull request #628 from visualfc/go
ssa: fix ssa.go for builtin
2024-12-14 06:44:35 +08:00
xushiwei
839d68d62c Merge pull request #912 from luoliwoshang/c/clang/typesize
c/clang:type size
2024-12-12 22:10:34 +08:00
luoliwoshang
a4d3bf3cb2 c/clang:type size 2024-12-12 18:16:40 +08:00
xushiwei
a05bda9fc3 Merge pull request #762 from spongehah/golib/time
lib/time: patch div and Time.Round
2024-12-10 18:51:45 +08:00
xushiwei
5936b57bac Merge pull request #909 from tsingbx/llgo/linkerror
fix link fail for cjsondemo
2024-12-08 11:24:55 +08:00
tsingbx
af2bcd389e fix link error 2024-12-08 10:18:47 +08:00
xushiwei
4bec9b038b Merge pull request #906 from visualfc/llccheck
[WIP] build: env LLGO_CHECK=1 for llc check module
2024-12-05 12:17:15 +08:00
visualfc
0b3ce5f65a build: env LLGO_CHECK=1 for llc check module 2024-12-05 11:07:21 +08:00
xushiwei
cb8e820f5d Merge pull request #905 from luoliwoshang/c/FILE
c:file
2024-12-05 09:56:43 +08:00
luoliwoshang
0a4ce9d65e c:FILE 2024-12-04 15:02:54 +08:00
xushiwei
f20d74c1f3 Merge pull request #904 from visualfc/revert-630-deferargs
Revert "ssa: defer load/store func and args"
2024-12-04 09:47:36 +08:00
七叶
3505be422e Revert "ssa: defer load/store func and args" 2024-12-03 21:00:49 +08:00
xushiwei
7e9542e79a Merge pull request #898 from visualfc/expand
xtool/env: fix ExpandEnvToArgs check pkg-config
2024-12-03 09:33:59 +08:00
visualfc
a1c1a4889b xtool/env: fix ExpandEnvToArgs check pkg-config 2024-12-03 09:17:54 +08:00
visualfc
7eeb8084bf ssa: fix ssa.go for builtin 2024-12-02 15:40:56 +08:00
xushiwei
7a5bd6ae6a Merge pull request #630 from visualfc/deferargs
ssa: defer load/store func and args
2024-12-02 13:51:25 +08:00
xushiwei
d20e60afb3 Merge pull request #891 from visualfc/debug
[WIP] c/debug: func addr and info
2024-12-02 13:46:56 +08:00
xushiwei
7340263e6a Merge pull request #893 from tsingbx/clang
add clang.GoString, clang.File functions for helper of llcppsymg struct_methodname
2024-12-02 13:45:55 +08:00
visualfc
6e8cecd13e cl/_testgo: defer6 2024-12-02 11:43:20 +08:00
tsingbx
f106a0854f use temp to reduse clangStr.CStr call times 2024-12-02 10:20:41 +08:00
tsingbx
68b09e87b3 add clang.GoString, clang.File functions for helper of llcppsymg struct_methodname 2024-12-02 09:52:35 +08:00
visualfc
11f2ecd675 ssa: defer load/store func and args 2024-11-30 14:31:23 +08:00
visualfc
7b6b8b0eeb c/debug: StackTrace 2024-11-30 13:47:37 +08:00
visualfc
67f9580c5d c/debug: func addr and info 2024-11-30 13:45:19 +08:00
xushiwei
6a3fce97cf Merge pull request #894 from cpunion/fix-release-build
ci: lock release build to llvm@18
2024-11-29 16:43:35 +08:00
Li Jie
2bd266a7fc ci: lock release build to llvm@18 2024-11-29 10:26:14 +08:00
xushiwei
f6946b88d2 Merge pull request #890 from luoliwoshang/c/sizet
c:some stdint type
2024-11-28 18:25:08 +08:00
xushiwei
5e5df6becd Merge pull request #881 from cpunion/cgo-extra
cgo: support macros and callbacks (fpvars)
2024-11-28 18:24:11 +08:00
luoliwoshang
6c4cb92249 c:stdint type 2024-11-27 23:48:02 +08:00
Li Jie
c3407eac5e cgo: supports //export functions only calls in C 2024-11-27 20:24:53 +08:00
Li Jie
e46b3e24d6 test: move cgo demo into _testgo, and make links 2024-11-27 18:41:56 +08:00
Li Jie
90763de93c cgo: supports c/go callback funcs 2024-11-27 18:41:56 +08:00
Li Jie
5380ffa471 cgo: ignore funcs won't be compiled 2024-11-27 18:41:56 +08:00
Li Jie
c9f436cc47 cgo: full test
cgo: test returning void
2024-11-27 18:41:56 +08:00
Li Jie
39dc68fa4e demo/cgofull: add multi cgo module and macro calling 2024-11-27 18:41:56 +08:00
Li Jie
d6c527f662 cgo: support macros 2024-11-27 18:41:56 +08:00
xushiwei
38a7f4f7d5 Merge pull request #888 from xushiwei/q
mv llcppg => github.com/goplus/llcppg
2024-11-27 17:35:50 +08:00
xushiwei
1605959a04 ci: rm Install llcppg 2024-11-27 17:24:12 +08:00
xushiwei
b837e0005a gogensig 2024-11-27 17:19:21 +08:00
xushiwei
58937a5366 mv llcppsigfetch,llcppsymg => github.com/goplus/llcppg 2024-11-27 17:17:40 +08:00
xushiwei
8562c03f80 mv llcppg => github.com/goplus/llcppg 2024-11-27 17:08:27 +08:00
xushiwei
1cd61b9169 Merge pull request #886 from visualfc/reflect.map
reflect: implement map
2024-11-27 14:12:56 +08:00
xushiwei
c69e289afe Merge pull request #887 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.16.3
build(deps): bump github.com/goplus/gogen from 1.16.2 to 1.16.3
2024-11-27 14:12:31 +08:00
visualfc
91b46b05ad cl/_testgo/reflect: map demo 2024-11-27 11:31:28 +08:00
visualfc
2412760f1c internal/lib/reflect: makemap 2024-11-27 11:31:07 +08:00
dependabot[bot]
d83c5493c7 build(deps): bump github.com/goplus/gogen from 1.16.2 to 1.16.3
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.2 to 1.16.3.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.2...v1.16.3)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-27 03:26:05 +00:00
xushiwei
d041703dc6 Merge pull request #885 from cpunion/fix
fix: wrong llvm libs flag
2024-11-27 11:24:39 +08:00
visualfc
ecba13c38e internal/lib/reflect: use sync.Map 2024-11-27 10:33:22 +08:00
visualfc
cd3a4bb8c8 reflect: implement map 2024-11-26 20:45:01 +08:00
Li Jie
97f72b93e1 fix: wrong llvm libs flag 2024-11-26 16:08:29 +08:00
xushiwei
e93d57983e Merge pull request #884 from cpunion/unify-build
Unify cltest, llgen, gentests to build.Do
2024-11-26 15:58:06 +08:00
Li Jie
43c4a3bfdc test: enable debug testing 2024-11-26 15:43:34 +08:00
Li Jie
954cc0e8bc test: ignore syncmap since different pthread_mutex_t size on macOS and linux 2024-11-26 13:21:33 +08:00
Li Jie
ad48325dff test: regenerate test fixtures 2024-11-26 13:21:01 +08:00
Li Jie
fa1ad20d5d ffi: fix ci and install doc 2024-11-26 13:19:02 +08:00
Li Jie
0547dede21 cpp: fix ldflags of llvm 2024-11-26 13:19:02 +08:00
Li Jie
284ae23db2 doc: install missing libsqlite3-dev 2024-11-26 13:19:02 +08:00
Li Jie
9105f28c13 ci: don't install pkg-config explicitly 2024-11-26 13:18:59 +08:00
Li Jie
06cc43b11f test: test dirs under _demo only has *.go files 2024-11-26 13:17:36 +08:00
Li Jie
d879d0d924 build: make llgen, cltest, gentests call build.Do 2024-11-26 13:17:36 +08:00
xushiwei
25bc84817a Merge pull request #880 from visualfc/valist
ssa: closure use org signature
2024-11-26 13:02:30 +08:00
visualfc
8fb0dfad94 ssa: abiNamed use NameOf 2024-11-26 12:46:11 +08:00
visualfc
c2138037d2 internal/lib/reflect: call variadic check 2024-11-26 12:46:11 +08:00
visualfc
fadd64c1e9 ssa: cvtClosure remove closureCtx param 2024-11-26 12:46:11 +08:00
visualfc
4552691aed ssa: toLLVMFunc by NameValist 2024-11-26 12:46:11 +08:00
xushiwei
bab5c0589f Merge pull request #883 from luoliwoshang/ci/llcppg
ci:install llcppg dependent
2024-11-26 12:44:31 +08:00
luoliwoshang
2a2c614eb4 ci:remove pre-install pkg-config 2024-11-26 11:52:35 +08:00
luoliwoshang
12529ec81e ci:install llcppg dependent 2024-11-26 11:13:25 +08:00
luoliwoshang
0179609a49 ci:trigger for sub-repositories 2024-11-26 10:56:37 +08:00
xushiwei
860c551aa6 Merge pull request #876 from cpunion/fix-demo-test
Enable demo test
2024-11-25 12:15:33 +08:00
Li Jie
1ba3474a5a lib: impl syscall.Faccesat 2024-11-25 12:05:12 +08:00
Li Jie
f26c283541 ci: enable demo result checking 2024-11-25 12:05:12 +08:00
Li Jie
56e9dab2ce ci: test demo with python 3.12 2024-11-25 12:05:12 +08:00
Li Jie
b1fcae5cec cgo: only scan non-directories and ignore *_test.c 2024-11-25 12:05:12 +08:00
xushiwei
93245ac37a Merge pull request #879 from cpunion/fix-type-patching
Fix type patching
2024-11-25 11:52:48 +08:00
Li Jie
3f795e44c7 demo: sizeof sync.Mutex 2024-11-25 11:36:26 +08:00
Li Jie
e732e5158e cl: fix package patching 2024-11-25 11:36:26 +08:00
xushiwei
2f5c033f09 Merge pull request #878 from cpunion/update-code-gen
test: update generated code
2024-11-25 11:32:17 +08:00
Li Jie
6099369019 test: update generated code 2024-11-25 11:18:46 +08:00
xushiwei
8d2b65386c Merge pull request #874 from cpunion/fix-closure
ssa: fix wrong reflect type of closure
2024-11-25 11:05:04 +08:00
xushiwei
ed835225cf Merge pull request #875 from cpunion/fix-alloc-in-loop
Reduce alloca
2024-11-25 10:54:28 +08:00
Li Jie
43c1bc8d5f ssa: compile go string constant without alloca 2024-11-24 15:29:20 +08:00
Li Jie
17832fe18c ssa: fix type of ChanOp.Size 2024-11-24 15:21:32 +08:00
Li Jie
252f3f0bd6 ssa: fix closure type 2024-11-24 10:54:00 +08:00
xushiwei
e042aad819 Merge pull request #873 from luoliwoshang/workflow/pkgconf
ci: remove pre-installed pkg-config
2024-11-23 19:41:13 +08:00
luoliwoshang
9966daf0cf ci: remove pre-installed pkg-config 2024-11-23 19:27:11 +08:00
xushiwei
daf5e9cccf Merge pull request #871 from luoliwoshang/doc/ssizet
doc:ssize_t
2024-11-22 23:13:39 +08:00
xushiwei
bf63d731d3 Merge pull request #870 from luoliwoshang/llcppsigfetch/otherdefinetype
llcppsigfetch:typedef refer same struct & remove tokenize check for underlying
2024-11-22 23:12:34 +08:00
luoliwoshang
12abfc0fcf doc:ssize_t 2024-11-21 21:38:11 +08:00
xushiwei
dea1b520f7 Merge pull request #852 from visualfc/reflect.func
internal/lib/reflect: support method call
2024-11-21 07:42:18 +08:00
luoliwoshang
a5c268491e llcppsigfetch: test typedef anonymous enum with multiple type names 2024-11-20 17:56:44 +08:00
luoliwoshang
bf34f553bb llcppsigfetch:typedef refer same anony struct & fix typedef 's underlying token out of bound 2024-11-20 16:58:18 +08:00
luoliwoshang
97c61404ca llcppsigfetch:test config 2024-11-20 14:09:58 +08:00
visualfc
c40d9f54a2 internal/lib/reflect: value.call support multi ret 2024-11-19 20:51:08 +08:00
visualfc
5e08593358 internal/lib/reflect: toFFIArg check interface 2024-11-19 20:51:08 +08:00
visualfc
1f06b12f86 internal/lib/reflect: toFFIArg 2024-11-19 20:51:08 +08:00
visualfc
c7351f724e internal/lib/reflect: toFFIType 2024-11-19 20:51:08 +08:00
visualfc
1851bce497 internal/lib/reflect: Value.InterfaceData 2024-11-19 20:51:08 +08:00
visualfc
5fb8503fd2 internal/lib/reflect: Value.IsZero 2024-11-19 20:51:08 +08:00
visualfc
792716eefc internal/lib/reflect: Value.SetZero 2024-11-19 20:51:08 +08:00
visualfc
15a6c779b8 internal/lib/reflect: Value.New 2024-11-19 20:51:08 +08:00
visualfc
93d24e7106 internal/lib/reflect: Value.UnsafePointer 2024-11-19 20:51:08 +08:00
visualfc
b8a185c112 internal/lib/reflect: Value.Slice Value.Slice3 2024-11-19 20:51:08 +08:00
visualfc
e242e65569 internal/lib/reflect: Value.SetLen Value.SetCap 2024-11-19 20:51:08 +08:00
visualfc
62ab33a434 internal/lib/reflect: Value.Len Value.Cap 2024-11-19 20:51:08 +08:00
visualfc
f403916ef8 internal/lib/reflect: Value.bytesSlow 2024-11-19 20:51:08 +08:00
visualfc
38f1585ac6 internal/lib/reflect: Value.Float Value.Bool 2024-11-19 20:51:08 +08:00
visualfc
1f757270d9 internal/lib/reflect: impl Value.Field 2024-11-19 20:51:08 +08:00
visualfc
e6de8401bf internal/lib/reflect: makeMethodValue 2024-11-19 20:51:08 +08:00
visualfc
df2e34ac51 internal/lib/reflect: call.method 2024-11-19 20:51:08 +08:00
visualfc
7bbd3a7e36 internal/lib/reflect: TypeOf check closure 2024-11-19 20:51:07 +08:00
visualfc
85a736d49b internal/lib/reflect: closure keep orgtype 2024-11-19 20:51:07 +08:00
xushiwei
f9eb313f7c Merge pull request #869 from cpunion/fix-linking
Fix linking args, force doc test run on current ref
2024-11-19 17:46:14 +08:00
Li Jie
9cec486a1b build: compatible spaces in path outputted from pkg-config 2024-11-19 16:43:45 +08:00
Li Jie
7734c654a7 doc: make doc test use current ref 2024-11-19 10:50:49 +08:00
Li Jie
8e5fff6c5f build: fix linking args and llgo install 2024-11-19 10:50:45 +08:00
xushiwei
faa9a740db Merge pull request #866 from cpunion/cgo
Full cgo support
2024-11-16 05:33:16 +08:00
xushiwei
70e39e9902 Merge pull request #867 from luoliwoshang/c/clang/file2loc
c/clang:file to loc
2024-11-16 05:31:22 +08:00
Li Jie
9f0b3963cb cgo: support full cgo tags 2024-11-15 16:08:24 +08:00
xushiwei
7ec2ce851c Merge pull request #868 from goplus/dependabot/github_actions/codecov/codecov-action-5
build(deps): bump codecov/codecov-action from 4 to 5
2024-11-15 12:54:29 +08:00
dependabot[bot]
94ee4223d2 build(deps): bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 00:23:06 +00:00
Li Jie
a64f4219e9 cgo: full supports cgo preambles and auto compile c files 2024-11-14 23:44:25 +08:00
luoliwoshang
78e96cc312 c/clang:file to loc 2024-11-14 14:31:20 +08:00
Li Jie
89b111edca cgo: examples 2024-11-13 20:32:12 +08:00
Li Jie
ec38943c53 cl: compile cgo 2024-11-13 20:32:08 +08:00
xushiwei
ea654ef235 Merge pull request #865 from luoliwoshang/clang/include
clang:included & system header
2024-11-12 22:48:58 +08:00
luoliwoshang
288b705450 clang:included & system header 2024-11-12 20:26:33 +08:00
xushiwei
73ca579056 Merge pull request #863 from tsingbx/llcppsigfetch/c.Printf
fix llcppsigfetch: invalid memory address or nil pointer dereference
2024-11-12 15:29:38 +08:00
xushiwei
8b5d7dc181 Merge pull request #859 from goplus/dependabot/github_actions/actions/setup-go-5
build(deps): bump actions/setup-go from 4 to 5
2024-11-12 10:53:14 +08:00
xushiwei
f05f6294cd Merge pull request #861 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.16.2
build(deps): bump github.com/goplus/gogen from 1.16.1 to 1.16.2
2024-11-12 10:52:55 +08:00
tsingbx
b2c466cf3f fix llcppsigfetch: invalid memory address or nil pointer dereference 2024-11-12 09:37:22 +08:00
dependabot[bot]
da1b9a0e91 build(deps): bump github.com/goplus/gogen from 1.16.1 to 1.16.2
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.1 to 1.16.2.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.1...v1.16.2)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 00:38:39 +00:00
dependabot[bot]
6cbb5a9215 build(deps): bump actions/setup-go from 4 to 5
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 00:36:37 +00:00
xushiwei
cfdbb86bfa Merge pull request #856 from cpunion/doc-and-fmt-test
Make docs testable
2024-11-08 16:34:21 +08:00
Li Jie
d61783b2c0 doc: install numpy in virtualenv to run test 2024-11-07 11:34:58 +08:00
Li Jie
65c1e1b9e5 ci: build chore/_xtool/... 2024-11-07 11:03:07 +08:00
Li Jie
17d509a45a doc: make doc testable 2024-11-07 11:03:01 +08:00
Li Jie
c7649766fd c: fix format 2024-11-07 09:47:22 +08:00
xushiwei
c0ec5e53ba Merge pull request #855 from luoliwoshang/libffi
workflow:libffi
2024-11-07 08:01:05 +08:00
xushiwei
a0a18017e8 Merge pull request #851 from luoliwoshang/c/clang/sliceran
c/clang:demo common iterate
2024-11-07 08:00:11 +08:00
xushiwei
411b84fcc2 Merge pull request #854 from luoliwoshang/c/clang/loc2cursor
c/clang:location to cursor
2024-11-07 07:59:43 +08:00
xushiwei
e499eeb8cc Merge pull request #857 from cpunion/fix-pydump
chore: fix types error in pydump
2024-11-07 07:59:15 +08:00
Li Jie
803d1de5db chore: fix types error in pydump 2024-11-06 11:30:35 +08:00
luoliwoshang
fc8117c8e7 workflow:libffi 2024-11-05 17:15:20 +08:00
luoliwoshang
8bef0ede1b c/clang:location to cursor 2024-11-04 15:50:05 +08:00
luoliwoshang
88128cde48 c/clang:demo common iterate 2024-11-04 09:55:35 +08:00
xushiwei
d0217e62f0 Merge pull request #850 from luoliwoshang/ssa/slicelen
ssa:fit unsafe.slice int size
2024-11-04 06:49:34 +08:00
xushiwei
bba680b636 Merge pull request #849 from luoliwoshang/c/clang/visitinclude
c/clang:include
2024-11-04 06:45:27 +08:00
luoliwoshang
feb914b5c4 ssa:fit slice int size 2024-11-01 19:54:44 +08:00
luoliwoshang
0a65ea34f3 c/clang:include 2024-11-01 18:49:48 +08:00
xushiwei
bf299edfc7 Merge pull request #847 from visualfc/reflect.call
[WIP]  internal/lib/reflect: implement reflect.call
2024-11-01 17:41:57 +08:00
visualfc
6b0122547e reflect.call: internal/abi: TFlagClosure, internal/lib/reflect: flagClosure. 2024-11-01 15:27:40 +08:00
xushiwei
88c0e149b5 Merge pull request #793 from visualfc/abitypes
ssa: fix gocvt named recurs for typeargs. support sync.Map
2024-10-30 22:00:22 +08:00
visualfc
38091b2021 ssa: func Instantiate 2024-10-30 21:39:30 +08:00
visualfc
ce87f293aa ssa: fix map key has typeargs 2024-10-30 20:22:05 +08:00
visualfc
dca028a84f ssa: fix goTypes.cvtNamed recurs for typeargs 2024-10-30 20:22:05 +08:00
visualfc
be3c4ab24a ssa: cache types named in runtime 2024-10-30 20:22:05 +08:00
xushiwei
67c9a14902 Merge pull request #846 from visualfc/closureiface
ssa: fix closure type
2024-10-30 11:02:43 +08:00
visualfc
014bdb795f ssa: program.Closure, removeCtx for MakeClosure 2024-10-30 10:42:32 +08:00
visualfc
df7e8b2e64 cl/cltest: TestCompileEx check debug flag 2024-10-30 10:18:58 +08:00
visualfc
2b5fdd3548 ssa: fix closure type 2024-10-29 20:50:02 +08:00
xushiwei
e92a0eb901 Merge pull request #806 from cpunion/llvm-debug
Debug: fix struct vars debug, params modication, supports expressions, lexical scope/lifecycle
2024-10-29 11:09:00 +08:00
xushiwei
e72a67f5de Merge pull request #788 from luoliwoshang/llcppsymg/classname
llcppsymg:refine class fetch,test case,-v
2024-10-28 11:00:55 +08:00
xushiwei
65dc291ff5 Merge pull request #812 from luoliwoshang/llcppsigfetch/refine
llcppsigfetch:cross-platform,log,fix bugs
2024-10-28 10:54:33 +08:00
xushiwei
0bfc190a86 Merge pull request #845 from goplus/dependabot/go_modules/github.com/goplus/gogen-1.16.1
build(deps): bump github.com/goplus/gogen from 1.16.0 to 1.16.1
2024-10-28 10:53:47 +08:00
dependabot[bot]
f8303f2e7a build(deps): bump github.com/goplus/gogen from 1.16.0 to 1.16.1
Bumps [github.com/goplus/gogen](https://github.com/goplus/gogen) from 1.16.0 to 1.16.1.
- [Release notes](https://github.com/goplus/gogen/releases)
- [Commits](https://github.com/goplus/gogen/compare/v1.16.0...v1.16.1)

---
updated-dependencies:
- dependency-name: github.com/goplus/gogen
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 00:44:02 +00:00
张之阳
8ad72b167c Merge pull request #124 from luoliwoshang/llcppsymg/underprefix
llcppsymg:underprefix
2024-10-26 18:56:56 +08:00
luoliwoshang
7747082ae8 llcppsymg:remove one leading underscore only in mac 2024-10-26 18:43:14 +08:00
luoliwoshang
a7727adca2 llcppsigfetch:remove one leading underscore only in mac 2024-10-26 13:09:30 +08:00
xushiwei
028b53816d Merge pull request #844 from luoliwoshang/c/clang/reference
c/clang:referenced
2024-10-25 11:41:40 +08:00
张之阳
5a77117a9b Merge pull request #116 from luoliwoshang/llcppsigfetch/enum_anony
llcppsigfetch:anonymous enumdecl
2024-10-24 17:50:09 +08:00
luoliwoshang
05777019c8 llcppsigfetch:anony enum 2024-10-24 17:46:33 +08:00
luoliwoshang
7ebaad5099 c/clang:referenced 2024-10-24 09:46:52 +08:00
张之阳
09885c8f41 Merge pull request #112 from luoliwoshang/llcppsigfetch/closure
llcppsigfetch:use closure refine collection
2024-10-23 16:06:28 +08:00
luoliwoshang
4f5ebb279d llcppsigfetch:refine field collection 2024-10-23 16:02:39 +08:00
luoliwoshang
91ebf88c97 llcppsigfetch:use fmt to log because linux nil defer of log 2024-10-23 15:44:41 +08:00
luoliwoshang
a608c51e36 llcppsigfetch:fix fopen's return type nil 2024-10-23 15:44:41 +08:00
luoliwoshang
3877dcf83a llcppsigfetch:refine log out 2024-10-23 15:44:41 +08:00
luoliwoshang
72d176b77a llcppsigfetch:-v 2024-10-23 15:44:41 +08:00
luoliwoshang
8840968e07 llcppsigfetch:refine args parse 2024-10-23 15:44:41 +08:00
luoliwoshang
b6b889bff6 llcppsigfetch:remove leading underscores 2024-10-23 15:44:41 +08:00
luoliwoshang
a30bdcbb50 gogensig:unsigned & signed char 2024-10-23 15:44:41 +08:00
luoliwoshang
82275d49a6 llcppg:pipe writer close 2024-10-23 15:44:41 +08:00
luoliwoshang
ee335de222 llcppsigfetch:use stdin 2024-10-23 15:44:41 +08:00
luoliwoshang
01bf7c8c38 llcppsymg & llcppsigfetch parse args 2024-10-23 15:44:41 +08:00
xushiwei
5529a1b0b3 Merge pull request #842 from visualfc/libffi
[WIP] c/ffi x/ffi: import libffi
2024-10-23 14:44:57 +08:00
visualfc
363be18599 x/ffi: wrap c/ffi 2024-10-23 11:44:34 +08:00
xushiwei
ae8ad3b68b Merge pull request #837 from cpunion/const-conv
ssa: fix int constant type conversion
2024-10-23 10:58:08 +08:00
xushiwei
348b850e36 Merge pull request #838 from cpunion/unsafe-fix
fix unsafe
2024-10-23 10:57:22 +08:00
visualfc
92c267758e c/ffi: add _demo 2024-10-23 10:53:18 +08:00
visualfc
b7d1ab6105 c/ffi: import libffi 2024-10-23 10:53:18 +08:00
xushiwei
f7f1b4f594 Merge pull request #775 from visualfc/freevars
cl: function fix freevars cache
2024-10-23 10:49:51 +08:00
xushiwei
6492bea846 Merge pull request #824 from visualfc/chkabi
ssa: abi check interface method
2024-10-23 10:45:06 +08:00
Li Jie
b1cb89b0c2 test: unsafe.{Add, Alignof, Offsetof, String, StringData, SliceData, Slice} 2024-10-21 18:53:05 +08:00
Li Jie
7ecd98b0a0 ssa: fix type of unsafe.SliceData 2024-10-21 18:53:00 +08:00
Li Jie
7d7d4db329 ssa: fix int constant type conversion 2024-10-21 18:50:32 +08:00
luoliwoshang
e6bfe1fc88 llcppsymg:refine args 2024-10-21 18:48:56 +08:00
luoliwoshang
151d3a9610 llcppsymg:libs,cflags parse 2024-10-21 18:48:56 +08:00
luoliwoshang
905ed36afd llcppsymg:symbol debug log 2024-10-21 18:48:56 +08:00
luoliwoshang
7fe9c9366e llcppsymg:linux sys path 2024-10-21 18:48:56 +08:00
luoliwoshang
d5237d1a07 llcppsymg:multiple dylib path search 2024-10-21 18:48:56 +08:00
luoliwoshang
7bd3b29a11 llcppsymg:remove leading underscores 2024-10-21 18:48:56 +08:00
luoliwoshang
60aa74257f chore:remove folder 2024-10-21 18:48:56 +08:00
luoliwoshang
ca0492d997 llcppsymg:config & clangutil test
llcppsymg:clangutil test
2024-10-21 18:48:56 +08:00
luoliwoshang
944133de6e llcppsymg:symbol generate test
llcppsymg:symbo test

llcppsymg:exist symb file test

llcppsymg:GenSymbolTabledata

llcppsymg:GenSymbolTableData test

llcppsymg:full symg operation test
2024-10-21 18:48:56 +08:00
luoliwoshang
174fdd40da llcppsymg:refine dylib parse 2024-10-21 18:48:56 +08:00
luoliwoshang
ffa823f748 llcppsymg:gendylib path test
llcppsymg:headerpath test
2024-10-21 18:48:56 +08:00
luoliwoshang
a83f7a822e llcppsymg:refine logic & parse symbol test 2024-10-21 18:48:56 +08:00
luoliwoshang
29d527bee1 llcppsymg:refine classname fetch 2024-10-21 18:48:56 +08:00
luoliwoshang
75e282c2ac llcppsymg & llcppsigfetch parse args 2024-10-21 18:46:57 +08:00
xushiwei
8419d9114b Merge pull request #839 from cpunion/fix-gh-action
ci: fix python deps install
2024-10-21 18:41:33 +08:00
Li Jie
1c414af7b9 ci: instead pip3 with pip3.12 2024-10-21 18:34:44 +08:00
Li Jie
834e8c64c5 ssa: unsafe.Add 2024-10-21 17:31:58 +08:00
xushiwei
1b3bb86546 Merge pull request #828 from luoliwoshang/os/errno
os:fix os.Errno 's nil pointer derefer in linux
2024-10-21 13:44:56 +08:00
xushiwei
aa560f42e7 Merge pull request #833 from visualfc/funcaddr
cl: instr funcAddr support typec funclit
2024-10-19 16:06:32 +08:00
visualfc
4e69cd28cd cl: instr funcAddr support typec funclit 2024-10-17 20:30:39 +08:00
xushiwei
5f0e30e17a Merge pull request #829 from luoliwoshang/xtool/nm
xtool/nm:flags option & symbol version
2024-10-16 18:11:40 +08:00
luoliwoshang
d682771c35 xtool/nm:symbol version 2024-10-15 15:29:30 +08:00
luoliwoshang
ace3c3e421 nmdump:flags option 2024-10-15 12:01:42 +08:00
luoliwoshang
94005b0c22 xtool/nm:flags option 2024-10-15 10:40:25 +08:00
luoliwoshang
e9177c8932 os/errno:fix os.Errno 's nil pointer derefer in linux 2024-10-12 16:30:14 +08:00
visualfc
d62c2d913e ssa: abi check interface method 2024-10-12 15:59:10 +08:00
xushiwei
9ea88fe247 Merge pull request #827 from luoliwoshang/os/stat
[wip] os:correct error of noexist file & os.Error 's nil pointer dereference in linux
2024-10-12 11:28:32 +08:00
xushiwei
e0867a5d11 Merge pull request #826 from visualfc/reflect_value
internal/lib/reflect: fix valueInterface
2024-10-12 11:27:20 +08:00
luoliwoshang
ae91101ea1 os:correct error of noexist file 2024-10-11 16:22:14 +08:00
visualfc
515057c41a internal/lib/reflect: Value.Type 2024-10-11 09:14:36 +08:00
visualfc
d946ba426e internal/lib/reflect: fix valueInterface 2024-10-11 07:43:46 +08:00
xushiwei
07874cf77f Merge pull request #816 from luoliwoshang/c/lua/debug
c/lua:debug
2024-10-10 15:31:48 +08:00
xushiwei
1d9f9e838b Merge pull request #817 from cpunion/remove-inline-py-methods
py: remove static methods
2024-10-10 15:31:01 +08:00
xushiwei
101691e970 Merge pull request #822 from goplus/dependabot/github_actions/thollander/actions-comment-pull-request-3
build(deps): bump thollander/actions-comment-pull-request from 2 to 3
2024-10-10 15:30:05 +08:00
dependabot[bot]
e2498c31ea build(deps): bump thollander/actions-comment-pull-request from 2 to 3
Bumps [thollander/actions-comment-pull-request](https://github.com/thollander/actions-comment-pull-request) from 2 to 3.
- [Release notes](https://github.com/thollander/actions-comment-pull-request/releases)
- [Commits](https://github.com/thollander/actions-comment-pull-request/compare/v2...v3)

---
updated-dependencies:
- dependency-name: thollander/actions-comment-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-10 00:34:41 +00:00
Li Jie
9d8c6122cc py: remove inline methods 2024-10-05 23:10:00 +08:00
Li Jie
227dda38a2 lldb: fix slice index expression 2024-10-05 17:46:54 +08:00
luoliwoshang
e2091413ea c/lua:extraspace 2024-10-04 15:37:28 +08:00
luoliwoshang
4976e82f0f c/lua:debug 2024-10-04 15:37:28 +08:00
xushiwei
5e949d2c6f Merge pull request #809 from visualfc/maplen
runtime: fix map len and chan len/cap
2024-10-04 11:34:49 +08:00
xushiwei
fec7688241 Merge pull request #810 from visualfc/py
py: remove llgo_autogen.lla
2024-10-01 06:07:04 +08:00
Li Jie
2732f6036e debug: refactor test script 2024-09-30 16:38:37 +08:00
Li Jie
387c44031a ci: show lldb tests details 2024-09-30 16:38:37 +08:00
Li Jie
6cbd1c5fb1 debug: switch scope test 2024-09-30 16:38:37 +08:00
Li Jie
447b9e1ea7 debug: disable failed tests 2024-09-30 16:38:25 +08:00
Li Jie
be08bcaafc debug: compile to dwarf-4 2024-09-30 15:22:38 +08:00
Li Jie
1b5e8e0181 ci: return non-zero if run lldb tests failed 2024-09-30 15:10:12 +08:00
visualfc
d2ffbd0395 cl: function fix freevars cache 2024-09-30 10:29:38 +08:00
Li Jie
88cb607975 debug: supports scope (if, for) 2024-09-30 10:15:47 +08:00
Li Jie
e392956e2a debug: fix basic types 2024-09-27 21:36:12 +08:00
Li Jie
3028081fa2 chore: fix exit code in runtest.sh 2024-09-27 21:36:12 +08:00
Li Jie
4003c59471 ssa: debug info types.Named -> typedef 2024-09-27 21:36:12 +08:00
Li Jie
2e042f0c59 lldb: fix struct vars debugging 2024-09-27 21:36:08 +08:00
visualfc
9a4238d4e2 py: remove llgo_autogen.lla 2024-09-27 10:37:41 +08:00
visualfc
c184dc8d2f runtime: fix map len and chan len/cap 2024-09-25 20:51:58 +08:00
xushiwei
32f41a04ac Merge pull request #757 from luoliwoshang/llcppg/ast/mangle
llcppg/ast:func mangle name
2024-09-25 11:05:06 +08:00
xushiwei
4b8174f75a Merge pull request #803 from luoliwoshang/llcppsigfetch/output
llcppsigfetch:refine
2024-09-24 19:08:53 +08:00
luoliwoshang
313e14bc54 llcppsigfetch:refine mock gettype 2024-09-24 15:09:03 +08:00
luoliwoshang
7aca31992b llcppsigfetch:reuse clangutil 2024-09-24 14:43:33 +08:00
Li Jie
56f53e508f lldb: add more tests 2024-09-24 14:18:32 +08:00
Li Jie
6c18dc63aa build: enable ssa.GlobalDebug when LLGO_DEBUG=1 enabled, enable ssa.NaiveForm when LLGO_OPTIMIZED=0 2024-09-24 14:16:49 +08:00
luoliwoshang
7b498065b5 llcppsigfetch:use the closure in visitTop & enumtype 2024-09-24 12:22:01 +08:00
luoliwoshang
81bd225ff7 llcppsigfetch:keep line break 2024-09-24 11:26:34 +08:00
luoliwoshang
074090a0aa llcppsigfetch:config the output 2024-09-24 11:26:34 +08:00
Li Jie
3fcbcca8e4 lldb: fix log output when exit 2024-09-23 21:14:26 +08:00
xushiwei
dbaf12b043 Merge pull request #769 from visualfc/lib_reflect
[wip] lib reflect
2024-09-23 00:37:28 +08:00
visualfc
9eb9b48534 internal/lib/reflect: type.Field FieldByIndex FieldByName 2024-09-22 20:56:15 +08:00
visualfc
e085fd1d57 internal/lib/reflect: type.Name type.Elem 2024-09-22 20:44:57 +08:00
visualfc
9cc71b320b internal/lib/reflect: type.method 2024-09-22 20:44:55 +08:00
visualfc
7b74cf1ab9 internal/lib/reflect: interface.method 2024-09-22 20:43:40 +08:00
visualfc
fb0c0e07f7 internal/lib/reflect: reflect.pointer 2024-09-22 20:43:40 +08:00
Li Jie
c6bb4a23ae ssa: add debug info of function return type 2024-09-22 17:43:31 +08:00
Li Jie
70e271959b lldb: fix runlldb.sh to load llgo plugin 2024-09-22 14:57:21 +08:00
Li Jie
379abeb262 lldb: support expression includes dereference, parentheses 2024-09-22 14:57:16 +08:00
xushiwei
9e884847b1 Merge pull request #794 from cpunion/llvm-debug
ssa: add llvm debug info
2024-09-22 12:08:16 +08:00
Li Jie
5dadf9a087 lldb: skip some fail cases 2024-09-22 11:52:26 +08:00
Li Jie
c0630b782a ci: run lldb test 2024-09-22 11:52:26 +08:00
Li Jie
62beb73aa2 x 2024-09-22 11:52:26 +08:00
Li Jie
7b6fe0159f lldb: fix shellcheck warning 2024-09-22 11:52:26 +08:00
Li Jie
dad22b1686 cl: switch debug symbols with LLGO_DEBUG 2024-09-22 11:52:23 +08:00
xushiwei
a715a51865 Merge pull request #780 from luoliwoshang/llcppsymg/language
llcppsymg:parse c / c++ &  output  func proto
2024-09-22 08:03:19 +08:00
xushiwei
d4ec2319f9 Merge pull request #683 from luoliwoshang/llcppsigfetch/basic
llcppsigfetch
2024-09-22 07:58:35 +08:00
Li Jie
88b980ac17 lldb: refactor plugin and test scripts 2024-09-21 10:03:49 +08:00
Li Jie
867c01d5e8 ssa: clean 2024-09-21 09:10:08 +08:00
luoliwoshang
c8a064af3e llcppsigfetch:handle unexpect tag 2024-09-21 01:52:19 +08:00
Li Jie
12439f2b99 lldb: debug info test, lldb plugin, readme 2024-09-21 00:11:06 +08:00
Li Jie
fb47ea301f lldb: set llvm.ident to "LLGo Compiler" 2024-09-20 23:40:58 +08:00
Li Jie
6adecbd7aa lldb: add llgo plugin 2024-09-20 23:40:13 +08:00
Li Jie
f71e34fd9f ssa: fix function and global var debug info scope 2024-09-20 17:14:27 +08:00
xushiwei
dfe89588f0 Merge pull request #787 from luoliwoshang/llcppsymg/filter
llcppsymg:filter public method
2024-09-20 15:51:57 +08:00
Li Jie
d89b68a279 cl: don't declare var of ssa.Alloc and ssa.FieldAddr 2024-09-20 12:20:46 +08:00
Li Jie
2a4a01cb7b lldb test: test params 2024-09-20 10:21:37 +08:00
luoliwoshang
c81b7f6bb4 llcppsymg:to camel 2024-09-20 10:16:00 +08:00
Li Jie
0c11afad7a lldb test: clean 2024-09-19 21:49:41 +08:00
Li Jie
d6b26c9975 lldb test: ctrl+d to next interactive, ctrl+c to break 2024-09-19 21:45:39 +08:00
Li Jie
98c628f3eb lldb test: fix formatting 2024-09-19 21:45:34 +08:00
Li Jie
36b2026075 run lldb tests 2024-09-19 20:31:05 +08:00
Li Jie
7c535ff1a3 ssa: complex type name 2024-09-19 20:24:01 +08:00
xushiwei
c6436ea6d1 Merge pull request #800 from hackerchai/feat/c-libuv-thread
feat(c/libuv): Implement thread related funcs
2024-09-19 18:52:35 +08:00
xushiwei
5a8dee3cbe Merge pull request #799 from hackerchai/fix/c-libuv-loop
fix(c/libuv): Add missing essential funcs for uv_loop_t & uv_req_t
2024-09-19 18:50:12 +08:00
xushiwei
d9450d6e12 Merge pull request #798 from spongehah/c/sysconf
c/sysconf
2024-09-19 18:48:41 +08:00
hackerchai
80377b3705 feat(c/libuv): Implement thread related funcs
Signed-off-by: hackerchai <i@hackerchai.com>
2024-09-19 18:44:38 +08:00
hackerchai
847a76b3a2 fix(c/libuv): Add missing essential funcs for uv_loop_t & uv_req_t
Signed-off-by: hackerchai <i@hackerchai.com>
2024-09-19 18:42:31 +08:00
luoliwoshang
2c3d46bb80 llcppsigfetch:order output 2024-09-19 16:49:05 +08:00
luoliwoshang
e0cb6d4531 llcppsigfetch:output fileset 2024-09-19 15:35:42 +08:00
luoliwoshang
78f0177ac4 llcppsymg:use clang's displayname with semantic parent to construct func proto for c/c++ 2024-09-19 14:33:53 +08:00
luoliwoshang
4688434c08 llcppsymg:parse with language config 2024-09-19 14:33:53 +08:00
luoliwoshang
8913eeb1c1 llcppsymg:translation unit util 2024-09-19 14:33:53 +08:00
Li Jie
75574e97cc ssa: fix debug info of local vars 2024-09-19 10:29:11 +08:00
Li Jie
f4089bc164 ssa: struct debug info creation supports resursive 2024-09-19 09:45:26 +08:00
Li Jie
b0f04d91bf cl: fix dbg.declare (and local var) 2024-09-18 23:47:48 +08:00
Li Jie
3b514d194c ssa: remove unused 2024-09-18 23:27:54 +08:00
Li Jie
3ba405383e ssa: fix type name of debug info 2024-09-18 23:04:09 +08:00
Li Jie
87f6c8087f ssa: debug info of global variable 2024-09-18 22:17:49 +08:00
Li Jie
90a83c8f11 ssa: debug info of function/closure 2024-09-18 21:14:04 +08:00
Li Jie
27f892a14b ssa: debug info of chan 2024-09-18 21:14:04 +08:00
Li Jie
bf4525d82d ssa: debug info of Map 2024-09-18 21:14:04 +08:00
Li Jie
6bfb1a7fff ssa: debug info of interface 2024-09-18 21:14:04 +08:00
Li Jie
a53ab7438c ssa: debug info of Array and Slice 2024-09-18 21:14:04 +08:00
Li Jie
d85a080f9b ssa: support string and pointer debug info, fix params debugging 2024-09-18 21:14:04 +08:00
Li Jie
4dbfc9483e support complex debug info 2024-09-18 21:14:04 +08:00
Li Jie
53097ab183 fix debug info of struct parameter, 2024-09-18 21:14:04 +08:00
Li Jie
9978a370f1 x 2024-09-18 21:14:04 +08:00
Li Jie
24995f46cb debug test cover more types 2024-09-18 21:14:04 +08:00
Li Jie
7ddc8c6aeb increase coverage rate 2024-09-18 21:14:04 +08:00
Li Jie
4a447f5c12 cover integers, floats, bool, array, complex 2024-09-18 21:14:04 +08:00
Li Jie
e56647f24d remove unused DILexicalBlock 2024-09-18 21:14:04 +08:00
Li Jie
25238b53c9 hide llvm types on DIBuilder methods 2024-09-18 21:14:04 +08:00
Li Jie
1ed798342a move debug test into _testdata 2024-09-18 21:14:04 +08:00
Li Jie
1d6eb07c62 generate debug with dwarf language C 2024-09-18 21:14:04 +08:00
Li Jie
8e3d76b7ea gentests and cltest supports flags.txt (currently just -dbg used) 2024-09-18 21:14:04 +08:00
Li Jie
d8838503b2 generate llvm.dbg.value 2024-09-18 21:14:04 +08:00
Li Jie
78b7742354 fix argNo with 1-based index 2024-09-18 21:14:04 +08:00
Li Jie
3d9dca47b8 fix dwarf language code 2024-09-18 21:14:04 +08:00
Li Jie
c06c96bc1f add types.Map debug info, more debug symbol tests 2024-09-18 21:14:04 +08:00
Li Jie
db128dbc40 test: debug symbols generation 2024-09-18 21:14:04 +08:00
Li Jie
d6f87a8254 rename debug info class/funcs 2024-09-18 21:14:04 +08:00
Li Jie
4c5f37db0f debug symbols switch 2024-09-18 21:14:04 +08:00
Li Jie
3e5338c902 ssa: add llvm debug info 2024-09-18 21:14:04 +08:00
spongehah
848b7c7a34 c/sysconf 2024-09-18 18:40:16 +08:00
xushiwei
4bf5dd15e9 Merge pull request #796 from luoliwoshang/c/lua/fn
c/lua:custom alloc
2024-09-18 12:04:06 +08:00
张之阳
d4273d8e3f remove redundant fn body 2024-09-17 09:01:44 +08:00
xushiwei
780347776b Merge pull request #795 from cpunion/memset
Use LLVM memset intrinsic for compatibility and performance
2024-09-17 08:44:50 +08:00
xushiwei
5dd6986ad4 Merge pull request #797 from luoliwoshang/c/realloc
c:realloc
2024-09-17 08:40:05 +08:00
luoliwoshang
51bf41009e c:realloc 2024-09-16 23:37:22 +08:00
luoliwoshang
4defe734e2 c/lua:custom alloc for state 2024-09-16 23:33:14 +08:00
luoliwoshang
e3cb4ebfdc c/lua:alloc 2024-09-16 23:30:35 +08:00
luoliwoshang
c6345279cc c/lua:table field operate 2024-09-16 22:16:01 +08:00
luoliwoshang
e5a9af9a31 c/lua:remove redundant 2024-09-16 09:51:55 +08:00
Li Jie
c0e1e31572 rebuild tests 2024-09-14 16:14:50 +08:00
Li Jie
1e58c365ed instead runtime.Zeroinit of memset to compatible build.NaiveForm 2024-09-14 15:44:36 +08:00
luoliwoshang
bf87b76adb llcppsigfetch:variadic order 2024-09-13 16:06:06 +08:00
luoliwoshang
c8e06b5837 llcppsigfetch:func mangled name 2024-09-13 16:02:00 +08:00
luoliwoshang
ee5cd06077 llcppsigfetch:distinguish collect doc&comment 2024-09-13 16:02:00 +08:00
luoliwoshang
140352b637 llcppsigfetch:avoid tab 2024-09-13 16:02:00 +08:00
luoliwoshang
b369321e2f llcppsigfetch:unexpect typedef record type's named anonymous record decl resolve to normal anonymous record refer 2024-09-13 16:02:00 +08:00
luoliwoshang
b9aaba7b16 llcppsigfetch:fix nil type of FuncNoProto in C mode 2024-09-13 16:02:00 +08:00
luoliwoshang
07519732a1 llcppsigfetch:based on language configuration analysis 2024-09-13 16:02:00 +08:00
luoliwoshang
ae71f3c186 llcppsigfetch:extract info command 2024-09-13 16:02:00 +08:00
luoliwoshang
e1236f9deb llcppsigfetch:typedef anonymous record type correct refer by __ANONY_ name 2024-09-13 16:02:00 +08:00
luoliwoshang
3c9bfb5b4d llcppsigfetch:determine unexpected named typedecl in typedef anonymous 2024-09-13 16:02:00 +08:00
luoliwoshang
86b50b0a93 llcppsigfetch:null processing 2024-09-13 16:02:00 +08:00
luoliwoshang
da6706cb93 llcppsigfetch:complex typedef decl 2024-09-13 16:02:00 +08:00
luoliwoshang
2842a109da llcppsigfetch:right reference 2024-09-13 16:02:00 +08:00
luoliwoshang
021ddefb10 llcppsigfetch:dump node type for unmarshal 2024-09-13 16:02:00 +08:00
luoliwoshang
7d0b47c5cb llcppsigfetch:field access & static field 2024-09-13 16:02:00 +08:00
luoliwoshang
9351a1f900 llcppsigfetch:anonymous elaborated type refer 2024-09-13 16:02:00 +08:00
luoliwoshang
0ac48369fe llcppsigfetch:variadic param 2024-09-13 16:02:00 +08:00
luoliwoshang
e57ee17532 llcppsigfetch:func pointer 2024-09-13 16:01:59 +08:00
luoliwoshang
a897683272 Use semantic parent to refactor scoping expression construction 2024-09-13 16:01:59 +08:00
luoliwoshang
38eb981d2c llcppsigfetch:remove redundant test case 2024-09-13 16:01:59 +08:00
luoliwoshang
b524472b9e llcppsigfetch:out of class method 2024-09-13 16:01:59 +08:00
luoliwoshang
fc04083cb2 llcppsigfetch:collect public methods 2024-09-13 16:01:59 +08:00
luoliwoshang
b1225951f2 llcppsigfetch:func inline & static 2024-09-13 16:01:59 +08:00
luoliwoshang
24fd2e1849 llcppsigfetch:free override cursor 2024-09-13 16:01:59 +08:00
luoliwoshang
5e5c975a9c llcppsigfetch:constructor,destructor,static,override,virtual 2024-09-13 16:01:59 +08:00
luoliwoshang
c6336e920f llcppsigfetch:qualified name whith tag 2024-09-13 16:01:59 +08:00
luoliwoshang
cd19625522 llcppsigfetch:enum type 2024-09-13 16:01:59 +08:00
luoliwoshang
3ac95a9213 llcppsigfetch:refactor type reference test logic 2024-09-13 16:01:59 +08:00
luoliwoshang
e57ea9b501 llcppsigfetch/chore:rename 2024-09-13 16:01:59 +08:00
luoliwoshang
14b335a51e llcppsigfetch:correct class scoping 2024-09-13 16:01:59 +08:00
luoliwoshang
319e746a55 llcppsigfetch:qualified name refer 2024-09-13 16:01:59 +08:00
luoliwoshang
eb4d721175 llcppsigfetch:tag expr 2024-09-13 16:01:59 +08:00
luoliwoshang
a4f850c0c6 llcppsigfetch:lvalue & rvalue refer 2024-09-13 16:01:59 +08:00
luoliwoshang
0a8e25b405 llcppsigfetch:simpilfy func test 2024-09-13 16:01:59 +08:00
luoliwoshang
1557a76225 llcppsigfetch:split test directory 2024-09-13 16:01:59 +08:00
luoliwoshang
d4fa379f11 llcppsigfetch:record type 2024-09-13 16:01:59 +08:00
luoliwoshang
e09c5fcb3c llcppsigfetch:TypedefDecl & Elaborated Type Refer 2024-09-13 16:01:59 +08:00
luoliwoshang
815fe25f2c llcppsigfetch:anonymous record name 2024-09-13 16:01:59 +08:00
luoliwoshang
5e5c84ba27 llcppsigfetch:json memory free 2024-09-13 16:01:59 +08:00
luoliwoshang
2974b23f26 llcppsigfetch:refine file handling, remove curFile field 2024-09-13 16:01:59 +08:00
luoliwoshang
697c21b120 llcppsigfetch:typedecl name 2024-09-13 16:01:59 +08:00
luoliwoshang
1f72a52015 llcppsigfetch:free token 2024-09-13 16:01:59 +08:00
luoliwoshang
43bcf1051d llcppsigfetch:union 2024-09-13 16:01:59 +08:00
luoliwoshang
bf8aa502f9 llcppsigfetch:marco tokens & refine test 2024-09-13 16:01:59 +08:00
luoliwoshang
f0e92343cb llcppsigfetch:complex 2024-09-13 16:01:59 +08:00
luoliwoshang
48efd6689e llcppsigfetch:conveter config 2024-09-13 16:01:59 +08:00
luoliwoshang
090e689689 llcppsigfetch:basic enum 2024-09-13 16:01:59 +08:00
luoliwoshang
9d16df5f25 llcppsigfetch:include 2024-09-13 16:01:59 +08:00
luoliwoshang
02651c93a7 llcppsigfetch:basic marco process 2024-09-13 16:01:59 +08:00
luoliwoshang
2b1d4b6672 llcppsigfetch:output result 2024-09-13 16:01:59 +08:00
luoliwoshang
9087dac6fe llcppsigfetch:basic class & struct 's process 2024-09-13 16:01:59 +08:00
luoliwoshang
762ed994c1 llcppsigfetch:Decl Comment 2024-09-13 16:01:59 +08:00
luoliwoshang
2c8a9d1160 llcppsigfetch:Scope Context 2024-09-13 16:01:59 +08:00
luoliwoshang
f613316046 chore:remove the capital of Path 2024-09-13 16:01:59 +08:00
luoliwoshang
6b1bc15f37 llcppsigfetch:Constant & Incomplete Array 2024-09-13 16:01:59 +08:00
luoliwoshang
9a77a0c201 llcppsigfetch:move type test 2024-09-13 16:01:59 +08:00
luoliwoshang
755cdbb238 llcppsigfetch:collect func param name 2024-09-13 16:01:59 +08:00
luoliwoshang
1996db4b95 llcppsigfetch:refine cjson dump logic 2024-09-13 16:01:59 +08:00
luoliwoshang
6297f69e70 llcppsigfetch:basic cjson dump for ast.File 2024-09-13 16:01:59 +08:00
luoliwoshang
a796f9f8a8 llcppsigfetch:tempfile converter option 2024-09-13 16:01:59 +08:00
luoliwoshang
0de9c57ade llcppsigfetch:builtin type convert 2024-09-13 16:01:59 +08:00
luoliwoshang
95dc01cdcb llcppsigfetch:basic fileset 2024-09-13 16:01:59 +08:00
luoliwoshang
364d3996f4 llcppsigfetch:basic process type 2024-09-13 16:01:59 +08:00
luoliwoshang
33af9e878b llcppsigfech:basic struct
llcppsigfetch:basic parse converter

llcppsigfetch:converter top decl

llcppg:converter test
2024-09-13 16:01:59 +08:00
xushiwei
9f8b9ea806 Merge pull request #784 from luoliwoshang/c/clang/displayname
c/clang:displayname & comment range
2024-09-13 15:37:57 +08:00
xushiwei
d53876ee1b Merge pull request #782 from visualfc/runtimetypes
cl: processPkg check runtimeTypes for generic method
2024-09-12 12:47:53 +08:00
xushiwei
4f654e81c8 Merge pull request #792 from visualfc/selects
runtime: fix multi chan recv/send select
2024-09-12 12:46:22 +08:00
visualfc
aa33ddcf19 runtime: fix multi chan recv/send select 2024-09-11 16:09:15 +08:00
xushiwei
c8a57676b4 Merge pull request #783 from cpunion/builtin-llgo-tag
llgen: builtin llgo tag
2024-09-11 11:00:08 +08:00
luoliwoshang
d0d2bc1996 llcppsymg:filter public method 2024-09-10 14:36:26 +08:00
luoliwoshang
2b8d2b0026 c/clang:comment range 2024-09-09 18:35:52 +08:00
luoliwoshang
735953a262 c/clang:displayname 2024-09-09 15:45:09 +08:00
Li Jie
1c686f10a1 llgen: builtin llgo tag 2024-09-09 13:52:15 +08:00
visualfc
b7088510c5 cl: remove checkInstanceNamed 2024-09-09 11:36:39 +08:00
visualfc
3bdb921ee5 cl: processPkg check runtimeTypes for generic method 2024-09-09 11:22:03 +08:00
xushiwei
74b48ff56b Merge pull request #771 from luoliwoshang/chore/llcppsymg/config
llcppsymg:language config
2024-09-08 17:25:49 +08:00
xushiwei
9410370cc5 Merge pull request #777 from luoliwoshang/c/lua/thread
c/lua:thread
2024-09-08 17:22:01 +08:00
luoliwoshang
743ddf83c1 c/lua:thread 2024-09-07 18:55:24 +08:00
luoliwoshang
caa707325a llcppsymg:language config 2024-09-06 09:05:35 +08:00
xushiwei
3c588e67b8 Merge pull request #767 from tsingbx/cjson
Improve the llgo cjson library
2024-09-06 06:56:49 +08:00
xushiwei
6c26dad048 Merge pull request #770 from visualfc/tpfunc
ssa: fix llgo:type c for typeparam named
2024-09-06 06:51:30 +08:00
xushiwei
393e2c125e Merge pull request #772 from luoliwoshang/castdump/typedef
castdump:use UnderlyingType instead CanonicalType in typedef
2024-09-06 06:48:12 +08:00
luoliwoshang
e56dc2ed6a castdump:use UnderlyingType instead CanonicalType 2024-09-05 15:45:36 +08:00
tsingbx
4a449ed85e change comment cBool to cJSON_Bool 2024-09-05 11:01:34 +08:00
tsingbx
88dbe90075 Revert "change comment cBool to Bool"
This reverts commit a6f6451434.
2024-09-05 11:00:20 +08:00
tsingbx
a6f6451434 change comment cBool to Bool 2024-09-05 10:58:40 +08:00
tsingbx
8a4370c1f6 change ParseBytes and ParseString, change JSON_bool to Bool, remove Bool() 2024-09-05 10:55:49 +08:00
xushiwei
7a068450b3 Merge pull request #764 from cpunion/ssa-error-exit
cl: exit 1 when SSA build error
2024-09-05 08:42:21 +08:00
xushiwei
ae3222e4c2 Merge pull request #761 from visualfc/abiname
internal/abi: fix splitName
2024-09-05 08:34:27 +08:00
xushiwei
27b4bfa3fa Merge pull request #758 from luoliwoshang/llcppg/language
llcppg/config:language
2024-09-05 08:32:49 +08:00
xushiwei
8af229947f Merge pull request #765 from cpunion/builtin-llgo-tag
cl: builtin llgo tag
2024-09-05 08:32:06 +08:00
xushiwei
f235a2f539 Merge pull request #763 from luoliwoshang/c/clang/usr
c/clang:usr & range
2024-09-05 08:31:37 +08:00
visualfc
b0ebb479f6 ssa: fix llgo:type c for typeparam named 2024-09-04 21:53:50 +08:00
tsingbx
df92e21520 fix error 2024-09-04 20:31:45 +08:00
tsingbx
a1a25cc57f complete cjson 2024-09-04 20:23:47 +08:00
Li Jie
e9aaf8e0af cl: builtin llgo tag 2024-09-04 10:07:22 +08:00
Li Jie
7a80e407af cl: exit 1 when SSA build error 2024-09-04 09:55:56 +08:00
luoliwoshang
57f8d535fb c/clang:usr & range 2024-09-03 18:33:40 +08:00
赵英杰
170a6096b9 lib/time: patch div and Time.Round 2024-09-03 18:28:15 +08:00
visualfc
fcc444a100 internal/abi: fix splitName 2024-09-03 15:24:08 +08:00
luoliwoshang
8ccb3c21e1 llcppg/config:language 2024-09-03 15:17:03 +08:00
luoliwoshang
0484d4bb77 llcppg/ast:func mangle name 2024-09-03 15:16:36 +08:00
xushiwei
3ce9567f62 Merge pull request #760 from visualfc/cvtnamed
ssa: cvtNamed check typeargs
2024-09-03 15:05:39 +08:00
visualfc
765e812b77 ssa: cvtNamed check typeargs 2024-09-03 11:37:31 +08:00
xushiwei
1a63c9296b Merge pull request #750 from luoliwoshang/llcppg/ast/access
llcppg/ast:field access & static
2024-09-01 05:56:23 +08:00
xushiwei
9510b5aea5 Merge pull request #755 from luoliwoshang/c/lua/dump
c/lua:dump & load
2024-09-01 05:55:47 +08:00
xushiwei
490e859fbf Merge pull request #756 from luoliwoshang/c/fread
c:fread
2024-09-01 05:55:10 +08:00
luoliwoshang
85c4a2fdc2 c/lua:dump & load demo use go file operate 2024-09-01 00:33:00 +08:00
luoliwoshang
3b9c9f6a97 c:fread 2024-08-31 20:49:23 +08:00
luoliwoshang
d1f64d3059 c/lua:dump & load 2024-08-31 20:45:19 +08:00
luoliwoshang
f62bcdc803 llcppg/ast:field access & static 2024-08-30 10:11:23 +08:00
xushiwei
2434fd778f Merge pull request #751 from hackerchai/fix/c-libuv-error-eof
fix(c/libuv): Fix EOF error value
2024-08-30 09:01:53 +08:00
xushiwei
1a38726fb7 Merge pull request #752 from spongehah/c/libuv
feature(c/libuv): Add Idle and Check
2024-08-30 09:01:34 +08:00
赵英杰
24cffb2a69 feature(c/libuv): Add idle and check 2024-08-29 17:52:18 +08:00
hackerchai
527918545e fix(c/libuv): Fix EOF error value
Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-28 17:12:38 +08:00
xushiwei
4d268f67ae Merge pull request #749 from luoliwoshang/c/clang/variadic
c/clang:variadic
2024-08-28 06:23:31 +08:00
luoliwoshang
a65c2f4312 c/clang:variadic 2024-08-27 18:54:41 +08:00
xushiwei
c490f2b849 Merge pull request #692 from spongehah/refactor/c-libuv-remove-go-wrapper
fix(c/libuv): Change the request calling method of echo_server
2024-08-27 05:23:28 +08:00
xushiwei
282f7fc2e3 Merge pull request #747 from luoliwoshang/llcppg/ast/variadic
llcppg/ast:variadic func
2024-08-27 05:21:36 +08:00
xushiwei
52348af8ec Merge pull request #748 from luoliwoshang/c/clang/cursor
c/clang:cursor
2024-08-27 05:20:20 +08:00
luoliwoshang
39d15ead6f c/clang:cursor 2024-08-26 18:47:56 +08:00
luoliwoshang
d232109fce llcppg/ast:variadic func 2024-08-26 15:11:31 +08:00
xushiwei
8e9c43610d Merge pull request #746 from luoliwoshang/c/lua/corroutine
c:lua:coroutine continuation
2024-08-25 17:52:36 +08:00
xushiwei
53a8c20cb9 Merge pull request #743 from luoliwoshang/c/clang/class
c/clang:class & method
2024-08-25 17:51:15 +08:00
xushiwei
333f60a2a6 Merge pull request #744 from aisk/py-set
feat(py): add set type
2024-08-25 17:49:55 +08:00
xushiwei
0bacc20a58 Merge pull request #745 from luoliwoshang/c/lua/userdata
c/lua:userdata
2024-08-25 17:49:14 +08:00
luoliwoshang
3e932c9bdf c/lua:coroutine continuation 2024-08-25 15:31:10 +08:00
luoliwoshang
cf8a170133 c/lua:register 2024-08-25 12:32:31 +08:00
AN Long
67a89d4b6b feat(py): add set discard 2024-08-25 00:05:00 +08:00
luoliwoshang
85c2cda7b6 c/lua:userdata 2024-08-24 15:24:47 +08:00
AN Long
61757a6518 feat(py): add set type 2024-08-24 01:10:31 +08:00
luoliwoshang
e245d08e54 c/clang:func,class,method attr 2024-08-23 23:01:39 +08:00
luoliwoshang
29f797dc24 c/clang:correct order 2024-08-23 22:50:26 +08:00
xushiwei
54ce1d8d2f Merge pull request #738 from luoliwoshang/llcppg/ast/exprnode
llcppg/ast:expr node
2024-08-22 22:33:59 +08:00
xushiwei
8e47f70066 Merge pull request #740 from luoliwoshang/c/clang/nonref
c/clang:noref type
2024-08-22 22:33:30 +08:00
xushiwei
01548089ee Merge pull request #739 from luoliwoshang/llcppg/ast/enumtype
llcppg/ast:enum type
2024-08-22 22:33:07 +08:00
xushiwei
de8d598f46 Merge pull request #741 from luoliwoshang/llcppg/ast/scoping
llcppg/ast:scoping for Tagexpr
2024-08-22 22:32:07 +08:00
luoliwoshang
63aad4b9bf llcppg/ast:scoping for Tagexpr 2024-08-22 17:17:51 +08:00
luoliwoshang
33cdb7a541 c/clang:noref type 2024-08-22 12:18:38 +08:00
luoliwoshang
7c2f769a9a llcppg/ast:enum type 2024-08-22 10:25:02 +08:00
luoliwoshang
e084550390 llcppg/ast:expr 2024-08-22 10:00:19 +08:00
xushiwei
3c282e8cf9 Merge pull request #735 from visualfc/linkname
[wip] ssa: prog.linkname; abi llvm.LinkOnceAnyLinkage always
2024-08-22 05:44:16 +08:00
xushiwei
3c4fbdb50e Merge pull request #733 from luoliwoshang/llcppg/ast/refertype
llcppg/ast:rvalue reference
2024-08-22 05:40:39 +08:00
xushiwei
18cdc28963 Merge pull request #734 from luoliwoshang/llcppg/ast/func
llcppg/ast:func decl
2024-08-22 05:40:05 +08:00
xushiwei
5f004e7167 Merge pull request #736 from luoliwoshang/c/clang/anonymous
c/clang:anonymous record & underlying type
2024-08-22 05:37:00 +08:00
xushiwei
96489607ab Merge pull request #737 from luoliwoshang/llcppg/ast/typeexpr
llcppg/ast:record type
2024-08-22 05:35:55 +08:00
luoliwoshang
7436e44416 llcppg/ast:record type 2024-08-21 20:49:59 +08:00
luoliwoshang
8d30e51603 c/clang:typedef 2024-08-21 18:34:12 +08:00
luoliwoshang
64b582e397 c/clang:anonymous record 2024-08-21 14:55:43 +08:00
luoliwoshang
8b86d07bfc llcppg/ast:func decl 2024-08-21 14:12:24 +08:00
luoliwoshang
e3fefdebe1 llcppg/ast:value reference 2024-08-21 10:39:02 +08:00
xushiwei
46aec4a593 Merge pull request #731 from luoliwoshang/llcppg/ast/tagexpr
llcppg/ast:TagExpr
2024-08-21 06:30:19 +08:00
visualfc
2feb3e1d7a ssa: prog.linkname; abi llvm.LinkOnceAnyLinkage always 2024-08-20 21:11:27 +08:00
luoliwoshang
2609f45799 llcppg/ast:TagExpr 2024-08-20 12:03:21 +08:00
xushiwei
9053cbb90f Merge pull request #732 from luoliwoshang/c/clang/freetoken
c/clang:free tokens
2024-08-20 11:44:32 +08:00
luoliwoshang
3794d7ab65 c/clang:free tokens 2024-08-20 11:10:29 +08:00
xushiwei
7eeca21a05 Merge pull request #730 from xushiwei/q
llgocppg ast/token
2024-08-20 09:05:48 +08:00
xushiwei
70464154c7 Merge pull request #691 from luoliwoshang/llcppg/builtin
llcppg/ast:builtin type
2024-08-20 09:05:34 +08:00
xushiwei
1b29078fad Merge pull request #729 from luoliwoshang/c/clang/elementtype
c/clang:element type
2024-08-20 08:59:29 +08:00
xushiwei
864b078610 llgocppg ast/token 2024-08-20 08:58:43 +08:00
xushiwei
1a8b319ce2 Merge pull request #727 from luoliwoshang/llcppg/ast/marco
llcppg/ast:marco & token
2024-08-20 08:50:28 +08:00
luoliwoshang
a353514fc8 c/clang:element type 2024-08-19 18:07:36 +08:00
luoliwoshang
06e294fb3e llcppg/ast:builtin type 2024-08-19 11:25:47 +08:00
luoliwoshang
961d4c4a3a llcppg/ast:marco & token 2024-08-19 11:25:18 +08:00
xushiwei
876aea39e5 Merge pull request #728 from luoliwoshang/c/clang/tokenkind
c/clang:token kind
2024-08-17 22:37:19 +08:00
luoliwoshang
67be2ba95b c/clang:token kind 2024-08-16 18:46:36 +08:00
xushiwei
53d2d080f4 Merge pull request #726 from visualfc/fixmap
ssa: fix map zero
2024-08-16 16:52:29 +08:00
xushiwei
998fbeb381 Merge pull request #724 from visualfc/gc
build: check -tags nogc
2024-08-16 16:45:59 +08:00
xushiwei
1c6e4b7750 Merge pull request #725 from luoliwoshang/os/tomode
lib/os:fix error fileMode to ModeT
2024-08-16 16:42:28 +08:00
visualfc
8fbe21c79c ssa: fix map zero 2024-08-16 14:51:52 +08:00
visualfc
d6d0faac6e build: check -tags nogc 2024-08-16 11:34:58 +08:00
luoliwoshang
2d4f01e6cb lib/os:fix error fileMode to ModeT 2024-08-16 09:38:00 +08:00
xushiwei
b42ad3170e Merge pull request #722 from xushiwei/q
README: net/textproto
2024-08-15 22:08:48 +08:00
xushiwei
a8dddc81f1 README: net/textproto 2024-08-15 22:08:21 +08:00
xushiwei
2e1e6f784b Merge pull request #714 from luoliwoshang/llcppg/ast/basiclit
llcppg/ast:basiclit
2024-08-15 22:02:47 +08:00
xushiwei
2af9b95c7a Merge pull request #707 from spongehah/golib/net/textproto
lib/net/textproto: patch Dial
2024-08-15 20:58:14 +08:00
xushiwei
90be010c2b Merge pull request #721 from aofei/os
c/os: fix `Execl`, `Execle`, and `Execlp` func signatures
2024-08-15 20:53:31 +08:00
xushiwei
3b6b16cf77 Merge pull request #720 from xushiwei/q
c/pthread: nogc
2024-08-15 20:53:16 +08:00
xushiwei
c0c5c87c29 mv _pthread => _wrap 2024-08-15 20:47:42 +08:00
xushiwei
f5bbf4b515 c/pthread: nogc 2024-08-15 20:43:52 +08:00
Aofei Sheng
c7465608a7 c/os: fix Execl, Execle, and Execlp func signatures 2024-08-15 20:32:54 +08:00
xushiwei
03f0a4289b Merge pull request #719 from aofei/bdwgc
gc: fix missing pthread registration causing unknown thread error
2024-08-15 20:06:21 +08:00
xushiwei
bb2a6b73fe Merge pull request #518 from visualfc/ptrsize
runtime: init abi.Type.PtrBytes
2024-08-15 19:56:56 +08:00
Aofei Sheng
8e66091dd2 gc: fix missing pthread registration causing unknown thread error
- Use `GC_pthread_create` instead of `pthread_create` when GC is
  enabled.
2024-08-15 19:55:05 +08:00
xushiwei
a5c114a848 Merge pull request #693 from luoliwoshang/llcppsymg/unuse-comment
llcppsymg:remove unused bug-fix loop
2024-08-15 19:52:08 +08:00
xushiwei
254b2c27ac Merge pull request #700 from hackerchai/fix/c-net-byte-order-conv-func
refactor(c/net): Use c link instead of manual implement func
2024-08-15 19:45:57 +08:00
xushiwei
29fcb4504c Merge pull request #712 from luoliwoshang/os/mkdirdemo
lib/os:mkdir demo
2024-08-15 19:30:53 +08:00
xushiwei
ec7402b80a Merge pull request #715 from luoliwoshang/c/clang/arraysize
c/clang:array size & raw comment
2024-08-15 19:30:10 +08:00
xushiwei
4501519c4f Merge pull request #716 from aisk/py-tuple-helper
feat(py): Add Python tuple constructor helper
2024-08-15 18:21:51 +08:00
xushiwei
58ad7dab1b Merge pull request #718 from spongehah/c/libuv
refactor(c/libuv): Add multiple struct size
2024-08-15 18:18:58 +08:00
xushiwei
4da26a2f8d Merge pull request #717 from visualfc/funcdecl
ssa: makeInterface check funcdecl => closure
2024-08-15 18:18:28 +08:00
visualfc
9e6aed0760 runtime: init abi.Type.PtrBytes 2024-08-15 15:40:43 +08:00
luoliwoshang
7033f11d56 c/clang:array size & raw comment 2024-08-15 15:29:26 +08:00
赵英杰
8fcac42f34 c/libuv: Add multiple struct size 2024-08-15 10:57:29 +08:00
赵英杰
4a6a97ee75 lib/net/textproto: patch Dial 2024-08-15 10:43:57 +08:00
visualfc
2174d8fe8c ssa: makeInterface check funcdecl => closure 2024-08-15 10:12:18 +08:00
AN Long
eb6f487e2a fix: typo in document 2024-08-14 22:40:55 +08:00
AN Long
6bbe68dfcb test: Add py.Tuple test 2024-08-14 22:07:00 +08:00
AN Long
bbeceae42e feat(py): Add Python tuple constructor helper 2024-08-14 21:45:46 +08:00
luoliwoshang
cfe785762d llcppg/ast:basiclit 2024-08-14 18:27:15 +08:00
luoliwoshang
fdbb329fb6 lib/os:mkdir demo 2024-08-14 15:22:11 +08:00
xushiwei
9f1100b967 Merge pull request #710 from visualfc/sigsegv
[wip] runtime: signal SIGSEGV
2024-08-14 15:09:10 +08:00
xushiwei
94706d6139 Merge pull request #711 from luoliwoshang/os/filemode
lib/os:fileMode to ModeT , `Mkdir` run normally
2024-08-14 15:07:56 +08:00
xushiwei
b63609e2fa Merge pull request #695 from visualfc/instance_abi
cl: makeInterface check instance named
2024-08-14 15:06:07 +08:00
luoliwoshang
84c420139d lib/os:fileMode to ModeT 2024-08-14 14:24:15 +08:00
visualfc
027d21035e runtime: signal SIGSEGV 2024-08-14 11:30:24 +08:00
xushiwei
cc9de01c99 Merge pull request #705 from luoliwoshang/os/mkdir
[wip] lib/os: patch MkdirAll
2024-08-14 10:29:48 +08:00
xushiwei
61c6f240e9 Merge pull request #708 from xushiwei/q
llgo cmptest -gen
2024-08-14 10:27:33 +08:00
luoliwoshang
997d673b83 lib/os:MkdirAll use 1.21.13 2024-08-14 10:22:54 +08:00
xushiwei
6c72846d63 llgo cmptest -gen 2024-08-14 09:47:40 +08:00
luoliwoshang
8bd6e1d119 lib/os: patch MkdirAll 2024-08-14 09:41:16 +08:00
xushiwei
6484a8e6a4 Merge pull request #706 from hackerchai/fix/c-libuv-struct-size
fix(c/libuv): Add multiple struct size
2024-08-14 08:57:54 +08:00
xushiwei
0e8e108680 Merge pull request #701 from aofei/cmptest
cmptest: add support for comparison with `llgo.expect` files
2024-08-14 08:57:20 +08:00
visualfc
3435b6c4a4 cl: makeInterface check instance named 2024-08-13 21:59:19 +08:00
xushiwei
d4af6af594 Merge pull request #703 from visualfc/constuptr
ssa: const support unsafe.pointer
2024-08-13 17:22:12 +08:00
xushiwei
b834abd293 Merge pull request #702 from aofei/os.CreateTemp
lib/os: patch `TempDir`, `MkdirTemp`, `CreateTemp`
2024-08-13 17:13:07 +08:00
xushiwei
01a6dd79c4 Merge pull request #704 from aisk/py-uintptr-to-int
fix(py): Change uintptr to int in container types
2024-08-13 17:10:37 +08:00
hackerchai
948b6cf7e7 fix(c/libuv): Add multiple struct size
Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-13 16:51:42 +08:00
visualfc
b1718f329e ssa: const support unsafe.pointer 2024-08-12 22:01:15 +08:00
AN Long
7237f549a6 fix(py): Change uintptr to int in container types 2024-08-12 21:56:57 +08:00
Aofei Sheng
30b1660005 lib/os: patch TempDir, MkdirTemp, CreateTemp 2024-08-12 18:20:22 +08:00
Aofei Sheng
200fe07473 cmptest: add support for comparison with llgo.expect files
Fixes #671
2024-08-12 13:52:20 +08:00
hackerchai
86cb22d8c9 refactor(c/net): Use c link instead of manual implement func
Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-12 10:53:18 +08:00
xushiwei
321766fd46 Merge pull request #699 from aisk/py-tuple
feat(py): Add more method to tuple object
2024-08-12 09:38:47 +08:00
xushiwei
3eedad96ed Merge pull request #696 from luoliwoshang/c/lua/custom-panic
c/lua:custom panic
2024-08-12 09:36:42 +08:00
AN Long
4b26dac08a feat(py): Add more method to tuple object 2024-08-11 20:40:06 +08:00
luoliwoshang
04ef069a20 c/lua:custom panic 2024-08-10 20:18:31 +08:00
luoliwoshang
b925ed60e3 llcppsymg:remove unused bug-fix loop 2024-08-09 14:20:33 +08:00
xushiwei
dfd85a7c53 Merge pull request #643 from visualfc/defernext
ssa: fix defer move block[0] index
2024-08-09 12:54:46 +08:00
visualfc
6ca63d4c68 ssa: fix defer move block[0] index 2024-08-09 12:07:07 +08:00
赵英杰
2325b547fd fix(c/libuv): Change the request calling method of echo_server 2024-08-09 10:35:14 +08:00
xushiwei
34e454c054 Merge pull request #689 from visualfc/slicetoarray
ssa: SliceToArrayPointer
2024-08-09 09:44:46 +08:00
visualfc
302386d22c ssa: SliceToArrayPointer 2024-08-09 09:02:57 +08:00
xushiwei
210c483635 Merge pull request #687 from xushiwei/q
library syscall: linux fix
2024-08-09 00:33:09 +08:00
xushiwei
8ca4212650 library syscall: linux fix 2024-08-09 00:22:29 +08:00
xushiwei
c91dba5ed6 Merge pull request #686 from xushiwei/q
rollback golang.org/x/tools v0.22.0 => v0.19.0
2024-08-08 23:58:31 +08:00
xushiwei
c8de05f101 rollback golang.org/x/tools v0.22.0 => v0.19.0 2024-08-08 23:52:29 +08:00
xushiwei
0ac7cde498 Merge pull request #684 from visualfc/initafter
cl: build initAfter
2024-08-08 23:05:02 +08:00
visualfc
108829ad9c cl: build initAfter 2024-08-08 21:36:18 +08:00
xushiwei
c5b96f4e9c Merge pull request #681 from luoliwoshang/llcppsymg/refine
llcppsymg:improve parse symbol
2024-08-08 16:26:24 +08:00
luoliwoshang
4c2099d33e llcppg:remove unuse types 2024-08-08 15:18:16 +08:00
luoliwoshang
fe5de95008 llcppsymg:improve parsing process 2024-08-08 15:17:10 +08:00
xushiwei
4b0cfc0751 Merge pull request #677 from tsingbx/bigInt
llgo support big.Int
2024-08-08 14:23:32 +08:00
tsingbx
c2bf05942e add openssl BIGNUM support 2024-08-08 13:34:04 +08:00
tsingbx
df37f80c8e add big.Int Lsh and Rsh and test it 2024-08-08 13:33:14 +08:00
xushiwei
2c19d7218d Merge pull request #680 from xushiwei/q
llcppg design
2024-08-08 11:57:20 +08:00
xushiwei
34899e8d36 llcppg design 2024-08-08 11:49:55 +08:00
xushiwei
bf8c10ed25 Merge pull request #678 from spongehah/refactor/c-libuv-remove-go-wrapper
fix(c/libuv): Adjust comment errors and demo code
2024-08-08 11:33:10 +08:00
xushiwei
93c33e08c2 Merge pull request #679 from xushiwei/hmac
llcppg/ast: ppdNode
2024-08-08 11:31:01 +08:00
xushiwei
3992dd1dd0 Merge pull request #675 from hackerchai/feature/c-net-add-missing-funcs
feat(c/net): Add SockaddrStorage func, Ntohs func & SetSockOpt func
2024-08-08 11:30:48 +08:00
xushiwei
cab29c2be7 llcppg/ast: ppdNode 2024-08-08 11:21:56 +08:00
hackerchai
f582657ffd fix(c/net): Remove unused implicit import
Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-08 10:12:47 +08:00
赵英杰
2823ac1aee fix(c/libuv): Adjust comment errors and demo code 2024-08-08 10:04:20 +08:00
tsingbx
289caa7cc2 add BN_CTX Start, Get, End and Add big.Int Mul and test it 2024-08-08 09:10:31 +08:00
tsingbx
0a8bad46b5 add big.Int Set, Abs, Neg and add test it 2024-08-08 08:31:03 +08:00
xushiwei
aa4f518262 Merge pull request #673 from cpunion/libuv-async
Add libuv async
2024-08-07 21:43:50 +08:00
xushiwei
f76fa879fc Merge pull request #676 from luoliwoshang/xtool/ast/funcproto
castdump:funcproto type & computed enum value
2024-08-07 21:42:47 +08:00
luoliwoshang
8d70aba1f5 castdump:funcproto type & enum value 2024-08-07 20:33:35 +08:00
Li Jie
a44bb35aec libuv: add async 2024-08-07 20:24:43 +08:00
xushiwei
4fda2b656f Merge pull request #672 from luoliwoshang/c/clang/type-tree
castdump:array,typedef,pointer,funcproto,enum & builtin type
2024-08-07 19:15:37 +08:00
xushiwei
e626d00fdf Merge pull request #674 from hackerchai/feature/c-calloc
feat(c): Add Calloc func
2024-08-07 18:39:35 +08:00
hackerchai
bf09e3c3ae feat(c/net): Add SockaddrStorage func, Ntohs func & SetSockOpt func 2024-08-07 18:04:04 +08:00
hackerchai
753dcd3301 feat(c): Add Calloc func 2024-08-07 16:45:17 +08:00
Li Jie
8b5dee510e libuv: add uv_stop 2024-08-07 16:21:12 +08:00
luoliwoshang
9cb73fbf78 castdump:array,typedef,pointer & builtin type 2024-08-07 15:52:26 +08:00
xushiwei
e6b4deb5c4 Merge pull request #657 from hackerchai/fix/c-libuv-missing-func
feat(c/libuv): Add libuv missing funcs & refactor go func style
2024-08-07 15:04:52 +08:00
hackerchai
8848222728 feat(c/libuv): Add GetIoWatcherFd func using LLGoFiles 2024-08-07 14:49:21 +08:00
hackerchai
3cd62994c7 Revert "refactor(c/libuv): Use cgo alias replace struct assertion in fs"
This reverts commit 45ba5b8dc50a13223e05ad673f4e57d7277d3f24.

# Conflicts:
#	c/libuv/net.go
2024-08-07 14:49:20 +08:00
hackerchai
dd93a97790 Revert "feat(c/libuv): Add GetIoWatcherFd func"
This reverts commit 1ce16727b1195a65c8f2c9de07a864ed5e3902ef.

Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-07 14:49:19 +08:00
hackerchai
e40e2d2d14 style(c/libuv): Use go type funcs & update demo(syanc_fs, echo_server) 2024-08-07 14:49:18 +08:00
hackerchai
26f8ce7b5a refactor(c/libuv): Use cgo alias replace struct assertion in fs
refactro(c/libuv): Use cgo alias avoid implicit struct member declaration
2024-08-07 14:49:17 +08:00
hackerchai
9a61e374b5 refactor(c/libuv): Move some func due to libuv doc
doc: https://docs.libuv.org/en/v1.x/
2024-08-07 14:49:16 +08:00
hackerchai
9b12e9819c fix(c/libuv/demo): Fix echo_server stream convert 2024-08-07 14:49:15 +08:00
hackerchai
5d0a91239c feat(c/libuv): Add GetIoWatcherFd func 2024-08-07 14:49:14 +08:00
hackerchai
c848278690 feat(c/libuv): Add uv_close & uv_signal func
Signed-off-by: hackerchai <i@hackerchai.com>

feat(c/libuv): Add uv_signal_stop func

Signed-off-by: hackerchai <i@hackerchai.com>

feat(c/libuv): Add GetIoWatcher, GetFd func & add Io srtuct

Signed-off-by: hackerchai <i@hackerchai.com>

refactor(c/libuv):  Rename some func

refactor(c/libuv): Remove net go wrapper

refactor(c/libuv):  Add GetIoWatcherFd func
2024-08-07 14:49:13 +08:00
luoliwoshang
2ebb929e2c castdump:accessMap 2024-08-07 10:59:27 +08:00
xushiwei
b34334ba93 Merge pull request #669 from visualfc/abimap
ssa: fix abi map init
2024-08-07 07:54:27 +08:00
visualfc
05a01cd803 ssa: fix abi map init 2024-08-06 22:24:21 +08:00
xushiwei
9ac0c06f26 Merge pull request #667 from luoliwoshang/c/clang/type
c/clang:cursor enum & type kind
2024-08-06 22:00:27 +08:00
xushiwei
52af22b0e8 Merge pull request #660 from luoliwoshang/c/clang/fullast
c/clang:full ast dump
2024-08-06 21:56:06 +08:00
luoliwoshang
81cfc73b48 castdump:full ast dump 2024-08-06 21:37:00 +08:00
xushiwei
f892bfccdf Merge pull request #665 from xushiwei/hmac
library: crypto/hmac, internal/fmtsort
2024-08-06 18:56:37 +08:00
xushiwei
dbed8fefac library: crypto/hmac 2024-08-06 18:49:24 +08:00
luoliwoshang
ca14637909 c/clang:type kind 2024-08-06 18:23:31 +08:00
luoliwoshang
7db618fba5 c/clang:cursor enum & access pecifier 2024-08-06 18:23:19 +08:00
xushiwei
29c74c09ce library/README: crypto/hmac, crypto/subtle 2024-08-06 17:19:31 +08:00
xushiwei
a2b5b9f97e library (todo): crypto/hmac, internal/fmtsort 2024-08-06 17:03:22 +08:00
tsingbx
6a05aa4e53 llgo support crypto hmac (#663)
* llgo support crypto/hmac
2024-08-06 16:47:51 +08:00
xushiwei
43fd5d233a Merge pull request #662 from xushiwei/cast
TypedefDecl
2024-08-06 15:10:15 +08:00
xushiwei
0bd39ed035 TypedefDecl 2024-08-06 15:09:39 +08:00
xushiwei
1db8aad039 Merge pull request #661 from xushiwei/cast
llcppg: c/c++ ast
2024-08-06 11:00:51 +08:00
xushiwei
fb2d4267f5 llcppg: c/c++ ast 2024-08-06 11:00:13 +08:00
xushiwei
d7b203ae08 Merge pull request #655 from tsingbx/hmac2
add openssl hmac
2024-08-05 23:21:19 +08:00
xushiwei
3e07f2e3bc Merge pull request #656 from spongehah/golib/net-url
library: net/url
2024-08-05 20:11:31 +08:00
xushiwei
94cf6f6640 Merge pull request #658 from luoliwoshang/c/clang/marco
c/clang:marco content
2024-08-05 20:10:10 +08:00
luoliwoshang
6da5fe4317 c/clang:marco content 2024-08-05 19:38:29 +08:00
赵英杰
3a68dee850 library: net/url 2024-08-05 18:00:27 +08:00
tsingbx
2ccfa6a2e8 add EVP_sha1, EVP_sha224.... 2024-08-05 17:38:01 +08:00
tsingbx
f7bf671050 add openssl hmac
delete GetMD and HMAC function

delete macro

tidy code

add hmac
2024-08-05 16:57:47 +08:00
xushiwei
4bff9cc3df Merge pull request #653 from luoliwoshang/c/clang/marco
[wip] c/clang:marco info
2024-08-05 12:53:23 +08:00
xushiwei
13c68a0184 Merge pull request #654 from visualfc/fixstd
cpp/std: fix std::string def
2024-08-05 12:48:33 +08:00
visualfc
6d92949715 cpp/std: fix std::string def 2024-08-05 11:17:42 +08:00
luoliwoshang
5cf31bd3f3 c/clang:marco info 2024-08-04 17:35:15 +08:00
xushiwei
929d4c8d61 Merge pull request #647 from aofei/ssa-llgolink
ssa: add `llgo:link` support to `Builder.abiMthd`
2024-08-04 12:08:52 +08:00
Aofei Sheng
482f796bad ssa: add llgo:link support to Builder.abiMthd 2024-08-04 11:00:31 +08:00
xushiwei
d85f532ab1 Merge pull request #652 from xushiwei/q
c/os: llgoClearenv
2024-08-04 10:55:03 +08:00
xushiwei
b1654f7807 c/os: llgoClearenv 2024-08-04 10:54:41 +08:00
xushiwei
4f8526e527 Merge pull request #649 from aofei/clearenv
fix(c/os): add missing `clearenv` for macOS
2024-08-04 10:50:18 +08:00
Aofei Sheng
4b568fc469 fix(c/os): add missing clearenv for macOS 2024-08-04 09:58:01 +08:00
xushiwei
d06146ed97 Merge pull request #645 from spongehah/refactor/c-libuv-remove-go-wrapper
refactor(c-libuv): Added TODO(uid) comment & adjusted the position of Handle, Stream, Req, Write, Connect
2024-08-04 07:35:21 +08:00
xushiwei
8e0e809733 Merge pull request #648 from aofei/sync
perf(lib/sync): avoid using `defer`
2024-08-04 07:31:49 +08:00
Aofei Sheng
d1f33a6c4c perf(lib/sync): avoid using defer 2024-08-03 09:05:43 +08:00
赵英杰
b3e1b6fdbf refactor(c-libuv): Added TODO(uid) comment & adjusted the position of Handle, Stream, Req, Write, Connect 2024-08-03 00:25:14 +08:00
xushiwei
0bd259403c Merge pull request #644 from xushiwei/q
library: io/ioutil
2024-08-02 14:35:23 +08:00
xushiwei
c186846463 README: io/ioutil 2024-08-02 14:27:10 +08:00
xushiwei
5f92c3b3fc library: io/ioutil 2024-08-02 14:26:13 +08:00
xushiwei
0665091cef Merge pull request #641 from xushiwei/q
c/openssl: bio, pem, rsa
2024-08-01 23:03:48 +08:00
xushiwei
688d153427 c/openssl: bio, pem, rsa 2024-08-01 22:55:17 +08:00
xushiwei
bec5ba7a73 Merge pull request #638 from luoliwoshang/doc/c/visibile
doc/c:refine symbol visibility desc
2024-08-01 17:17:39 +08:00
xushiwei
acedf4d6a3 Merge pull request #613 from hackerchai/fix/c-libuv-struct
fix(c/libuv): Add libuv fs struct new func & fix async_fs demo
2024-08-01 17:13:51 +08:00
hackerchai
5dd5494f93 refactor(c/libuv): Adapt libuv.Fs struct 2024-08-01 10:57:59 +08:00
hackerchai
f253e4fabe Revert "fix(c/libuv): Add libuv fs struct new func"
This reverts commit 5fdb0a9634b5ecc29ddd50b6e5cce9938bcb7934.

# Conflicts:
#	c/libuv/_wrap/fs.c
#	c/libuv/fs.go
2024-08-01 10:57:58 +08:00
hackerchai
acd09d24d5 fix(c/libuv): Fix async_fs demo return 255 error & pointer not allocated error
Signed-off-by: hackerchai <i@hackerchai.com>

fix(c/libuv): Mv LLGoFiles declaration

Signed-off-by: hackerchai <i@hackerchai.com>

fix(c/libuv/demo): Fix return 255 error & pointer not allocated error

Signed-off-by: hackerchai <i@hackerchai.com>

refactor(c/libuv): Rewrite FsNew() logic

Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-01 10:57:57 +08:00
hackerchai
ceac95c81a fix(c/libuv): Add libuv fs struct new func
Signed-off-by: hackerchai <i@hackerchai.com>
2024-08-01 10:54:01 +08:00
luoliwoshang
47a05d0ea2 doc/c:refine symbol visibility description 2024-08-01 09:54:48 +08:00
xushiwei
d2975479f2 Merge pull request #637 from xushiwei/q
README: math/big
2024-08-01 08:52:27 +08:00
xushiwei
3c238ffae7 Merge pull request #629 from luoliwoshang/doc/c
doc/c: fix incorrect Constructor and Destructor usage in bindings
2024-08-01 08:51:38 +08:00
xushiwei
69f8d1b717 README: math/big 2024-08-01 08:46:37 +08:00
xushiwei
45cd9e65d3 Merge pull request #634 from xushiwei/q
library: math/big.Int (mini-impl for _cmptest/bigintdemo)
2024-08-01 00:38:24 +08:00
xushiwei
2e4b1d8c2b library: math/big.Int (mini-impl for _cmptest/bigintdemo) 2024-08-01 00:32:21 +08:00
luoliwoshang
4e3b65188d doc/c:update implicit destructors description 2024-08-01 00:10:03 +08:00
xushiwei
0ab32e066b Merge pull request #633 from xushiwei/q
c/openssl: bignum, rsa
2024-07-31 23:21:25 +08:00
xushiwei
79d8b00b27 c/openssl: bignum, rsa 2024-07-31 22:34:13 +08:00
xushiwei
eb02c5a451 Merge pull request #631 from xushiwei/q
library: crypto, crypto/{sha1, sha256, sha512}
2024-07-31 19:04:24 +08:00
xushiwei
85509c777d library: crypto 2024-07-31 18:59:25 +08:00
xushiwei
27677f86e4 library: crypto/{sha1, sha256, sha512} 2024-07-31 18:55:46 +08:00
xushiwei
16174ca874 Merge pull request #627 from tsingbx/main
add crypto sha1,sha256,sha512
2024-07-31 18:39:54 +08:00
luoliwoshang
a4e9233231 doc/c:fix incorrect usage in construtors 2024-07-31 15:24:31 +08:00
luoliwoshang
4fdfafa17f doc/c:update destructor usage 2024-07-31 15:10:50 +08:00
tsingbx
c9a7dab419 delete sum 2024-07-31 14:56:03 +08:00
tsingbx
8882d75132 fix test error 2024-07-31 14:36:42 +08:00
tsingbx
f67b15b926 fix test fail 2024-07-31 14:28:15 +08:00
tsingbx
2d7958f726 add crypto sha1, sha256, sha512 2024-07-31 13:56:42 +08:00
xushiwei
36072584d0 Merge pull request #626 from aofei/goreleaser
fix(.goreleaser.yaml): correct ldflags for build version and time
2024-07-31 13:38:40 +08:00
Aofei Sheng
2119e52f55 fix(.goreleaser.yaml): correct ldflags for build version and time 2024-07-31 13:27:54 +08:00
xushiwei
ca1aa6b663 Merge pull request #625 from aofei/opt-deps
ci: install further optional dependencies for demos
2024-07-31 13:00:34 +08:00
xushiwei
10af671b76 Merge pull request #624 from xushiwei/q
library: go/parser (todo)
2024-07-31 13:00:09 +08:00
Aofei Sheng
a4ec6cce96 ci: install further optional dependencies for demos
Achieved 100% pass rate for demo tests, at least on macOS.
2024-07-31 12:34:51 +08:00
xushiwei
5082ba7102 library: go/parser (todo) 2024-07-31 12:29:09 +08:00
xushiwei
7405e7001b Merge pull request #623 from xushiwei/q
library: encoding, go/{token, scanner}
2024-07-31 11:56:09 +08:00
xushiwei
4c70651b81 library: go/{token, scanner} 2024-07-31 11:33:15 +08:00
xushiwei
21b5b60278 Merge pull request #622 from xushiwei/q
library: crypto/rand
2024-07-31 10:30:20 +08:00
xushiwei
0abc5ec452 README: crypto/rand 2024-07-31 10:30:04 +08:00
xushiwei
b1d2d620fa Merge pull request #621 from aofei/deps
deps: require zlib 1.2+
2024-07-31 10:27:47 +08:00
xushiwei
af6e4abe84 library: crypto/rand 2024-07-31 10:26:18 +08:00
Aofei Sheng
45b4315842 deps: require zlib 1.2+ 2024-07-31 09:52:48 +08:00
xushiwei
d2cb96a9e5 Merge pull request #620 from xushiwei/q
c/openssl: rand
2024-07-31 01:33:10 +08:00
xushiwei
a3ff845a14 c/openssl: rand 2024-07-31 01:27:08 +08:00
1088 changed files with 75203 additions and 88382 deletions

48
.github/actions/setup-deps/action.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: "Setup LLGO Dependencies"
description: "Install all required dependencies for LLGO"
inputs:
llvm-version:
description: "LLVM version to install"
required: true
default: "19"
runs:
using: "composite"
steps:
- name: Install macOS dependencies
if: runner.os == 'macOS'
shell: bash
run: |
brew update
brew install llvm@${{inputs.llvm-version}} lld@${{inputs.llvm-version}} bdw-gc openssl libffi libuv
brew link --overwrite llvm@${{inputs.llvm-version}} lld@${{inputs.llvm-version}} libffi
echo "$(brew --prefix llvm@${{inputs.llvm-version}})/bin" >> $GITHUB_PATH
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
cjson # for github.com/goplus/lib/c/cjson
sqlite # for github.com/goplus/lib/c/sqlite
python@3.12 # for github.com/goplus/lib/py
)
brew install "${opt_deps[@]}"
- name: Install Ubuntu dependencies
if: runner.os == 'Linux'
shell: bash
run: |
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm-version}} main" | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y llvm-${{inputs.llvm-version}}-dev clang-${{inputs.llvm-version}} libclang-${{inputs.llvm-version}}-dev lld-${{inputs.llvm-version}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libunwind-dev libuv1-dev
echo "PATH=/usr/lib/llvm-${{inputs.llvm-version}}/bin:$PATH" >> $GITHUB_ENV
# Install optional deps for demos.
#
# NOTE: Keep this list updated as new deps are introduced.
opt_deps=(
libcjson-dev # for github.com/goplus/lib/c/cjson
libsqlite3-dev # for github.com/goplus/lib/c/sqlite
python3.12-dev # for github.com/goplus/lib/py
)
sudo apt-get install -y "${opt_deps[@]}"

51
.github/actions/setup-go/action.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: "Setup Go"
description: "Setup Go environment by downloading and extracting from go.dev"
inputs:
go-version:
description: "The Go version to download and use"
required: true
runs:
using: "composite"
steps:
- name: Download and setup Go
shell: bash
run: |
set -e
GO_VERSION="${{ inputs.go-version }}"
GO_VERSION="${GO_VERSION#go}" # Remove 'go' prefix if present
# Determine OS and architecture
if [[ "$RUNNER_OS" == "macOS" ]]; then
OS="darwin"
ARCH="arm64"
else
OS="linux"
ARCH="amd64"
fi
DOWNLOAD_URL="https://go.dev/dl/go${GO_VERSION}.${OS}-${ARCH}.tar.gz"
echo "Downloading Go from: ${DOWNLOAD_URL}"
# Create temporary directory for download
TMP_DIR=$(mktemp -d)
curl -L "${DOWNLOAD_URL}" -o "${TMP_DIR}/go.tar.gz"
# Remove existing Go installation if any
sudo rm -rf /usr/local/go
# Extract to /usr/local
sudo tar -C /usr/local -xzf "${TMP_DIR}/go.tar.gz"
# Clean up
rm -rf "${TMP_DIR}"
# Add to PATH
echo "/usr/local/go/bin" >> $GITHUB_PATH
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Verify Go installation
shell: bash
run: |
# Verify installation
echo "Verifying Go installation..."
go version

View File

@@ -0,0 +1,35 @@
name: 'Test Hello World'
description: 'Test Hello World with specific Go and module versions'
inputs:
go-version:
description: 'Go version being tested'
required: true
mod-version:
description: 'Go module version to use'
required: true
runs:
using: "composite"
steps:
- name: Test Hello World
shell: bash
run: |
echo "Testing with Go ${{ inputs.go-version }} and go.mod ${{ inputs.mod-version }}"
mkdir -p _test/helloworld && cd _test/helloworld
cat > go.mod << 'EOL'
module hello
go ${{ inputs.mod-version }}
EOL
cat > main.go << 'EOL'
package main
import (
"fmt"
"github.com/goplus/lib/c"
)
func main() {
fmt.Println("Hello, LLGo!")
println("Hello, LLGo!")
c.Printf(c.Str("Hello, LLGo!\n"))
}
EOL
go mod tidy
llgo run .

11
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
coverage:
ignore:
- "chore"
- "cmd"
- "internal/build"
- "internal/llgen"
- "internal/mockable"
- "internal/packages"
- "internal/typepatch"
- "internal/github"
- "xtool"

169
.github/workflows/doc.yml vendored Normal file
View File

@@ -0,0 +1,169 @@
name: Docs
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
doc_verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install embedme
run: npm install -g embedme
- name: Verify README.md embedded code
run: embedme --verify README.md
- name: Link Checker
id: lychee
uses: lycheeverse/lychee-action@v2
with:
args: --max-concurrency 3 --retry-wait-time 15 README.md
remote_install:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Install dependencies on macOS
if: startsWith(matrix.os, 'macos')
run: |
set -e
set -x
source doc/_readme/scripts/install_macos.sh
- name: Install dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
set -e
set -x
source doc/_readme/scripts/install_ubuntu.sh
- name: Test doc code blocks
run: |
set -e
set -x
source doc/_readme/scripts/run.sh
local_install:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Install dependencies on macOS
if: startsWith(matrix.os, 'macos')
run: |
set -e
set -x
source doc/_readme/scripts/install_macos.sh
- name: Install dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
set -e
set -x
source doc/_readme/scripts/install_ubuntu.sh
- name: Install llgo with tools
run: |
set -e
set -x
git() {
if [ "$1" = "clone" ]; then
# do nothing because we already have the branch
cd ..
else
command git "$@"
fi
}
source doc/_readme/scripts/install_llgo.sh
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Test doc code blocks
run: |
set -e
set -x
source doc/_readme/scripts/run.sh
local_install_full:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Install dependencies on macOS
if: startsWith(matrix.os, 'macos')
run: |
set -e
set -x
source doc/_readme/scripts/install_macos.sh
- name: Install dependencies on Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
set -e
set -x
source doc/_readme/scripts/install_ubuntu.sh
echo "PATH=/usr/lib/llvm-19/bin:$PATH" >> $GITHUB_ENV
- name: Install llgo with tools
run: |
set -e
set -x
git() {
if [ "$1" = "clone" ]; then
# do nothing because we already have the branch
cd ..
else
command git "$@"
fi
}
source doc/_readme/scripts/install_full.sh
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Test doc code blocks
run: |
set -e
set -x
source doc/_readme/scripts/run.sh

30
.github/workflows/fmt.yml vendored Normal file
View File

@@ -0,0 +1,30 @@
name: Format Check
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Check formatting
run: |
for dir in . runtime; do
pushd $dir
if [ -n "$(go fmt ./... | grep -v gop_autogen.go)" ]; then
echo "Some files are not properly formatted. Please run 'go fmt ./...'"
exit 1
fi
popd
done
echo "All files are properly formatted."

View File

@@ -5,38 +5,26 @@ name: Go
on:
push:
branches: [ "*" ]
branches: ["**"]
pull_request:
branches: [ "*" ]
branches: ["**"]
jobs:
test:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [18]
runs-on: ${{ matrix.os }}
llvm: [19]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
if: startsWith(matrix.os, 'macos')
run: |
brew update
brew install llvm@${{ matrix.llvm }} pkg-config bdw-gc openssl cjson sqlite python@3.12
echo "$(brew --prefix llvm@${{ matrix.llvm }})/bin" >> $GITHUB_PATH
- name: Install dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{ matrix.llvm }} main" | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} lld-${{ matrix.llvm }} pkg-config libgc-dev libssl-dev libcjson-dev libsqlite3-dev python3.12-dev
echo "/usr/lib/llvm-${{ matrix.llvm }}/bin" >> $GITHUB_PATH
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Clang information
run: |
@@ -45,48 +33,22 @@ jobs:
clang --version
- name: Set up Go
uses: actions/setup-go@v5
uses: ./.github/actions/setup-go
with:
go-version: '1.20'
go-version: "1.24.2"
- name: Build
run: go build -v ./...
- name: Test
if: matrix.os != 'macos-latest'
run: go test -v ./...
if: ${{!startsWith(matrix.os, 'macos')}}
run: go test ./...
- name: Test with coverage
if: matrix.os == 'macos-latest'
run: go test -v -coverprofile="coverage.txt" -covermode=atomic ./...
- name: Install
run: go install ./...
- name: LLGO tests
if: matrix.os != 'ubuntu-latest'
run: |
echo "Test result on ${{ matrix.os }} with LLVM ${{ matrix.llvm }}" > result.md
LLGOROOT=$PWD bash .github/workflows/test_llgo.sh
- name: Test _demo and _pydemo
run: |
set +e
LLGOROOT=$PWD bash .github/workflows/test_demo.sh
exit 0
- name: Show test result
run: cat result.md
- name: PR comment with test result
uses: thollander/actions-comment-pull-request@v2
if: false
with:
filePath: result.md
comment_tag: test-result-on-${{ matrix.os }}-with-llvm-${{ matrix.llvm }}
if: startsWith(matrix.os, 'macos')
run: go test -coverprofile="coverage.txt" -covermode=atomic ./...
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: goplus/llgo
token: ${{secrets.CODECOV_TOKEN}}

247
.github/workflows/llgo.yml vendored Normal file
View File

@@ -0,0 +1,247 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: LLGo
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
download-model:
runs-on: ubuntu-latest
steps:
- name: Download model file
run: |
mkdir -p ./_demo/llama2-c
wget -P ./_demo/llama2-c https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
- name: Upload model as artifact
uses: actions/upload-artifact@v4
with:
name: llama2-model
path: ./_demo/llama2-c/stories15M.bin
retention-days: 1
llgo:
needs: download-model
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [19]
go: ["1.21.13", "1.22.12", "1.23.6", "1.24.2"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Download model artifact
uses: actions/download-artifact@v4
with:
name: llama2-model
path: ./_demo/llama2-c/
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/lib/py/numpy
torch # for github.com/goplus/lib/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Install
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
- name: _xtool build tests
run: |
cd _xtool
llgo build -v ./...
- name: Test demos
run: |
# TODO(lijie): force python3-embed to be linked with python-3.12-embed
# Currently, python3-embed is python-3.13-embed, doesn't work with pytorch
# Will remove this after pytorch is fixed.
pcdir=$HOME/pc
mkdir -p $pcdir
libdir=$(pkg-config --variable=libdir python-3.12-embed)
echo "libdir: $libdir"
ln -s $libdir/pkgconfig/python-3.12-embed.pc $pcdir/python3-embed.pc
export PKG_CONFIG_PATH=$pcdir
bash .github/workflows/test_demo.sh
- name: Show test result
run: cat result.md
- name: LLDB tests
if: ${{startsWith(matrix.os, 'macos')}}
run: |
echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}"
bash _lldb/runtest.sh -v
test:
continue-on-error: true
strategy:
matrix:
os:
- macos-latest
- ubuntu-24.04
llvm: [19]
go: ["1.24.2"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Install further optional dependencies for demos
run: |
py_deps=(
numpy # for github.com/goplus/lib/py/numpy
torch # for github.com/goplus/lib/py/torch
)
pip3.12 install --break-system-packages "${py_deps[@]}"
- name: Set up Go for build
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Install
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
- name: run llgo test
run: |
llgo test ./...
hello:
continue-on-error: true
strategy:
matrix:
os: [ubuntu-24.04, macos-latest]
llvm: [19]
go: ["1.21.13", "1.22.12", "1.23.6", "1.24.2"]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Set up Go 1.23 for building llgo
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Install llgo
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Set up Go for testing
uses: ./.github/actions/setup-go
with:
go-version: ${{matrix.go}}
- name: Test Hello World with go.mod 1.21
if: startsWith(matrix.go, '1.21') || startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.21"
- name: Test Hello World with go.mod 1.22
if: startsWith(matrix.go, '1.22') || startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.22"
- name: Test Hello World with go.mod 1.23
if: startsWith(matrix.go, '1.23') || startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.23"
- name: Test Hello World with go.mod 1.24
if: startsWith(matrix.go, '1.24')
uses: ./.github/actions/test-helloworld
with:
go-version: ${{matrix.go}}
mod-version: "1.24"
cross-compile:
continue-on-error: true
strategy:
matrix:
os: [macos-latest]
llvm: [19]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup-deps
with:
llvm-version: ${{matrix.llvm}}
- name: Set up Go for building llgo
uses: ./.github/actions/setup-go
with:
go-version: "1.24.2"
- name: Install wamr
run: |
git clone https://github.com/bytecodealliance/wasm-micro-runtime.git
mkdir wasm-micro-runtime/product-mini/platforms/darwin/build
cd wasm-micro-runtime/product-mini/platforms/darwin/build
cmake -D WAMR_BUILD_EXCE_HANDLING=1 -D WAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_SHARED_MEMORY=1 -DWAMR_BUILD_LIB_WASI_THREADS=1 -DWAMR_BUILD_LIB_PTHREAD=1 -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DEBUG_INTERP=1 ..
make -j8
echo "$PWD" >> $GITHUB_PATH
- name: Install llgo
run: |
go install ./...
echo "LLGO_ROOT=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Test Cross Compilation (wasm)
shell: bash
working-directory: _demo
run: |
echo "Testing cross-compilation wasm with Go 1.24.2"
# Compile for wasm architecture
GOOS=wasip1 GOARCH=wasm llgo build -o hello -tags=nogc -v ./helloc
# Check file type
file hello.wasm
# Run the wasm binary using llgo_wasm
iwasm --stack-size=819200000 --heap-size=800000000 hello.wasm

View File

@@ -6,12 +6,12 @@ TMPDIR="$(mktemp -d)"
export TMPDIR
trap 'rm -rf "${TMPDIR}"' EXIT
DARWIN_AMD64_LLVM_PREFIX=.sysroot/darwin/amd64/usr/local/opt/llvm@18
DARWIN_ARM64_LLVM_PREFIX=.sysroot/darwin/arm64/opt/homebrew/opt/llvm@18
DARWIN_AMD64_LLVM_PREFIX=.sysroot/darwin/amd64/usr/local/opt/llvm@19
DARWIN_ARM64_LLVM_PREFIX=.sysroot/darwin/arm64/opt/homebrew/opt/llvm@19
mkdir -p "${DARWIN_AMD64_LLVM_PREFIX}" "${DARWIN_ARM64_LLVM_PREFIX}"
BREW_LLVM_FORMULA_JSON="$(mktemp)"
curl -fsSL https://formulae.brew.sh/api/formula/llvm.json > "${BREW_LLVM_FORMULA_JSON}"
curl -fsSL https://formulae.brew.sh/api/formula/llvm@19.json > "${BREW_LLVM_FORMULA_JSON}"
BREW_LLVM_AMD64_BOTTLE_URL=$(jq -r '.bottle.stable.files.sonoma.url' "${BREW_LLVM_FORMULA_JSON}")
BREW_LLVM_ARM64_BOTTLE_URL=$(jq -r '.bottle.stable.files.arm64_sonoma.url' "${BREW_LLVM_FORMULA_JSON}")
curl -fsSL -H "Authorization: Bearer QQ==" "${BREW_LLVM_AMD64_BOTTLE_URL}" | tar -xzf - --strip-components=2 -C "${DARWIN_AMD64_LLVM_PREFIX}"

View File

@@ -19,10 +19,10 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y lsb-release gnupg2 wget rsync
echo "deb http://apt.llvm.org/\$(lsb_release -cs)/ llvm-toolchain-\$(lsb_release -cs)-18 main" | tee /etc/apt/sources.list.d/llvm.list
echo "deb http://apt.llvm.org/\$(lsb_release -cs)/ llvm-toolchain-\$(lsb_release -cs)-19 main" | tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
apt-get update
apt-get install -y llvm-18-dev
apt-get install -y llvm-19-dev
error() {
echo -e "\$1" >&2
@@ -106,7 +106,6 @@ do-sync() {
args+=(-d)
args+=(-h)
args+=(--keep-dirlinks)
args+=("--info=progress2")
args+=(--delete)
args+=(--prune-empty-dirs)
args+=(--sparse)
@@ -139,5 +138,8 @@ populate_linux_sysroot() {
debian:bullseye \
/populate_linux_sysroot.sh
}
populate_linux_sysroot amd64 "${LINUX_AMD64_PREFIX}"
populate_linux_sysroot arm64 "${LINUX_ARM64_PREFIX}"
populate_linux_sysroot amd64 "${LINUX_AMD64_PREFIX}" &
populate_linux_sysroot arm64 "${LINUX_ARM64_PREFIX}" &
# Wait for both background processes to complete
wait

View File

@@ -32,9 +32,11 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version: 1.24.x
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:qemu-v7.0.0-28
- name: Download Darwin sysroot tarball
uses: actions/download-artifact@v4
with:

View File

@@ -1,14 +1,15 @@
#!/bin/bash
set -e
# llgo run subdirectories under _demo and _pydemo
# llgo run subdirectories under _demo and _pydemo that contain *.go files
total=0
failed=0
failed_cases=""
for d in ./_demo/* ./_pydemo/*; do
total=$((total+1))
if [ -d "$d" ]; then
if [ -d "$d" ] && [ -n "$(ls "$d"/*.go 2>/dev/null)" ]; then
total=$((total+1))
echo "Testing $d"
if ! llgo run "$d"; then
if ! (cd "$d" && llgo run .); then
echo "FAIL"
failed=$((failed+1))
failed_cases="$failed_cases\n* :x: $d"

View File

@@ -1,38 +0,0 @@
#!/bin/bash
set -e
export LLGOROOT=$PWD
testcmd=/tmp/test
llgo build -o $testcmd ./c/bdwgc/_test
cases=$($testcmd)
total=$(echo "$cases" | wc -l | tr -d ' ')
failed=0
failed_cases=""
for idx in $(seq 1 $((total))); do
case=$(echo "$cases" | sed -n "${idx}p")
case_name=$(echo "$case" | cut -d',' -f2)
echo "=== Test case: $case_name"
set +e
out=$("$testcmd" "$((idx-1))" 2>&1)
exit_code=$?
set -e
if [ "${exit_code:-0}" -ne 0 ]; then
echo "failed: $out"
failed=$((failed+1))
failed_cases="$failed_cases\n* :x: $case_name"
else
echo "passed"
fi
done
echo "=== Done"
echo "$((total-failed))/$total tests passed"
if [ "$failed" -ne 0 ]; then
echo ":bangbang: Failed llgo cases:" | tee -a result.md
echo -e "$failed_cases" | tee -a result.md
exit 1
else
echo ":white_check_mark: All llgo tests passed" | tee -a result.md
fi

4
.gitignore vendored
View File

@@ -22,10 +22,14 @@ _tinygo/
_output/
build.dir/
.vscode/
.venv/
# Test binary, built with `go test -c`
*.test
# Debug symbols
*.dSYM
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
*.swp

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "c/llama2/llama2.c"]
path = c/llama2/llama2.c
url = https://github.com/karpathy/llama2.c.git

View File

@@ -17,65 +17,69 @@ before:
builds:
- id: llgo-darwin-amd64
main: ./cmd/llgo
binary: bin/llgo
flags:
- -tags=darwin,amd64,byollvm
ldflags:
- -X github.com/goplus/llgo/xtool/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/xtool/env.buildDate={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/local/opt/llvm@18/bin/llvm-config
- -X github.com/goplus/llgo/internal/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/internal/env.buildTime={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/local/opt/llvm@19/bin/llvm-config
env:
- CC=o64-clang
- CXX=o64-clang++
- CGO_CPPFLAGS=-I{{.Env.SYSROOT_DARWIN_AMD64}}/usr/local/opt/llvm@18/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=-L{{.Env.SYSROOT_DARWIN_AMD64}}/usr/local/opt/llvm@18/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM-18 -lz -lm
- CGO_CPPFLAGS=-I{{.Env.SYSROOT_DARWIN_AMD64}}/usr/local/opt/llvm@19/include -mmacosx-version-min=10.13 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=-L{{.Env.SYSROOT_DARWIN_AMD64}}/usr/local/opt/llvm@19/lib -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM-19 -lz -lm
targets:
- darwin_amd64
mod_timestamp: "{{.CommitTimestamp}}"
- id: llgo-darwin-arm64
main: ./cmd/llgo
binary: bin/llgo
flags:
- -tags=darwin,arm64,byollvm
ldflags:
- -X github.com/goplus/llgo/xtool/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/xtool/env.buildDate={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/opt/homebrew/opt/llvm@18/bin/llvm-config
- -X github.com/goplus/llgo/internal/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/internal/env.buildTime={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/opt/homebrew/opt/llvm@19/bin/llvm-config
env:
- CC=oa64-clang
- CXX=oa64-clang++
- CGO_CPPFLAGS=-I{{.Env.SYSROOT_DARWIN_ARM64}}/opt/homebrew/opt/llvm@18/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=-L{{.Env.SYSROOT_DARWIN_ARM64}}/opt/homebrew/opt/llvm@18/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM-18 -lz -lm
- CGO_CPPFLAGS=-I{{.Env.SYSROOT_DARWIN_ARM64}}/opt/homebrew/opt/llvm@19/include -mmacosx-version-min=10.13 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=-L{{.Env.SYSROOT_DARWIN_ARM64}}/opt/homebrew/opt/llvm@19/lib -mmacosx-version-min=10.13 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVM-19 -lz -lm
targets:
- darwin_arm64
mod_timestamp: "{{.CommitTimestamp}}"
- id: llgo-linux-amd64
main: ./cmd/llgo
binary: bin/llgo
flags:
- -tags=linux,amd64,byollvm
ldflags:
- -X github.com/goplus/llgo/xtool/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/xtool/env.buildDate={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/lib/llvm-18/bin/llvm-config
- -X github.com/goplus/llgo/internal/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/internal/env.buildTime={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/lib/llvm-19/bin/llvm-config
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- CGO_CPPFLAGS=--sysroot={{.Env.SYSROOT_LINUX_AMD64}} -I{{.Env.SYSROOT_LINUX_AMD64}}/usr/include/llvm-18 -I{{.Env.SYSROOT_LINUX_AMD64}}/usr/include/llvm-c-18 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=--sysroot={{.Env.SYSROOT_LINUX_AMD64}} -L{{.Env.SYSROOT_LINUX_AMD64}}/usr/lib/llvm-18/lib -lLLVM-18
- CGO_CPPFLAGS=--sysroot={{.Env.SYSROOT_LINUX_AMD64}} -I{{.Env.SYSROOT_LINUX_AMD64}}/usr/include/llvm-19 -I{{.Env.SYSROOT_LINUX_AMD64}}/usr/include/llvm-c-19 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=--sysroot={{.Env.SYSROOT_LINUX_AMD64}} -L{{.Env.SYSROOT_LINUX_AMD64}}/usr/lib/llvm-19/lib -lLLVM-19
targets:
- linux_amd64
mod_timestamp: "{{.CommitTimestamp}}"
- id: llgo-linux-arm64
main: ./cmd/llgo
binary: bin/llgo
flags:
- -tags=linux,arm64,byollvm
ldflags:
- -X github.com/goplus/llgo/xtool/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/xtool/env.buildDate={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/lib/llvm-18/bin/llvm-config
- -X github.com/goplus/llgo/internal/env.buildVersion=v{{.Version}}
- -X github.com/goplus/llgo/internal/env.buildTime={{.Date}}
- -X github.com/goplus/llgo/xtool/env/llvm.ldLLVMConfigBin=/usr/lib/llvm-19/bin/llvm-config
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
- CGO_CPPFLAGS=--sysroot={{.Env.SYSROOT_LINUX_ARM64}} -I{{.Env.SYSROOT_LINUX_ARM64}}/usr/include/llvm-18 -I{{.Env.SYSROOT_LINUX_ARM64}}/usr/include/llvm-c-18 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=--sysroot={{.Env.SYSROOT_LINUX_ARM64}} -L{{.Env.SYSROOT_LINUX_ARM64}}/usr/lib/llvm-18/lib -lLLVM-18
- CGO_CPPFLAGS=--sysroot={{.Env.SYSROOT_LINUX_ARM64}} -I{{.Env.SYSROOT_LINUX_ARM64}}/usr/include/llvm-19 -I{{.Env.SYSROOT_LINUX_ARM64}}/usr/include/llvm-c-19 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
- CGO_LDFLAGS=--sysroot={{.Env.SYSROOT_LINUX_ARM64}} -L{{.Env.SYSROOT_LINUX_ARM64}}/usr/lib/llvm-19/lib -lLLVM-19
targets:
- linux_arm64
mod_timestamp: "{{.CommitTimestamp}}"
@@ -88,6 +92,7 @@ archives:
files:
- LICENSE
- README.md
- runtime
checksum:
name_template: "{{.ProjectName}}{{.Version}}.checksums.txt"

213
README.md
View File

@@ -24,33 +24,35 @@ How can these be achieved?
LLGo := Go + C + Python
```
LLGo is compatible with C and Python through the language's **Application Binary Interface (ABI)**, while LLGo is compatible with Go through its **syntax (source code)**.
LLGo is compatible with C and Python through the language's **Application Binary Interface (ABI)**, while LLGo is compatible with Go through its **syntax (source code)**. And here C doesn't just include C, but all languages that are ABI compatible with C, including C/C++, Objective-C, Swift, etc.
## C/C++ standard libary support
You can import a C/C++ standard library in LLGo!
* [c](https://pkg.go.dev/github.com/goplus/llgo/c)
* [c/syscall](https://pkg.go.dev/github.com/goplus/llgo/c/syscall)
* [c/sys](https://pkg.go.dev/github.com/goplus/llgo/c/sys)
* [c/os](https://pkg.go.dev/github.com/goplus/llgo/c/os)
* [c/math](https://pkg.go.dev/github.com/goplus/llgo/c/math)
* [c/math/cmplx](https://pkg.go.dev/github.com/goplus/llgo/c/math/cmplx)
* [c/math/rand](https://pkg.go.dev/github.com/goplus/llgo/c/math/rand)
* [c/pthread](https://pkg.go.dev/github.com/goplus/llgo/c/pthread)
* [c/pthread/sync](https://pkg.go.dev/github.com/goplus/llgo/c/pthread/sync)
* [c/sync/atomic](https://pkg.go.dev/github.com/goplus/llgo/c/sync/atomic)
* [c/time](https://pkg.go.dev/github.com/goplus/llgo/c/time)
* [c/net](https://pkg.go.dev/github.com/goplus/llgo/c/net)
* [cpp/std](https://pkg.go.dev/github.com/goplus/llgo/cpp/std)
* [c](https://pkg.go.dev/github.com/goplus/lib/c)
* [c/syscall](https://pkg.go.dev/github.com/goplus/lib/c/syscall)
* [c/sys](https://pkg.go.dev/github.com/goplus/lib/c/sys)
* [c/os](https://pkg.go.dev/github.com/goplus/lib/c/os)
* [c/math](https://pkg.go.dev/github.com/goplus/lib/c/math)
* [c/math/cmplx](https://pkg.go.dev/github.com/goplus/lib/c/math/cmplx)
* [c/math/rand](https://pkg.go.dev/github.com/goplus/lib/c/math/rand)
* [c/pthread](https://pkg.go.dev/github.com/goplus/lib/c/pthread)
* [c/pthread/sync](https://pkg.go.dev/github.com/goplus/lib/c/pthread/sync)
* [c/sync/atomic](https://pkg.go.dev/github.com/goplus/lib/c/sync/atomic)
* [c/time](https://pkg.go.dev/github.com/goplus/lib/c/time)
* [c/net](https://pkg.go.dev/github.com/goplus/lib/c/net)
* [cpp/std](https://pkg.go.dev/github.com/goplus/lib/cpp/std)
Here is a simple example:
<!-- embedme doc/_readme/llgo_simple/simple.go -->
```go
package main
import "github.com/goplus/llgo/c"
import "github.com/goplus/lib/c"
func main() {
c.Printf(c.Str("Hello world\n"))
@@ -73,10 +75,12 @@ llgo run .
```
## How support C/C++ and Python
## How to support C/C++ and Python
LLGo use `go:linkname` to link an extern symbol througth its ABI:
<!-- embedme doc/_readme/llgo_call_c/call_c.go#L3-L6 -->
```go
import _ "unsafe" // for go:linkname
@@ -86,6 +90,8 @@ func Sqrt(x float64) float64
You can directly integrate it into [your own code](_demo/linkname/linkname.go):
<!-- embedme doc/_readme/llgo_call_c/call_c.go -->
```go
package main
@@ -99,12 +105,14 @@ func main() {
}
```
Or put it into a package (see [c/math](c/math/math.go)):
Or put it into a package (see [c/math](https://github.com/goplus/lib/tree/main/c/math/math.go)):
<!-- embedme doc/_readme/llgo_call_cmath/call_cmath.go -->
```go
package main
import "github.com/goplus/llgo/c/math"
import "github.com/goplus/lib/c/math"
func main() {
println("sqrt(2) =", math.Sqrt(2))
@@ -118,30 +126,32 @@ You can import a Python library in LLGo!
And you can import any Python library into `llgo` through a program called `llpyg` (see [Development tools](#development-tools)). The following libraries have been included in `llgo`:
* [py](https://pkg.go.dev/github.com/goplus/llgo/py) (abi)
* [py/std](https://pkg.go.dev/github.com/goplus/llgo/py/std) (builtins)
* [py/sys](https://pkg.go.dev/github.com/goplus/llgo/py/sys)
* [py/os](https://pkg.go.dev/github.com/goplus/llgo/py/os)
* [py/math](https://pkg.go.dev/github.com/goplus/llgo/py/math)
* [py/json](https://pkg.go.dev/github.com/goplus/llgo/py/json)
* [py/inspect](https://pkg.go.dev/github.com/goplus/llgo/py/inspect)
* [py/statistics](https://pkg.go.dev/github.com/goplus/llgo/py/statistics)
* [py/numpy](https://pkg.go.dev/github.com/goplus/llgo/py/numpy)
* [py/pandas](https://pkg.go.dev/github.com/goplus/llgo/py/pandas)
* [py/torch](https://pkg.go.dev/github.com/goplus/llgo/py/torch)
* [py/matplotlib](https://pkg.go.dev/github.com/goplus/llgo/py/matplotlib)
* [py](https://pkg.go.dev/github.com/goplus/lib/py) (abi)
* [py/std](https://pkg.go.dev/github.com/goplus/lib/py/std) (builtins)
* [py/sys](https://pkg.go.dev/github.com/goplus/lib/py/sys)
* [py/os](https://pkg.go.dev/github.com/goplus/lib/py/os)
* [py/math](https://pkg.go.dev/github.com/goplus/lib/py/math)
* [py/json](https://pkg.go.dev/github.com/goplus/lib/py/json)
* [py/inspect](https://pkg.go.dev/github.com/goplus/lib/py/inspect)
* [py/statistics](https://pkg.go.dev/github.com/goplus/lib/py/statistics)
* [py/numpy](https://pkg.go.dev/github.com/goplus/lib/py/numpy)
* [py/pandas](https://pkg.go.dev/github.com/goplus/lib/py/pandas)
* [py/torch](https://pkg.go.dev/github.com/goplus/lib/py/torch)
* [py/matplotlib](https://pkg.go.dev/github.com/goplus/lib/py/matplotlib)
Note: For third-party libraries (such as pandas and pytorch), you still need to install the library files.
Here is an example:
<!-- embedme doc/_readme/llgo_call_py/call_py.go -->
```go
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/math"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/math"
"github.com/goplus/lib/py/std"
)
func main() {
@@ -152,6 +162,8 @@ func main() {
It is equivalent to the following Python code:
<!-- embedme doc/_readme/llgo_call_py/call_math.py -->
```py
import math
@@ -163,13 +175,15 @@ Here, We call `py.Float(2)` to create a Python number 2, and pass it to Python
Let's look at a slightly more complex example. For example, we use `numpy` to calculate:
<!-- embedme doc/_readme/llgo_py_list/py_list.go -->
```go
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/numpy"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/numpy"
"github.com/goplus/lib/py/std"
)
func main() {
@@ -211,31 +225,32 @@ LLGo can easily import any libraries from the C ecosystem. Currently, this impor
The currently supported libraries include:
* [c/bdwgc](https://pkg.go.dev/github.com/goplus/llgo/c/bdwgc)
* [c/cjson](https://pkg.go.dev/github.com/goplus/llgo/c/cjson)
* [c/clang](https://pkg.go.dev/github.com/goplus/llgo/c/clang)
* [c/libuv](https://pkg.go.dev/github.com/goplus/llgo/c/libuv)
* [c/llama2](https://pkg.go.dev/github.com/goplus/llgo/c/llama2)
* [c/lua](https://pkg.go.dev/github.com/goplus/llgo/c/lua)
* [c/neco](https://pkg.go.dev/github.com/goplus/llgo/c/neco)
* [c/openssl](https://pkg.go.dev/github.com/goplus/llgo/c/openssl)
* [c/raylib](https://pkg.go.dev/github.com/goplus/llgo/c/raylib)
* [c/sqlite](https://pkg.go.dev/github.com/goplus/llgo/c/sqlite)
* [c/zlib](https://pkg.go.dev/github.com/goplus/llgo/c/zlib)
* [cpp/inih](https://pkg.go.dev/github.com/goplus/llgo/cpp/inih)
* [cpp/llvm](https://pkg.go.dev/github.com/goplus/llgo/cpp/llvm)
* [c/bdwgc](https://pkg.go.dev/github.com/goplus/lib/c/bdwgc)
* [c/cjson](https://pkg.go.dev/github.com/goplus/lib/c/cjson)
* [c/clang](https://pkg.go.dev/github.com/goplus/lib/c/clang)
* [c/ffi](https://pkg.go.dev/github.com/goplus/lib/c/ffi)
* [c/libuv](https://pkg.go.dev/github.com/goplus/lib/c/libuv)
* [c/llama2](https://pkg.go.dev/github.com/goplus/lib/c/llama2)
* [c/lua](https://pkg.go.dev/github.com/goplus/lib/c/lua)
* [c/neco](https://pkg.go.dev/github.com/goplus/lib/c/neco)
* [c/openssl](https://pkg.go.dev/github.com/goplus/lib/c/openssl)
* [c/raylib](https://pkg.go.dev/github.com/goplus/lib/c/raylib)
* [c/sqlite](https://pkg.go.dev/github.com/goplus/lib/c/sqlite)
* [c/zlib](https://pkg.go.dev/github.com/goplus/lib/c/zlib)
* [cpp/inih](https://pkg.go.dev/github.com/goplus/lib/cpp/inih)
* [cpp/llvm](https://pkg.go.dev/github.com/goplus/lib/cpp/llvm)
Here are some examples related to them:
* [llama2-c](_demo/llama2-c): inference Llama 2 (It's the first llgo AI example)
* [mkjson](c/cjson/_demo/mkjson/mkjson.go): create a json object and print it
* [sqlitedemo](c/sqlite/_demo/sqlitedemo/demo.go): a basic sqlite demo
* [tetris](c/raylib/_demo/tetris/tetris.go): a tetris game based on raylib
* [mkjson](https://github.com/goplus/lib/tree/main/c/cjson/_demo/mkjson/mkjson.go): create a json object and print it
* [sqlitedemo](https://github.com/goplus/lib/tree/main/c/sqlite/_demo/sqlitedemo/demo.go): a basic sqlite demo
* [tetris](https://github.com/goplus/lib/tree/main/c/raylib/_demo/tetris/tetris.go): a tetris game based on raylib
## Go syntax support
All Go syntax (not including `cgo`) is already supported. Here are some examples:
All Go syntax (including `cgo`) is already supported. Here are some examples:
* [concat](_demo/concat/concat.go): define a variadic function
* [genints](_demo/genints/genints.go): various forms of closure usage (including C function, recv.method and anonymous function)
@@ -269,13 +284,16 @@ Here are the Go packages that can be imported correctly:
* [unicode/utf8](https://pkg.go.dev/unicode/utf8)
* [unicode/utf16](https://pkg.go.dev/unicode/utf16)
* [math](https://pkg.go.dev/math)
* [math/big](https://pkg.go.dev/math/big) (partially)
* [math/bits](https://pkg.go.dev/math/bits)
* [math/cmplx](https://pkg.go.dev/math/cmplx)
* [math/rand](https://pkg.go.dev/math/rand)
* [net/url](https://pkg.go.dev/net/url)
* [errors](https://pkg.go.dev/errors)
* [context](https://pkg.go.dev/context)
* [io](https://pkg.go.dev/io)
* [io/fs](https://pkg.go.dev/io/fs)
* [io/ioutil](https://pkg.go.dev/io/ioutil)
* [log](https://pkg.go.dev/log)
* [flag](https://pkg.go.dev/flag)
* [sort](https://pkg.go.dev/sort)
@@ -294,32 +312,43 @@ Here are the Go packages that can be imported correctly:
* [fmt](https://pkg.go.dev/fmt) (partially)
* [reflect](https://pkg.go.dev/reflect) (partially)
* [time](https://pkg.go.dev/time) (partially)
* [encoding](https://pkg.go.dev/encoding)
* [encoding/binary](https://pkg.go.dev/encoding/binary)
* [encoding/hex](https://pkg.go.dev/encoding/hex)
* [encoding/base32](https://pkg.go.dev/encoding/base32)
* [encoding/base64](https://pkg.go.dev/encoding/base64)
* [encoding/csv](https://pkg.go.dev/encoding/csv)
* [net/textproto](https://pkg.go.dev/net/textproto)
* [hash](https://pkg.go.dev/hash)
* [hash/adler32](https://pkg.go.dev/hash/adler32)
* [hash/crc32](https://pkg.go.dev/hash/crc32) (partially)
* [hash/crc64](https://pkg.go.dev/hash/crc64)
* [crypto](https://pkg.go.dev/crypto)
* [crypto/md5](https://pkg.go.dev/crypto/md5)
* [crypto/sha1](https://pkg.go.dev/crypto/sha1)
* [crypto/sha256](https://pkg.go.dev/crypto/sha256)
* [crypto/sha512](https://pkg.go.dev/crypto/sha512) (partially)
* [crypto/hmac](https://pkg.go.dev/crypto/hmac) (partially)
* [crypto/rand](https://pkg.go.dev/crypto/rand) (partially)
* [crypto/subtle](https://pkg.go.dev/crypto/subtle) (partially)
* [regexp](https://pkg.go.dev/regexp)
* [regexp/syntax](https://pkg.go.dev/regexp/syntax)
* [go/token](https://pkg.go.dev/go/token)
* [go/scanner](https://pkg.go.dev/go/scanner)
* [go/parser](https://pkg.go.dev/go/parser)
## Dependencies
- [Go 1.20+](https://go.dev)
- [Go 1.21+](https://go.dev)
- [LLVM 18](https://llvm.org)
- [LLD 18](https://lld.llvm.org)
- [Clang 18](https://clang.llvm.org)
- [LLD 18](https://lld.llvm.org)
- [pkg-config 0.29+](https://www.freedesktop.org/wiki/Software/pkg-config/)
- [bdwgc/libgc 8.0+](https://www.hboehm.info/gc/)
- [OpenSSL 3.0+](https://www.openssl.org/)
- [cJSON 1.7+](https://github.com/DaveGamble/cJSON) (optional, for [github.com/goplus/llgo/c/cjson](https://pkg.go.dev/github.com/goplus/llgo/c/cjson))
- [SQLite 3](https://www.sqlite.org) (optional, for [github.com/goplus/llgo/c/sqlite](https://pkg.go.dev/github.com/goplus/llgo/c/sqlite))
- [Python 3.12+](https://www.python.org) (optional, for [github.com/goplus/llgo/py](https://pkg.go.dev/github.com/goplus/llgo/py))
- [zlib 1.2+](https://www.zlib.net)
- [Python 3.12+](https://www.python.org) (optional, for [github.com/goplus/lib/py](https://pkg.go.dev/github.com/goplus/lib/py))
## How to install
@@ -327,34 +356,63 @@ Follow these steps to generate the `llgo` command (its usage is the same as the
### on macOS
<!-- embedme doc/_readme/scripts/install_macos.sh#L2-L1000 -->
```sh
brew update # execute if needed
brew install llvm@18 pkg-config bdw-gc openssl
brew install cjson sqlite python@3.12 # optional
export PATH=$(brew --prefix llvm@18)/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.zshrc
go install -v github.com/goplus/llgo/cmd/llgo@latest
brew update
brew install llvm@19 lld@19 bdw-gc openssl cjson libffi libuv pkg-config
brew install python@3.12 # optional
brew link --overwrite llvm@19 lld@19 libffi
# curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash
./install.sh
```
### on Linux (Debian/Ubuntu)
### on Linux
#### Debian/Ubuntu
<!-- embedme doc/_readme/scripts/install_ubuntu.sh#L2-L1000 -->
```sh
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-18 main" | sudo tee /etc/apt/sources.list.d/llvm.list
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-19 main" | sudo tee /etc/apt/sources.list.d/llvm.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update # execute if needed
sudo apt-get install -y llvm-18-dev clang-18 lld-18 pkg-config libgc-dev libssl-dev
sudo apt-get install -y libcjson-dev libsqlite3-dev python3.12-dev # optional
export PATH=/usr/lib/llvm-18/bin:$PATH # you may want to add this to your shell RC file, e.g. ~/.bashrc
go install -v github.com/goplus/llgo/cmd/llgo@latest
sudo apt-get update
sudo apt-get install -y llvm-19-dev clang-19 libclang-19-dev lld-19 pkg-config libgc-dev libssl-dev zlib1g-dev libcjson-dev libsqlite3-dev libunwind-dev libuv1-dev
sudo apt-get install -y python3.12-dev # optional
#curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash
./install.sh
```
#### Alpine Linux
```sh
apk add go llvm18-dev clang18-dev lld18 pkgconf gc-dev openssl-dev zlib-dev
apk add python3-dev # optional
apk add g++ # build only
export LLVM_CONFIG=/usr/lib/llvm18/bin/llvm-config
export CGO_CPPFLAGS="$($LLVM_CONFIG --cppflags)"
export CGO_CXXFLAGS=-std=c++17
export CGO_LDFLAGS="$($LLVM_CONFIG --ldflags) $($LLVM_CONFIG --libs all)"
curl https://raw.githubusercontent.com/goplus/llgo/refs/heads/main/install.sh | bash
```
### on Windows
TODO
### Install from source
<!-- embedme doc/_readme/scripts/install_llgo.sh#L2-L1000 -->
```sh
git clone https://github.com/goplus/llgo.git
cd llgo
./install.sh
```
## Development tools
* [pydump](chore/_xtool/pydump): It's the first program compiled by `llgo` (NOT `go`) in a production environment. It outputs symbol information (functions, variables, and constants) from a Python library in JSON format, preparing for the generation of corresponding packages in `llgo`.
* [pydump](_xtool/pydump): It's the first program compiled by `llgo` (NOT `go`) in a production environment. It outputs symbol information (functions, variables, and constants) from a Python library in JSON format, preparing for the generation of corresponding packages in `llgo`.
* [pysigfetch](https://github.com/goplus/hdq/tree/main/chore/pysigfetch): It generates symbol information by extracting information from Python's documentation site. This tool is not part of the `llgo` project, but we depend on it.
* [llpyg](chore/llpyg): It is used to automatically convert Python libraries into Go packages that `llgo` can import. It depends on `pydump` and `pysigfetch` to accomplish the task.
* [llgen](chore/llgen): It is used to compile Go packages into LLVM IR files (*.ll).
@@ -362,19 +420,24 @@ TODO
How do I generate these tools?
<!-- embedme doc/_readme/scripts/install_full.sh#L2-L1000 -->
```sh
git clone https://github.com/goplus/llgo.git
cd llgo
go install -v ./cmd/...
go install -v ./chore/... # compile all tools except pydump
cd chore/_xtool
export LLGO_ROOT=$PWD
cd _xtool
llgo install ./... # compile pydump
go install github.com/goplus/hdq/chore/pysigfetch@v0.8.1 # compile pysigfetch
```
## Key modules
Below are the key modules for understanding the implementation principles of `llgo`:
* [llgo/ssa](https://pkg.go.dev/github.com/goplus/llgo/ssa): It generates LLVM IR files (LLVM SSA) using the semantics (interfaces) of Go SSA. Although `LLVM SSA` and `Go SSA` are both IR languages, they work at completely different levels. `LLVM SSA` is closer to machine code, which abstracts different instruction sets. While `Go SSA` is closer to a high-level language. We can think of it as the instruction set of the `Go computer`. `llgo/ssa` is not just limited to the `llgo` compiler. If we view it as the high-level expressive power of `LLVM`, you'll find it very useful. Prior to `llgo/ssa`, you had to operate `LLVM` using machine code semantics. But now, with the advanced SSA form (in the semantics of Go SSA), you can conveniently utilize `LLVM`.
* [llgo/cl](https://pkg.go.dev/github.com/goplus/llgo/cl): It is the core of the llgo compiler. It converts a Go package into LLVM IR files. It depends on `llgo/ssa`.
* [llgo/internal/build](https://pkg.go.dev/github.com/goplus/llgo/internal/build): It strings together the entire compilation process of `llgo`. It depends on `llgo/ssa` and `llgo/cl`.
* [ssa](https://pkg.go.dev/github.com/goplus/llgo/ssa): It generates LLVM IR files (LLVM SSA) using the semantics (interfaces) of Go SSA. Although `LLVM SSA` and `Go SSA` are both IR languages, they work at completely different levels. `LLVM SSA` is closer to machine code, which abstracts different instruction sets. While `Go SSA` is closer to a high-level language. We can think of it as the instruction set of the `Go computer`. `llgo/ssa` is not just limited to the `llgo` compiler. If we view it as the high-level expressive power of `LLVM`, you'll find it very useful. Prior to `llgo/ssa`, you had to operate `LLVM` using machine code semantics. But now, with the advanced SSA form (in the semantics of Go SSA), you can conveniently utilize `LLVM`.
* [cl](https://pkg.go.dev/github.com/goplus/llgo/cl): It is the core of the llgo compiler. It converts a Go package into LLVM IR files. It depends on `llgo/ssa`.
* [internal/build](https://pkg.go.dev/github.com/goplus/llgo/internal/build): It strings together the entire compilation process of `llgo`. It depends on `llgo/ssa` and `llgo/cl`.

View File

@@ -0,0 +1,33 @@
package main
import (
"fmt"
"go/constant"
"go/token"
)
func main() {
// Create the complex number 2.3 + 5i.
ar := constant.MakeFloat64(2.3)
ai := constant.MakeImag(constant.MakeInt64(5))
a := constant.BinaryOp(ar, token.ADD, ai)
// Compute (2.3 + 5i) * 11.
b := constant.MakeUint64(11)
c := constant.BinaryOp(a, token.MUL, b)
// Convert c into a complex128.
Ar, exact := constant.Float64Val(constant.Real(c))
if !exact {
fmt.Printf("Could not represent real part %s exactly as float64\n", constant.Real(c))
}
Ai, exact := constant.Float64Val(constant.Imag(c))
if !exact {
fmt.Printf("Could not represent imaginary part %s as exactly as float64\n", constant.Imag(c))
}
C := complex(Ar, Ai)
fmt.Println("literal", 25.3+55i)
fmt.Println("go/constant", c)
fmt.Println("complex128", C)
}

View File

@@ -0,0 +1,63 @@
package main
import (
"fmt"
"math/big"
)
func fib() {
// Initialize two big ints with the first two numbers in the sequence.
a := big.NewInt(0)
b := big.NewInt(1)
// Initialize limit as 10^99, the smallest integer with 100 digits.
var limit big.Int
limit.Exp(big.NewInt(10), big.NewInt(99), nil)
// Loop while a is smaller than 1e100.
for a.Cmp(&limit) < 0 {
// Compute the next Fibonacci number, storing it in a.
a.Add(a, b)
// Swap a and b so that b is the next number in the sequence.
a, b = b, a
}
fmt.Println(a) // 100-digit Fibonacci number
}
func abs() {
a := big.NewInt(64)
b := big.NewInt(-52)
a.Set(b)
a.Abs(a)
a.Set(big.NewInt(-164))
a.Abs(a)
fmt.Println("value: ", a.String())
}
func neg() {
fmt.Println("value: ", big.NewInt(-64).Neg(big.NewInt(-64)))
fmt.Println("value: ", big.NewInt(64).Neg(big.NewInt(64)))
fmt.Println("value: ", big.NewInt(0).Neg(big.NewInt(0)))
}
func calc() {
a := big.NewInt(64)
b := big.NewInt(-52)
c := big.NewInt(54)
fmt.Println("value:", a.Add(a, b))
fmt.Println("value:", a.Sub(b, c))
d := big.NewInt(10)
e := big.NewInt(4)
fmt.Println("value:", d.Mul(d, e))
}
func bitop() {
a := big.NewInt(4)
fmt.Println("value:", a.Lsh(a, 1))
b := big.NewInt(16)
fmt.Println("value:", b.Rsh(b, 2))
}
func main() {
bitop()
}

View File

@@ -0,0 +1,34 @@
package main
import (
"fmt"
"go/parser"
"go/token"
)
func main() {
fset := token.NewFileSet() // positions are relative to fset
src := `package foo
import (
"fmt"
"time"
)
func bar() {
fmt.Println(time.Now())
}`
// Parse src but stop after processing the imports.
f, err := parser.ParseFile(fset, "", src, parser.ImportsOnly)
if err != nil {
fmt.Println(err)
return
}
// Print the imports from the file's AST.
for _, s := range f.Imports {
fmt.Println(s.Path.Value)
}
}

View File

@@ -0,0 +1,27 @@
package main
import (
"fmt"
"go/scanner"
"go/token"
)
func main() {
// src is the input that we want to tokenize.
src := []byte("cos(x) + 1i*sin(x) // Euler")
// Initialize the scanner.
var s scanner.Scanner
fset := token.NewFileSet() // positions are relative to fset
file := fset.AddFile("", fset.Base(), len(src)) // register input "file"
s.Init(file, src, nil /* no error handler */, scanner.ScanComments)
// Repeated calls to Scan yield the token sequence found in the input.
for {
pos, tok, lit := s.Scan()
if tok == token.EOF {
break
}
fmt.Printf("%s\t%s\t%q\n", fset.Position(pos), tok, lit)
}
}

15
_cmptest/hmacdemo/hmac.go Normal file
View File

@@ -0,0 +1,15 @@
package main
import (
"crypto/hmac"
"crypto/sha1"
"fmt"
"io"
)
func main() {
h := hmac.New(sha1.New, []byte("<key>"))
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
}

View File

@@ -0,0 +1,19 @@
package main
import (
"fmt"
"io/ioutil"
"log"
"strings"
)
func main() {
r := strings.NewReader("Go is a general-purpose language designed with systems programming in mind.")
b, err := ioutil.ReadAll(r)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", b)
}

View File

@@ -0,0 +1,25 @@
package main
import (
"fmt"
"math/big"
)
func main() {
// Initialize two big ints with the first two numbers in the sequence.
a := big.NewInt(0)
b := big.NewInt(1)
// Initialize limit as 10^99, the smallest integer with 100 digits.
var limit big.Int
limit.Exp(big.NewInt(10), big.NewInt(99), nil)
// Loop while a is smaller than 1e100.
for a.Cmp(&limit) < 0 {
// Compute the next Fibonacci number, storing it in a.
a.Add(a, b)
// Swap a and b so that b is the next number in the sequence.
a, b = b, a
}
fmt.Println(a) // 100-digit Fibonacci number
}

View File

@@ -1,6 +1,7 @@
package main
import (
"crypto"
"crypto/md5"
"fmt"
"io"
@@ -10,5 +11,10 @@ func main() {
h := md5.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
fmt.Printf("%x\n", h.Sum(nil))
h = crypto.MD5.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x\n", h.Sum(nil))
}

14
_cmptest/sha1demo/sha1.go Normal file
View File

@@ -0,0 +1,14 @@
package main
import (
"crypto/sha1"
"fmt"
"io"
)
func main() {
h := sha1.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
}

View File

@@ -0,0 +1,14 @@
package main
import (
"crypto/sha256"
"fmt"
"io"
)
func main() {
h := sha256.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
}

View File

@@ -0,0 +1,14 @@
package main
import (
"crypto/sha512"
"fmt"
"io"
)
func main() {
h := sha512.New()
io.WriteString(h, "The fog is getting thicker!")
io.WriteString(h, "And Leon's getting laaarger!")
fmt.Printf("%x", h.Sum(nil))
}

20
_cmptest/urldemo/url.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"fmt"
"log"
"net/url"
)
func main() {
u, err := url.Parse("http://foo.example.com/foo?bar=1")
if err != nil {
log.Fatal(err)
}
u.Scheme = "https"
u.Host = "bar.example.com"
q := u.Query()
q.Set("bar", "2")
u.RawQuery = q.Encode()
fmt.Println(u)
}

View File

@@ -0,0 +1,31 @@
package async
import (
_ "unsafe"
)
type Void = [0]byte
type Future[T any] interface {
Then(cb func(T))
}
type future[T any] struct {
cb func(func(T))
}
func (f *future[T]) Then(cb func(T)) {
f.cb(cb)
}
func Async[T any](fn func(func(T))) Future[T] {
return &future[T]{fn}
}
func Run[T any](future Future[T]) T {
var ret T
future.Then(func(v T) {
ret = v
})
return ret
}

23
_demo/async/main.go Normal file
View File

@@ -0,0 +1,23 @@
package main
import (
"time"
"github.com/goplus/llgo/_demo/async/async"
"github.com/goplus/llgo/_demo/async/timeout"
)
func Sleep(i int, d time.Duration) async.Future[int] {
return async.Async(func(resolve func(int)) {
timeout.Timeout(d).Then(func(async.Void) {
resolve(i)
})
})
}
func main() {
async.Run(async.Async(func(resolve func(async.Void)) {
println("read file")
defer resolve(async.Void{})
}))
}

View File

@@ -0,0 +1,16 @@
package timeout
import (
"time"
"github.com/goplus/llgo/_demo/async/async"
)
func Timeout(d time.Duration) async.Future[async.Void] {
return async.Async(func(resolve func(async.Void)) {
go func() {
time.Sleep(d)
resolve(async.Void{})
}()
})
}

View File

@@ -1,7 +1,7 @@
package main
import (
"github.com/goplus/llgo/c/sync/atomic"
"github.com/goplus/lib/c/sync/atomic"
)
func main() {

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/os"
)
func main() {

16
_demo/cgofull/bar.go Normal file
View File

@@ -0,0 +1,16 @@
package main
/*
#cgo CFLAGS: -DBAR
#include <stdio.h>
#include "foo.h"
static void foo(Foo* f) {
printf("foo in bar: %d\n", f->a);
}
*/
import "C"
func Bar(f *C.Foo) {
C.print_foo(f)
C.foo(f)
}

157
_demo/cgofull/cgofull.go Normal file
View File

@@ -0,0 +1,157 @@
package main
/*
#cgo windows,!amd64 CFLAGS: -D_WIN32
#cgo !windows CFLAGS: -D_POSIX
#cgo windows,amd64 CFLAGS: -D_WIN64
#cgo linux,amd64 CFLAGS: -D_LINUX64
#cgo !windows,amd64 CFLAGS: -D_UNIX64
#cgo pkg-config: python3-embed
#include <stdio.h>
#include <Python.h>
#include "foo.h"
typedef struct {
int a;
} s4;
typedef struct {
int a;
int b;
} s8;
typedef struct {
int a;
int b;
int c;
} s12;
typedef struct {
int a;
int b;
int c;
int d;
} s16;
typedef struct {
int a;
int b;
int c;
int d;
int e;
} s20;
static int test_structs(s4* s4, s8* s8, s12* s12, s16* s16, s20* s20) {
printf("s4.a: %d\n", s4->a);
printf("s8.a: %d, s8.b: %d\n", s8->a, s8->b);
printf("s12.a: %d, s12.b: %d, s12.c: %d\n", s12->a, s12->b, s12->c);
printf("s16.a: %d, s16.b: %d, s16.c: %d, s16.d: %d\n", s16->a, s16->b, s16->c, s16->d);
printf("s20.a: %d, s20.b: %d, s20.c: %d, s20.d: %d, s20.e: %d\n", s20->a, s20->b, s20->c, s20->d, s20->e);
return s4->a + s8->a + s8->b + s12->a + s12->b + s12->c + s16->a + s16->b + s16->c + s16->d + s20->a + s20->b + s20->c + s20->d + s20->e;
}
static void test_macros() {
#ifdef FOO
printf("FOO is defined\n");
#endif
#ifdef BAR
printf("BAR is defined\n");
#endif
#ifdef _WIN32
printf("WIN32 is defined\n");
#endif
#ifdef _POSIX
printf("POSIX is defined\n");
#endif
#ifdef _WIN64
printf("WIN64 is defined\n");
#endif
#ifdef _LINUX64
printf("LINUX64 is defined\n");
#endif
#ifdef _UNIX64
printf("UNIX64 is defined\n");
#endif
}
#define MY_VERSION "1.0.0"
#define MY_CODE 0x12345678
static void test_void() {
printf("test_void\n");
}
typedef int (*Cb)(int);
extern int go_callback(int);
extern int c_callback(int i);
static void test_callback(Cb cb) {
printf("test_callback, cb: %p, go_callback: %p, c_callback: %p\n", cb, go_callback, c_callback);
printf("test_callback, *cb: %p, *go_callback: %p, *c_callback: %p\n", *(void**)cb, *(void**)(go_callback), *(void**)(c_callback));
printf("cb result: %d\n", cb(123));
printf("done\n");
}
extern int go_callback_not_use_in_go(int);
static void run_callback() {
test_callback(c_callback);
test_callback(go_callback_not_use_in_go);
}
*/
import "C"
import (
"fmt"
"unsafe"
"github.com/goplus/llgo/_demo/cgofull/pymod1"
"github.com/goplus/llgo/_demo/cgofull/pymod2"
)
//export go_callback_not_use_in_go
func go_callback_not_use_in_go(i C.int) C.int {
return i + 1
}
//export go_callback
func go_callback(i C.int) C.int {
return i + 1
}
func main() {
runPy()
f := &C.Foo{a: 1}
Foo(f)
Bar(f)
C.test_macros()
r := C.test_structs(&C.s4{a: 1}, &C.s8{a: 1, b: 2}, &C.s12{a: 1, b: 2, c: 3}, &C.s16{a: 1, b: 2, c: 3, d: 4}, &C.s20{a: 1, b: 2, c: 3, d: 4, e: 5})
fmt.Println(r)
if r != 35 {
panic("test_structs failed")
}
fmt.Println(C.MY_VERSION)
fmt.Println(int(C.MY_CODE))
C.test_void()
println("call run_callback")
C.run_callback()
// test _Cgo_ptr and _cgoCheckResult
println("call with go_callback")
C.test_callback((C.Cb)(C.go_callback))
println("call with c_callback")
C.test_callback((C.Cb)(C.c_callback))
}
func runPy() {
Initialize()
defer Finalize()
Run("print('Hello, Python!')")
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(pymod1.Float(1.23))), C.stderr, 0)
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(pymod2.Long(123))), C.stdout, 0)
// test _Cgo_use
C.PyObject_Print((*C.PyObject)(unsafe.Pointer(C.PyComplex_FromDoubles(C.double(1.23), C.double(4.56)))), C.stdout, 0)
}

12
_demo/cgofull/foo.c Normal file
View File

@@ -0,0 +1,12 @@
#include <stdio.h>
#include "foo.h"
void print_foo(Foo *f)
{
printf("print_foo: %d\n", f->a);
}
int c_callback(int i)
{
return i + 1;
}

16
_demo/cgofull/foo.go Normal file
View File

@@ -0,0 +1,16 @@
package main
/*
#cgo CFLAGS: -DFOO
#include <stdio.h>
#include "foo.h"
static void foo(Foo* f) {
printf("foo in bar: %d\n", f->a);
}
*/
import "C"
func Foo(f *C.Foo) {
C.print_foo(f)
C.foo(f)
}

7
_demo/cgofull/foo.h Normal file
View File

@@ -0,0 +1,7 @@
#pragma once
typedef struct {
int a;
} Foo;
extern void print_foo(Foo* f);

24
_demo/cgofull/py.go Normal file
View File

@@ -0,0 +1,24 @@
package main
/*
#cgo pkg-config: python3-embed
#include <Python.h>
*/
import "C"
import "fmt"
func Initialize() {
C.Py_Initialize()
}
func Finalize() {
C.Py_Finalize()
}
func Run(code string) error {
if C.PyRun_SimpleString(C.CString(code)) != 0 {
C.PyErr_Print()
return fmt.Errorf("failed to run code")
}
return nil
}

View File

@@ -0,0 +1,11 @@
package pymod1
/*
#cgo pkg-config: python3-embed
#include <Python.h>
*/
import "C"
func Float(f float64) *C.PyObject {
return C.PyFloat_FromDouble(C.double(f))
}

View File

@@ -0,0 +1,11 @@
package pymod2
/*
#cgo pkg-config: python3-embed
#include <Python.h>
*/
import "C"
func Long(l int64) *C.PyObject {
return C.PyLong_FromLongLong(C.longlong(l))
}

28
_demo/checkfile/demo.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
tempDir := os.TempDir()
noexist := filepath.Join(tempDir, "noexist.txt")
if _, err := os.Stat(noexist); err != nil {
if os.IsNotExist(err) {
fmt.Println("noexist:", err.Error())
} else {
fmt.Println("exist,other err:", err.Error())
}
}
if _, err := os.Open(noexist); err != nil {
if os.IsNotExist(err) {
fmt.Println("noexist:", err.Error())
} else {
fmt.Println("exist,other err:", err.Error())
}
}
}

View File

@@ -1,18 +0,0 @@
package main
import (
"fmt"
"unsafe"
"github.com/goplus/llgo/c/openssl"
)
func main() {
var md5 openssl.MD5_CTX
var h = make([]byte, openssl.MD5_LBLOCK)
md5.Init()
md5.UpdateString("The fog is getting thicker!")
md5.UpdateString("And Leon's getting laaarger!")
md5.Final(unsafe.SliceData(h))
fmt.Printf("%x", h)
}

View File

@@ -0,0 +1,18 @@
package main
import (
"bytes"
"os/exec"
)
func main() {
var data bytes.Buffer
cmd := exec.Command("echo", "hello llgo")
cmd.Stdout = &data
err := cmd.Run()
if err != nil {
panic(err)
}
println("len:", len(data.Bytes()))
println("data:", data.String())
}

View File

@@ -1,7 +1,7 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/lib/c"
)
func concat(args ...string) (ret string) {

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/math"
"github.com/goplus/llgo/_demo/cppintf/foo"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/math"
)
type Bar struct {

View File

@@ -3,9 +3,9 @@ package main
import (
"unsafe"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/math"
"github.com/goplus/llgo/_demo/cppmintf/foo"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/math"
)
type Bar struct {

View File

@@ -3,9 +3,9 @@ package main
import (
"fmt"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/math/rand"
"github.com/goplus/llgo/c/time"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/math/rand"
"github.com/goplus/lib/c/time"
)
func fastrand64() uint64 {

View File

@@ -1,68 +0,0 @@
package main
import (
"fmt"
"unsafe"
"github.com/goplus/llgo/c/openssl"
)
func main() {
str := "His money is twice tainted:"
var sha1 openssl.SHA_CTX
sha1.Init()
sha1.UpdateString(str)
h1 := make([]byte, openssl.SHA_DIGEST_LENGTH)
sha1.Final(unsafe.SliceData(h1))
fmt.Printf("%x\n", h1)
h2 := make([]byte, openssl.SHA_DIGEST_LENGTH)
openssl.SHA1String(str, unsafe.SliceData(h2))
fmt.Printf("%x\n", h2)
var sha256 openssl.SHA256_CTX
sha256.Init()
sha256.UpdateString(str)
h3 := make([]byte, openssl.SHA256_DIGEST_LENGTH)
sha256.Final(unsafe.SliceData(h3))
fmt.Printf("%x\n", h3)
h4 := make([]byte, openssl.SHA256_DIGEST_LENGTH)
openssl.SHA256String(str, unsafe.SliceData(h4))
fmt.Printf("%x\n", h4)
var sha512 openssl.SHA512_CTX
sha512.Init()
sha512.UpdateString("His money is twice tainted:")
h5 := make([]byte, openssl.SHA512_DIGEST_LENGTH)
sha512.Final(unsafe.SliceData(h5))
fmt.Printf("%x\n", h5)
h6 := make([]byte, openssl.SHA512_DIGEST_LENGTH)
openssl.SHA512String(str, unsafe.SliceData(h6))
fmt.Printf("%x\n", h6)
var sha224 openssl.SHA224_CTX
sha224.Init()
sha224.UpdateString(str)
h7 := make([]byte, openssl.SHA224_DIGEST_LENGTH)
sha224.Final(unsafe.SliceData(h7))
fmt.Printf("%x\n", h7)
h8 := make([]byte, openssl.SHA224_DIGEST_LENGTH)
openssl.SHA224String(str, unsafe.SliceData(h8))
fmt.Printf("%x\n", h8)
var sha384 openssl.SHA384_CTX
sha384.Init()
sha384.UpdateString(str)
h9 := make([]byte, openssl.SHA384_DIGEST_LENGTH)
sha384.Final(unsafe.SliceData(h9))
fmt.Printf("%x\n", h9)
h10 := make([]byte, openssl.SHA384_DIGEST_LENGTH)
openssl.SHA384String(str, unsafe.SliceData(h10))
fmt.Printf("%x\n", h10)
}

View File

@@ -1,6 +1,6 @@
package main
import "github.com/goplus/llgo/c/time"
import "github.com/goplus/lib/c/time"
func main() {
var tv time.Timespec

18
_demo/defer/main.go Normal file
View File

@@ -0,0 +1,18 @@
package main
func main() {
var a int = 5
defer println(a)
defer func() {
println(a)
}()
defer func() {
println(recover().(string))
}()
a = 10
panic("error")
//Output:
// error
// 10
// 5
}

View File

@@ -0,0 +1,42 @@
package main
import (
"fmt"
)
type MyStruct[T any] struct {
value T
}
func (m *MyStruct[T]) Method() {
fmt.Println("In generic method")
genericFunc[T](m.value)
}
func genericFunc[T any](v T) {
fmt.Println("In generic function")
normalFunc()
}
func normalFunc() {
fmt.Println("In normal function")
panic("panic occurs here")
}
func main() {
m := &MyStruct[string]{value: "hello"}
m.Method()
}
//Expected:
// In generic method
// In generic function
// In normal function
// panic: panic occurs here
// [0x00C6D310 github.com/goplus/llgo/internal/runtime.Rethrow+0x2f, SP = 0x60]
// [0x00C6CF44 github.com/goplus/llgo/internal/runtime.Panic+0x2d, SP = 0x50]
// [0x00C69420 main.normalFunc+0xf, SP = 0xa8]
// [0x00C69564 main.genericFunc[string]+0x18, SP = 0x74]
// [0x00C694A8 main.(*MyStruct[string]).Method+0x1f, SP = 0x84]
// [0x00C6936C main+0x4, SP = 0x40]

View File

@@ -1,9 +1,10 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
"unsafe"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/os"
)
func main() {
@@ -45,8 +46,6 @@ func main() {
}
c.Printf(c.Str("set file status successfully\n"))
c.Printf(c.Str("111"))
// Close file
os.Close(fd)

View File

@@ -1,7 +1,7 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/lib/c"
)
type generator struct {

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/os"
)
func main() {

5
_demo/go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/goplus/llgo/_demo
go 1.20
require github.com/goplus/lib v0.2.0

2
_demo/go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g=
github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0=

View File

@@ -1,13 +1,13 @@
package main
import (
"github.com/goplus/llgo/c"
"fmt"
"github.com/goplus/lib/c"
)
func main() {
c.Printf(c.Str("Hello world\n"))
println("hello world by println")
fmt.Println("hello world by fmt.Println")
c.Printf(c.Str("Hello world by c.Printf\n"))
}
/* Expected output:
Hello world
*/

15
_demo/helloc/helloc.go Normal file
View File

@@ -0,0 +1,15 @@
package main
import (
"unsafe"
"github.com/goplus/lib/c"
)
func main() {
c.Printf(c.Str("Hello world by c.Printf\n"))
c.Printf(c.Str("%ld\n"), unsafe.Sizeof(int(0)))
c.Printf(c.Str("%ld\n"), unsafe.Sizeof(uintptr(0)))
// var v any = int(0)
// c.Printf(c.Str("%ld\n"), unsafe.Sizeof(v))
}

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/llama2"
"github.com/goplus/llgo/c/time"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/llama2"
"github.com/goplus/lib/c/time"
)
func main() {

View File

@@ -0,0 +1,13 @@
package main
import "net/textproto"
func main() {
h := make(textproto.MIMEHeader)
h.Set("host", "www.example.com")
println(h.Get("Host"))
}
/* Expected output:
www.example.com
*/

34
_demo/mkdirdemo/mkdir.go Normal file
View File

@@ -0,0 +1,34 @@
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() {
tempDir, err := os.MkdirTemp("", "example*")
if err != nil {
fmt.Println("Failed to create temp directory:", err)
return
}
defer os.Remove(tempDir)
fmt.Println("Temp directory:", tempDir)
tempFile, err := os.CreateTemp("", "example*.txt")
if err != nil {
fmt.Println("Failed to create temp file:", err)
return
}
defer tempFile.Close()
defer os.Remove(tempFile.Name())
fmt.Println("Temp file:", tempFile.Name())
nestedDir := filepath.Join("nested", "directory")
err = os.MkdirAll(nestedDir, 0755)
if err != nil {
fmt.Println("Failed to create nested directory:", err)
return
}
fmt.Println("Nest directory:", nestedDir)
}

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/net"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/net"
)
func main() {

View File

@@ -3,7 +3,7 @@ package main
import (
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/lib/c"
)
func main() {

18
_demo/randcrypt/rand.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import (
"crypto/rand"
"fmt"
)
func main() {
c := 10
b := make([]byte, c)
_, err := rand.Read(b)
if err != nil {
fmt.Println("error:", err)
return
}
// The slice should now contain random bytes instead of only zeroes.
fmt.Printf("%x\n", b)
}

View File

@@ -0,0 +1,42 @@
package main
import (
"fmt"
"reflect"
)
func add(a, b int) int {
return a + b
}
func main() {
fn := func(a, b int) int {
return a + b
}
var i int
fn1 := func() {
i++
}
fn2 := func() func() {
return func() {
println("closure", i)
}
}
fns := []any{add, fn, fn1, fn2}
for _, fn := range fns {
v := reflect.ValueOf(fn)
fmt.Println(v.Type())
fmt.Println(v.Kind())
if v.Kind() != reflect.Func {
panic(fmt.Sprintf("not func: %T", fn))
}
t := v.Type()
fmt.Println(t)
fmt.Println(t.Kind())
if t.Kind() != reflect.Func {
panic(fmt.Sprintf("not func: %T", fn))
}
}
}

View File

@@ -1,7 +1,7 @@
package main
import (
"github.com/goplus/llgo/c/setjmp"
"github.com/goplus/lib/c/setjmp"
)
func main() {

View File

@@ -3,9 +3,9 @@ package main
import (
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/net"
"github.com/goplus/llgo/c/os"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/net"
"github.com/goplus/lib/c/os"
)
func main() {

View File

@@ -3,9 +3,9 @@ package main
import (
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/net"
"github.com/goplus/llgo/c/os"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/net"
"github.com/goplus/lib/c/os"
)
func main() {

112
_demo/sync/sync.go Normal file
View File

@@ -0,0 +1,112 @@
package main
import (
"fmt"
"sync"
"sync/atomic"
"time"
)
// Counter represents a thread-safe counter
type Counter struct {
mu sync.Mutex
value int64
}
// Increment increases the counter value by 1
func (c *Counter) Increment() {
c.mu.Lock()
defer c.mu.Unlock()
c.value++
}
// GetValue returns the current value of the counter
func (c *Counter) GetValue() int64 {
c.mu.Lock()
defer c.mu.Unlock()
return c.value
}
// Constant values for the test
const (
numGoroutines = 64
numIterations = 10000
expectedTotal = numGoroutines * numIterations
)
func main() {
// Create a new counter instance
counter := &Counter{}
// Create a wait group to wait for all goroutines to finish
var wg sync.WaitGroup
// Track active goroutines for monitoring
var activeGoroutines int32
// Start time
startTime := time.Now()
// Launch goroutines
for i := 0; i < numGoroutines; i++ {
wg.Add(1)
atomic.AddInt32(&activeGoroutines, 1)
go func(id int) {
defer func() {
wg.Done()
atomic.AddInt32(&activeGoroutines, -1)
}()
// Each goroutine increments the counter numIterations times
for j := 0; j < numIterations; j++ {
counter.Increment()
// Simulate varying workload with random sleeps
if j%100 == 0 {
time.Sleep(time.Microsecond)
}
}
fmt.Printf("Goroutine %d finished\n", id)
}(i)
}
// Monitor progress in a separate goroutine
go func() {
for {
active := atomic.LoadInt32(&activeGoroutines)
if active == 0 {
break
}
fmt.Printf("Active goroutines: %d\n", active)
time.Sleep(time.Second)
}
}()
// Wait for all goroutines to complete
wg.Wait()
// Calculate execution time
duration := time.Since(startTime)
// Get and verify the final result
finalValue := counter.GetValue()
fmt.Printf("\nExecution completed in: %v\n", duration)
fmt.Printf("Final counter value: %d\n", finalValue)
fmt.Printf("Expected value: %d\n", expectedTotal)
// Assert the result
if finalValue != expectedTotal {
panic(fmt.Sprintf("ERROR: Counter value mismatch! Expected %d, got %d\n",
expectedTotal, finalValue))
} else {
fmt.Printf("SUCCESS: Counter value matches expected total\n")
}
// Print some statistics
opsPerSecond := float64(expectedTotal) / duration.Seconds()
fmt.Printf("\nStatistics:\n")
fmt.Printf("Operations per second: %.2f\n", opsPerSecond)
fmt.Printf("Average time per operation: %.2f ns\n",
float64(duration.Nanoseconds())/float64(expectedTotal))
}

View File

@@ -0,0 +1,31 @@
package main
import (
"io"
"os"
"sync"
"unsafe"
llsync "github.com/goplus/lib/c/pthread/sync"
)
type L struct {
mu sync.Mutex
s string
i int
w io.Writer
}
func main() {
l := &L{s: "hello", i: 123, w: os.Stdout}
println("sizeof(L):", unsafe.Sizeof(L{}))
println("sizeof(sync.Mutex):", unsafe.Sizeof(sync.Mutex{}))
println("sizeof(llsync.Mutex):", unsafe.Sizeof(llsync.Mutex{}))
println("l:", l, "l.s:", l.s, "l.i:", l.i, "l.w:", l.w)
l.mu.Lock()
println("locked")
println("l:", l, "l.s:", l.s, "l.i:", l.i, "l.w:", l.w)
l.w.Write([]byte(l.s))
l.w.Write([]byte("\n"))
l.mu.Unlock()
}

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/pthread"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/pthread"
)
var key pthread.Key

115
_lldb/README.md Normal file
View File

@@ -0,0 +1,115 @@
## LLGo Plugin of LLDB
### Build with debug info
```shell
LLGO_DEBUG_SYMBOLS=1 llgo build -o cl/_testdata/debug/out ./cl/_testdata/debug
```
### Debug with lldb
```shell
_lldb/runlldb.sh ./cl/_testdata/debug/out
```
or
```shell
/opt/homebrew/bin/lldb -O "command script import _lldb/llgo_plugin.py" ./cl/_testdata/debug/out
# github.com/goplus/llgo/cl/_testdata/debug
Breakpoint 1: no locations (pending).
Breakpoint set in dummy target, will get copied into future targets.
(lldb) command script import _lldb/llgo_plugin.py
(lldb) target create "./cl/_testdata/debug/out"
Current executable set to '/Users/lijie/source/goplus/llgo/cl/_testdata/debug/out' (arm64).
(lldb) r
Process 21992 launched: '/Users/lijie/source/goplus/llgo/cl/_testdata/debug/out' (arm64)
globalInt: 301
s: 0x100123e40
0x100123be0
5 8
called function with struct
1 2 3 4 5 6 7 8 9 10 +1.100000e+01 +1.200000e+01 true (+1.300000e+01+1.400000e+01i) (+1.500000e+01+1.600000e+01i) [3/3]0x1001129a0 [3/3]0x100112920 hello 0x1001149b0 0x100123ab0 0x100123d10 0x1001149e0 (0x100116810,0x1001149d0) 0x10011bf00 0x10010fa80 (0x100116840,0x100112940) 0x10001b4a4
9
1 (0x1001167e0,0x100112900)
called function with types
0x100123e40
0x1000343d0
Process 21992 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x000000010001b3b4 out`main at in.go:225:12
222 // s.i8: '\x01'
223 // s.i16: 2
224 s.i8 = 0x12
-> 225 println(s.i8)
226 // Expected:
227 // all variables: globalInt globalStruct globalStructPtr s i err
228 // s.i8: '\x12'
(lldb) v
var i int = <variable not available>
var s github.com/goplus/llgo/cl/_testdata/debug.StructWithAllTypeFields = {
i8 = '\x12',
i16 = 2,
i32 = 3,
i64 = 4,
i = 5,
u8 = '\x06',
u16 = 7,
u32 = 8,
u64 = 9,
u = 10,
f32 = 11,
f64 = 12,
b = true,
c64 = {real = 13, imag = 14},
c128 = {real = 15, imag = 16},
slice = []int{21, 22, 23},
arr = [3]int{24, 25, 26},
arr2 = [3]github.com/goplus/llgo/cl/_testdata/debug.E{{i = 27}, {i = 28}, {i = 29}},
s = "hello",
e = {i = 30},
pf = 0x0000000100123d10,
pi = 0x00000001001149e0,
intr = {type = 0x0000000100116810, data = 0x00000001001149d0},
m = {count = 4296130304},
c = {},
err = {type = 0x0000000100116840, data = 0x0000000100112940},
fn = {f = 0x000000010001b4a4, data = 0x00000001001149c0},
pad1 = 100,
pad2 = 200
}
var globalStructPtr *github.com/goplus/llgo/cl/_testdata/debug.StructWithAllTypeFields = <variable not available>
var globalStruct github.com/goplus/llgo/cl/_testdata/debug.StructWithAllTypeFields = {
i8 = '\x01',
i16 = 2,
i32 = 3,
i64 = 4,
i = 5,
u8 = '\x06',
u16 = 7,
u32 = 8,
u64 = 9,
u = 10,
f32 = 11,
f64 = 12,
b = true,
c64 = {real = 13, imag = 14},
c128 = {real = 15, imag = 16},
slice = []int{21, 22, 23},
arr = [3]int{24, 25, 26},
arr2 = [3]github.com/goplus/llgo/cl/_testdata/debug.E{{i = 27}, {i = 28}, {i = 29}},
s = "hello",
e = {i = 30},
pf = 0x0000000100123d10,
pi = 0x00000001001149e0,
intr = {type = 0x0000000100116810, data = 0x00000001001149d0},
m = {count = 4296130304},
c = {},
err = {type = 0x0000000100116840, data = 0x0000000100112940},
fn = {f = 0x000000010001b4a4, data = 0x00000001001149c0},
pad1 = 100,
pad2 = 200
}
var globalInt int = 301
var err error = {type = 0x0000000100112900, data = 0x000000000000001a}
```

54
_lldb/common.sh Normal file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# Function to find LLDB 18+
find_lldb() {
local lldb_paths=(
"/opt/homebrew/bin/lldb"
"/usr/local/bin/lldb"
"/usr/bin/lldb"
"lldb" # This will use the system PATH
)
for lldb_path in "${lldb_paths[@]}"; do
if command -v "$lldb_path" >/dev/null 2>&1; then
local version
version=$("$lldb_path" --version | grep -oE '[0-9]+' | head -1)
if [ "$version" -ge 18 ]; then
echo "$lldb_path"
return 0
fi
fi
done
echo "Error: LLDB 18 or higher not found" >&2
exit 1
}
# Find LLDB 18+
LLDB_PATH=$(find_lldb)
echo "LLDB_PATH: $LLDB_PATH"
$LLDB_PATH --version
export LLDB_PATH
# Default package path
export DEFAULT_PACKAGE_PATH="./_lldb/lldbtest"
# Function to build the project
build_project() {
# package_path parameter is kept for backward compatibility
local current_dir
current_dir=$(pwd) || return
if ! cd "${DEFAULT_PACKAGE_PATH}"; then
echo "Failed to change directory to ${DEFAULT_PACKAGE_PATH}" >&2
return 1
fi
LLGO_DEBUG_SYMBOLS=1 llgo build -o "debug.out" . || {
local ret=$?
cd "$current_dir" || return
return $ret
}
cd "$current_dir" || return
}

3
_lldb/lldbtest/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module lldbtest
go 1.20

569
_lldb/lldbtest/main.go Normal file
View File

@@ -0,0 +1,569 @@
package main
import "errors"
type Base struct {
name string
}
type E struct {
// Base
i int
}
type StructWithAllTypeFields struct {
i8 int8
i16 int16
i32 int32
i64 int64
i int
u8 uint8
u16 uint16
u32 uint32
u64 uint64
u uint
f32 float32
f64 float64
b bool
c64 complex64
c128 complex128
slice []int
arr [3]int
arr2 [3]E
s string
e E
pf *StructWithAllTypeFields // resursive
pi *int
intr Interface
m map[string]uint64
c chan int
err error
fn func(string) (int, error)
pad1 int
pad2 int
}
type Interface interface {
Foo(a []int, b string) int
}
type Struct struct{}
func (s *Struct) Foo(a []int, b string) int {
return 1
}
func FuncWithAllTypeStructParam(s StructWithAllTypeFields) {
println(&s)
// Expected:
// all variables: s
// s.i8: '\x01'
// s.i16: 2
// s.i32: 3
// s.i64: 4
// s.i: 5
// s.u8: '\x06'
// s.u16: 7
// s.u32: 8
// s.u64: 9
// s.u: 10
// s.f32: 11
// s.f64: 12
// s.b: true
// s.c64: complex64{real = 13, imag = 14}
// s.c128: complex128{real = 15, imag = 16}
// s.slice: []int{21, 22, 23}
// s.arr: [3]int{24, 25, 26}
// s.arr2: [3]lldbtest.E{{i = 27}, {i = 28}, {i = 29}}
// s.s: "hello"
// s.e: lldbtest.E{i = 30}
// s.pad1: 100
// s.pad2: 200
s.i8 = '\b'
// Expected:
// s.i8: '\b'
// s.i16: 2
println(len(s.s), s.i8)
}
// Params is a function with all types of parameters.
func FuncWithAllTypeParams(
i8 int8,
i16 int16,
i32 int32,
i64 int64,
i int,
u8 uint8,
u16 uint16,
u32 uint32,
u64 uint64,
u uint,
f32 float32,
f64 float64,
b bool,
c64 complex64,
c128 complex128,
slice []int,
arr [3]int,
arr2 [3]E,
s string,
e E,
f StructWithAllTypeFields,
pf *StructWithAllTypeFields,
pi *int,
intr Interface,
m map[string]uint64,
c chan int,
err error,
fn func(string) (int, error),
) (int, error) {
// Expected:
// all variables: i8 i16 i32 i64 i u8 u16 u32 u64 u f32 f64 b c64 c128 slice arr arr2 s e f pf pi intr m c err fn
// i32: 3
// i64: 4
// i: 5
// u32: 8
// u64: 9
// u: 10
// f32: 11
// f64: 12
// slice: []int{21, 22, 23}
// arr: [3]int{24, 25, 26}
// arr2: [3]lldbtest.E{{i = 27}, {i = 28}, {i = 29}}
// slice[0]: 21
// slice[1]: 22
// slice[2]: 23
// arr[0]: 24
// arr[1]: 25
// arr[2]: 26
// arr2[0].i: 27
// arr2[1].i: 28
// arr2[2].i: 29
// e: lldbtest.E{i = 30}
// Expected(skip):
// i8: '\b'
// i16: 2
// u8: '\x06'
// u16: 7
// b: true
println(
i8, i16, i32, i64, i, u8, u16, u32, u64, u,
f32, f64, b,
c64, c128,
slice, arr[0:],
s,
&e,
&f, pf, pi, intr, m,
c,
err,
fn,
)
i8 = 9
i16 = 10
i32 = 11
i64 = 12
i = 13
u8 = 14
u16 = 15
u32 = 16
u64 = 17
u = 18
f32 = 19
f64 = 20
b = false
c64 = 21 + 22i
c128 = 23 + 24i
slice = []int{31, 32, 33}
arr = [3]int{34, 35, 36}
arr2 = [3]E{{i: 37}, {i: 38}, {i: 39}}
s = "world"
e = E{i: 40}
println(i8, i16, i32, i64, i, u8, u16, u32, u64, u,
f32, f64, b,
c64, c128,
slice, arr[0:], &arr2,
s,
&e,
&f, pf, pi, intr, m,
c,
err,
fn,
)
// Expected:
// i8: '\t'
// i16: 10
// i32: 11
// i64: 12
// i: 13
// u8: '\x0e'
// u16: 15
// u32: 16
// u64: 17
// u: 18
// f32: 19
// f64: 20
// b: false
// c64: complex64{real = 21, imag = 22}
// c128: complex128{real = 23, imag = 24}
// slice: []int{31, 32, 33}
// arr2: [3]lldbtest.E{{i = 37}, {i = 38}, {i = 39}}
// s: "world"
// e: lldbtest.E{i = 40}
// Expected(skip):
// arr: [3]int{34, 35, 36}
return 1, errors.New("some error")
}
type TinyStruct struct {
I int
}
type SmallStruct struct {
I int
J int
}
type MidStruct struct {
I int
J int
K int
}
type BigStruct struct {
I int
J int
K int
L int
M int
N int
O int
P int
Q int
R int
}
func FuncStructParams(t TinyStruct, s SmallStruct, m MidStruct, b BigStruct) {
// println(&t, &s, &m, &b)
// Expected:
// all variables: t s m b
// t.I: 1
// s.I: 2
// s.J: 3
// m.I: 4
// m.J: 5
// m.K: 6
// b.I: 7
// b.J: 8
// b.K: 9
// b.L: 10
// b.M: 11
// b.N: 12
// b.O: 13
// b.P: 14
// b.Q: 15
// b.R: 16
println(t.I, s.I, s.J, m.I, m.J, m.K, b.I, b.J, b.K, b.L, b.M, b.N, b.O, b.P, b.Q, b.R)
t.I = 10
s.I = 20
s.J = 21
m.I = 40
m.J = 41
m.K = 42
b.I = 70
b.J = 71
b.K = 72
b.L = 73
b.M = 74
b.N = 75
b.O = 76
b.P = 77
b.Q = 78
b.R = 79
// Expected:
// all variables: t s m b
// t.I: 10
// s.I: 20
// s.J: 21
// m.I: 40
// m.J: 41
// m.K: 42
// b.I: 70
// b.J: 71
// b.K: 72
// b.L: 73
// b.M: 74
// b.N: 75
// b.O: 76
// b.P: 77
// b.Q: 78
// b.R: 79
println("done")
}
func FuncStructPtrParams(t *TinyStruct, s *SmallStruct, m *MidStruct, b *BigStruct) {
// Expected:
// all variables: t s m b
// t.I: 1
// s.I: 2
// s.J: 3
// m.I: 4
// m.J: 5
// m.K: 6
// b.I: 7
// b.J: 8
// b.K: 9
// b.L: 10
// b.M: 11
// b.N: 12
// b.O: 13
// b.P: 14
// b.Q: 15
// b.R: 16
println(t, s, m, b)
t.I = 10
s.I = 20
s.J = 21
m.I = 40
m.J = 41
m.K = 42
b.I = 70
b.J = 71
b.K = 72
b.L = 73
b.M = 74
b.N = 75
b.O = 76
b.P = 77
b.Q = 78
b.R = 79
// Expected:
// all variables: t s m b
// t.I: 10
// s.I: 20
// s.J: 21
// m.I: 40
// m.J: 41
// m.K: 42
// b.I: 70
// b.J: 71
// b.K: 72
// b.L: 73
// b.M: 74
// b.N: 75
// b.O: 76
// b.P: 77
// b.Q: 78
// b.R: 79
println(t.I, s.I, s.J, m.I, m.J, m.K, b.I, b.J, b.K, b.L, b.M, b.N, b.O, b.P, b.Q, b.R)
println("done")
}
func ScopeIf(branch int) {
a := 1
// Expected:
// all variables: a branch
// a: 1
if branch == 1 {
b := 2
c := 3
// Expected:
// all variables: a b c branch
// a: 1
// b: 2
// c: 3
// branch: 1
println(a, b, c)
} else {
c := 3
d := 4
// Expected:
// all variables: a c d branch
// a: 1
// c: 3
// d: 4
// branch: 0
println(a, c, d)
}
// Expected:
// all variables: a branch
// a: 1
println("a:", a)
}
func ScopeFor() {
a := 1
for i := 0; i < 10; i++ {
switch i {
case 0:
println("i is 0")
// Expected:
// all variables: i a
// i: 0
// a: 1
println("i:", i)
case 1:
println("i is 1")
// Expected:
// all variables: i a
// i: 1
// a: 1
println("i:", i)
default:
println("i is", i)
}
}
println("a:", a)
}
func ScopeSwitch(i int) {
a := 0
switch i {
case 1:
b := 1
println("i is 1")
// Expected:
// all variables: i a b
// i: 1
// a: 0
// b: 1
println("i:", i, "a:", a, "b:", b)
case 2:
c := 2
println("i is 2")
// Expected:
// all variables: i a c
// i: 2
// a: 0
// c: 2
println("i:", i, "a:", a, "c:", c)
default:
d := 3
println("i is", i)
// Expected:
// all variables: i a d
// i: 3
// a: 0
// d: 3
println("i:", i, "a:", a, "d:", d)
}
// Expected:
// all variables: a i
// a: 0
println("a:", a)
}
func main() {
FuncStructParams(TinyStruct{I: 1}, SmallStruct{I: 2, J: 3}, MidStruct{I: 4, J: 5, K: 6}, BigStruct{I: 7, J: 8, K: 9, L: 10, M: 11, N: 12, O: 13, P: 14, Q: 15, R: 16})
FuncStructPtrParams(&TinyStruct{I: 1}, &SmallStruct{I: 2, J: 3}, &MidStruct{I: 4, J: 5, K: 6}, &BigStruct{I: 7, J: 8, K: 9, L: 10, M: 11, N: 12, O: 13, P: 14, Q: 15, R: 16})
i := 100
s := StructWithAllTypeFields{
i8: 1,
i16: 2,
i32: 3,
i64: 4,
i: 5,
u8: 6,
u16: 7,
u32: 8,
u64: 9,
u: 10,
f32: 11,
f64: 12,
b: true,
c64: 13 + 14i,
c128: 15 + 16i,
slice: []int{21, 22, 23},
arr: [3]int{24, 25, 26},
arr2: [3]E{{i: 27}, {i: 28}, {i: 29}},
s: "hello",
e: E{i: 30},
pf: &StructWithAllTypeFields{i16: 100},
pi: &i,
intr: &Struct{},
m: map[string]uint64{"a": 31, "b": 32},
c: make(chan int),
err: errors.New("Test error"),
fn: func(s string) (int, error) {
println("fn:", s)
i = 201
return 1, errors.New("fn error")
},
pad1: 100,
pad2: 200,
}
// Expected:
// all variables: s i err
// s.i8: '\x01'
// s.i16: 2
// s.i32: 3
// s.i64: 4
// s.i: 5
// s.u8: '\x06'
// s.u16: 7
// s.u32: 8
// s.u64: 9
// s.u: 10
// s.f32: 11
// s.f64: 12
// s.b: true
// s.c64: complex64{real = 13, imag = 14}
// s.c128: complex128{real = 15, imag = 16}
// s.slice: []int{21, 22, 23}
// s.arr: [3]int{24, 25, 26}
// s.arr2: [3]lldbtest.E{{i = 27}, {i = 28}, {i = 29}}
// s.s: "hello"
// s.e: lldbtest.E{i = 30}
// s.pf.i16: 100
// *(s.pf).i16: 100
// *(s.pi): 100
globalStructPtr = &s
globalStruct = s
println("globalInt:", globalInt)
// Expected(skip):
// all variables: globalInt globalStruct globalStructPtr s i err
println("s:", &s)
FuncWithAllTypeStructParam(s)
println("called function with struct")
i, err := FuncWithAllTypeParams(
s.i8, s.i16, s.i32, s.i64, s.i, s.u8, s.u16, s.u32, s.u64, s.u,
s.f32, s.f64, s.b,
s.c64, s.c128,
s.slice, s.arr, s.arr2,
s.s,
s.e, s,
s.pf, s.pi,
s.intr,
s.m,
s.c,
s.err,
s.fn,
)
println(i, err)
ScopeIf(1)
ScopeIf(0)
ScopeFor()
ScopeSwitch(1)
ScopeSwitch(2)
ScopeSwitch(3)
println(globalStructPtr)
println(&globalStruct)
s.i8 = 0x12
println(s.i8)
// Expected:
// all variables: s i err
// s.i8: '\x12'
// Expected(skip):
// globalStruct.i8: '\x01'
println((*globalStructPtr).i8)
println("done")
println("")
println(&s, &globalStruct, globalStructPtr.i16, globalStructPtr)
globalStructPtr = nil
}
var globalInt int = 301
var globalStruct StructWithAllTypeFields
var globalStructPtr *StructWithAllTypeFields

297
_lldb/llgo_plugin.py Normal file
View File

@@ -0,0 +1,297 @@
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
from typing import List, Optional, Dict, Any, Tuple
import re
import lldb
def log(*args: Any, **kwargs: Any) -> None:
print(*args, **kwargs, flush=True)
def __lldb_init_module(debugger: lldb.SBDebugger, _: Dict[str, Any]) -> None:
debugger.HandleCommand(
'command script add -f llgo_plugin.print_go_expression p')
debugger.HandleCommand(
'command script add -f llgo_plugin.print_all_variables v')
def is_llgo_compiler(_target: lldb.SBTarget) -> bool:
return True
def get_indexed_value(value: lldb.SBValue, index: int) -> Optional[lldb.SBValue]:
if not value or not value.IsValid():
return None
type_name = value.GetType().GetName()
if type_name.startswith('[]'): # Slice
data_ptr = value.GetChildMemberWithName('data')
element_type = data_ptr.GetType().GetPointeeType()
element_size = element_type.GetByteSize()
ptr_value = int(data_ptr.GetValue(), 16)
element_address = ptr_value + index * element_size
target = value.GetTarget()
return target.CreateValueFromAddress(
f"element_{index}", lldb.SBAddress(element_address, target), element_type)
elif value.GetType().IsArrayType(): # Array
return value.GetChildAtIndex(index)
else:
return None
def evaluate_expression(frame: lldb.SBFrame, expression: str) -> Optional[lldb.SBValue]:
parts = re.findall(r'\*|\w+|\(|\)|\[.*?\]|\.', expression)
def evaluate_part(i: int) -> Tuple[Optional[lldb.SBValue], int]:
nonlocal parts
value: Optional[lldb.SBValue] = None
while i < len(parts):
part = parts[i]
if part == '*':
sub_value, i = evaluate_part(i + 1)
if sub_value and sub_value.IsValid():
value = sub_value.Dereference()
else:
return None, i
elif part == '(':
depth = 1
j = i + 1
while j < len(parts) and depth > 0:
if parts[j] == '(':
depth += 1
elif parts[j] == ')':
depth -= 1
j += 1
value, i = evaluate_part(i + 1)
i = j - 1
elif part == ')':
return value, i + 1
elif part == '.':
if value is None:
value = frame.FindVariable(parts[i+1])
else:
value = value.GetChildMemberWithName(parts[i+1])
i += 2
elif part.startswith('['):
index = int(part[1:-1])
value = get_indexed_value(value, index)
i += 1
else:
if value is None:
value = frame.FindVariable(part)
else:
value = value.GetChildMemberWithName(part)
i += 1
if not value or not value.IsValid():
return None, i
return value, i
value, _ = evaluate_part(0)
return value
def print_go_expression(debugger: lldb.SBDebugger, command: str, result: lldb.SBCommandReturnObject, _internal_dict: Dict[str, Any]) -> None:
frame = debugger.GetSelectedTarget().GetProcess(
).GetSelectedThread().GetSelectedFrame()
value = evaluate_expression(frame, command)
if value and value.IsValid():
result.AppendMessage(format_value(value, debugger))
else:
result.AppendMessage(
f"Error: Unable to evaluate expression '{command}'")
def print_all_variables(debugger: lldb.SBDebugger, _command: str, result: lldb.SBCommandReturnObject, _internal_dict: Dict[str, Any]) -> None:
target = debugger.GetSelectedTarget()
if not is_llgo_compiler(target):
result.AppendMessage("Not a LLGo compiled binary.")
return
frame = debugger.GetSelectedTarget().GetProcess(
).GetSelectedThread().GetSelectedFrame()
variables = frame.GetVariables(True, True, True, True)
output: List[str] = []
for var in variables:
type_name = map_type_name(var.GetType().GetName())
formatted = format_value(var, debugger, include_type=False, indent=0)
output.append(f"var {var.GetName()} {type_name} = {formatted}")
result.AppendMessage("\n".join(output))
def is_pointer(frame: lldb.SBFrame, var_name: str) -> bool:
var = frame.FindVariable(var_name)
return var.IsValid() and var.GetType().IsPointerType()
def format_value(var: lldb.SBValue, debugger: lldb.SBDebugger, include_type: bool = True, indent: int = 0) -> str:
if not var.IsValid():
return "<variable not available>"
var_type = var.GetType()
type_class = var_type.GetTypeClass()
type_name = map_type_name(var_type.GetName())
# Handle typedef types
original_type_name = type_name
while var_type.IsTypedefType():
var_type = var_type.GetTypedefedType()
type_name = map_type_name(var_type.GetName())
type_class = var_type.GetTypeClass()
if var_type.IsPointerType():
return format_pointer(var, debugger, indent, original_type_name)
if type_name.startswith('[]'): # Slice
return format_slice(var, debugger, indent)
elif var_type.IsArrayType():
return format_array(var, debugger, indent)
elif type_name == 'string': # String
return format_string(var)
elif type_class in [lldb.eTypeClassStruct, lldb.eTypeClassClass]:
return format_struct(var, debugger, include_type, indent, original_type_name)
else:
value = var.GetValue()
summary = var.GetSummary()
if value is not None:
return f"{value}" if include_type else str(value)
elif summary is not None:
return f"{summary}" if include_type else summary
else:
return "<variable not available>"
def format_slice(var: lldb.SBValue, debugger: lldb.SBDebugger, indent: int) -> str:
length = var.GetChildMemberWithName('len').GetValue()
if length is None:
return "<variable not available>"
length = int(length)
data_ptr = var.GetChildMemberWithName('data')
elements: List[str] = []
ptr_value = int(data_ptr.GetValue(), 16)
element_type = data_ptr.GetType().GetPointeeType()
element_size = element_type.GetByteSize()
target = debugger.GetSelectedTarget()
indent_str = ' ' * indent
next_indent_str = ' ' * (indent + 1)
for i in range(length):
element_address = ptr_value + i * element_size
element = target.CreateValueFromAddress(
f"element_{i}", lldb.SBAddress(element_address, target), element_type)
value = format_value(
element, debugger, include_type=False, indent=indent+1)
elements.append(value)
type_name = var.GetType().GetName()
if len(elements) > 5: # 如果元素数量大于5则进行折行显示
result = f"{type_name}{{\n{next_indent_str}" + \
f",\n{next_indent_str}".join(elements) + f"\n{indent_str}}}"
else:
result = f"{type_name}{{{', '.join(elements)}}}"
return result
def format_array(var: lldb.SBValue, debugger: lldb.SBDebugger, indent: int) -> str:
elements: List[str] = []
indent_str = ' ' * indent
next_indent_str = ' ' * (indent + 1)
for i in range(var.GetNumChildren()):
value = format_value(var.GetChildAtIndex(
i), debugger, include_type=False, indent=indent+1)
elements.append(value)
array_size = var.GetNumChildren()
element_type = map_type_name(var.GetType().GetArrayElementType().GetName())
type_name = f"[{array_size}]{element_type}"
if len(elements) > 5: # wrap line if too many elements
return f"{type_name}{{\n{next_indent_str}" + f",\n{next_indent_str}".join(elements) + f"\n{indent_str}}}"
else:
return f"{type_name}{{{', '.join(elements)}}}"
def format_string(var: lldb.SBValue) -> str:
summary = var.GetSummary()
if summary is not None:
return summary # Keep the quotes
else:
data = var.GetChildMemberWithName('data').GetValue()
length = var.GetChildMemberWithName('len').GetValue()
if data and length:
length = int(length)
error = lldb.SBError()
return '"%s"' % var.process.ReadCStringFromMemory(int(data, 16), length + 1, error)
return "<variable not available>"
def format_struct(var: lldb.SBValue, debugger: lldb.SBDebugger, include_type: bool = True, indent: int = 0, type_name: str = "") -> str:
children: List[str] = []
indent_str = ' ' * indent
next_indent_str = ' ' * (indent + 1)
for i in range(var.GetNumChildren()):
child = var.GetChildAtIndex(i)
child_name = child.GetName()
child_value = format_value(
child, debugger, include_type=False, indent=indent+1)
children.append(f"{child_name} = {child_value}")
if len(children) > 5: # 如果字段数量大于5则进行折行显示
struct_content = "{\n" + ",\n".join(
[f"{next_indent_str}{child}" for child in children]) + f"\n{indent_str}}}"
else:
struct_content = f"{{{', '.join(children)}}}"
if include_type:
return f"{type_name}{struct_content}"
else:
return struct_content
def format_pointer(var: lldb.SBValue, _debugger: lldb.SBDebugger, _indent: int, _type_name: str) -> str:
if not var.IsValid() or var.GetValueAsUnsigned() == 0:
return "<variable not available>"
return var.GetValue() # Return the address as a string
def map_type_name(type_name: str) -> str:
# Handle pointer types
if type_name.endswith('*'):
base_type = type_name[:-1].strip()
mapped_base_type = map_type_name(base_type)
return f"*{mapped_base_type}"
# Map other types
type_mapping: Dict[str, str] = {
'long': 'int',
'void': 'unsafe.Pointer',
'char': 'byte',
'short': 'int16',
'int': 'int32',
'long long': 'int64',
'unsigned char': 'uint8',
'unsigned short': 'uint16',
'unsigned int': 'uint32',
'unsigned long': 'uint',
'unsigned long long': 'uint64',
'float': 'float32',
'double': 'float64',
}
for c_type, go_type in type_mapping.items():
if type_name.startswith(c_type):
return type_name.replace(c_type, go_type, 1)
return type_name

15
_lldb/runlldb.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
set -e
# Source common functions and variables
# shellcheck source=./_lldb/common.sh
source "$(dirname "$0")/common.sh"
executable="$1"
# Get the directory of the current script
script_dir="$(dirname "$0")"
# Run LLDB with the LLGO plugin
"$LLDB_PATH" -O "command script import ${script_dir}/llgo_plugin.py" "$executable"

69
_lldb/runtest.sh Executable file
View File

@@ -0,0 +1,69 @@
#!/bin/bash
set -e
# Source common functions and variables
# shellcheck source=./_lldb/common.sh
# shellcheck disable=SC1091
source "$(dirname "$0")/common.sh" || exit 1
# Parse command-line arguments
package_path="$DEFAULT_PACKAGE_PATH"
verbose=False
interactive=False
plugin_path=None
while [[ $# -gt 0 ]]; do
case $1 in
-v|--verbose)
verbose=True
shift
;;
-i|--interactive)
interactive=True
shift
;;
-p|--plugin)
plugin_path="\"$2\""
shift 2
;;
*)
package_path="$1"
shift
;;
esac
done
# Build the project
build_project "$package_path" || exit 1
# Set up the result file path
result_file="/tmp/lldb_exit_code"
# Prepare LLDB commands
lldb_commands=(
"command script import ../llgo_plugin.py"
"command script import ../test.py"
"script test.run_tests_with_result('./debug.out', ['main.go'], $verbose, $interactive, $plugin_path, '$result_file')"
"quit"
)
# Run LLDB with prepared commands
lldb_command_string=""
for cmd in "${lldb_commands[@]}"; do
lldb_command_string+=" -o \"$cmd\""
done
cd "$package_path"
# Run LLDB with the test script
eval "$LLDB_PATH $lldb_command_string"
# Read the exit code from the result file
if [ -f "$result_file" ]; then
exit_code=$(cat "$result_file")
rm "$result_file"
exit "$exit_code"
else
echo "Error: Could not find exit code file"
exit 1
fi

402
_lldb/test.py Normal file
View File

@@ -0,0 +1,402 @@
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring
import os
import sys
import argparse
import signal
from dataclasses import dataclass, field
from typing import List, Optional, Set, Dict, Any
import lldb
import llgo_plugin
from llgo_plugin import log
class LLDBTestException(Exception):
pass
@dataclass
class Test:
source_file: str
line_number: int
variable: str
expected_value: str
@dataclass
class TestResult:
test: Test
status: str
actual: Optional[str] = None
message: Optional[str] = None
missing: Optional[Set[str]] = None
extra: Optional[Set[str]] = None
@dataclass
class TestCase:
source_file: str
start_line: int
end_line: int
tests: List[Test]
@dataclass
class CaseResult:
test_case: TestCase
function: str
results: List[TestResult]
@dataclass
class TestResults:
total: int = 0
passed: int = 0
failed: int = 0
case_results: List[CaseResult] = field(default_factory=list)
class LLDBDebugger:
def __init__(self, executable_path: str, plugin_path: Optional[str] = None) -> None:
self.executable_path: str = executable_path
self.plugin_path: Optional[str] = plugin_path
self.debugger: lldb.SBDebugger = lldb.SBDebugger.Create()
self.debugger.SetAsync(False)
self.target: Optional[lldb.SBTarget] = None
self.process: Optional[lldb.SBProcess] = None
self.type_mapping: Dict[str, str] = {
'long': 'int',
'unsigned long': 'uint',
}
def setup(self) -> None:
if self.plugin_path:
self.debugger.HandleCommand(
f'command script import "{self.plugin_path}"')
self.target = self.debugger.CreateTarget(self.executable_path)
if not self.target:
raise LLDBTestException(
f"Failed to create target for {self.executable_path}")
self.debugger.HandleCommand(
'command script add -f llgo_plugin.print_go_expression p')
self.debugger.HandleCommand(
'command script add -f llgo_plugin.print_all_variables v')
def set_breakpoint(self, file_spec: str, line_number: int) -> lldb.SBBreakpoint:
bp = self.target.BreakpointCreateByLocation(file_spec, line_number)
if not bp.IsValid():
raise LLDBTestException(
f"Failed to set breakpoint at {file_spec}: {line_number}")
return bp
def run_to_breakpoint(self) -> None:
if not self.process:
self.process = self.target.LaunchSimple(None, None, os.getcwd())
else:
self.process.Continue()
if self.process.GetState() != lldb.eStateStopped:
raise LLDBTestException("Process didn't stop at breakpoint")
def get_variable_value(self, var_expression: str) -> Optional[str]:
frame = self.process.GetSelectedThread().GetFrameAtIndex(0)
value = llgo_plugin.evaluate_expression(frame, var_expression)
if value and value.IsValid():
return llgo_plugin.format_value(value, self.debugger)
return None
def get_all_variable_names(self) -> Set[str]:
frame = self.process.GetSelectedThread().GetFrameAtIndex(0)
return set(var.GetName() for var in frame.GetVariables(True, True, True, True))
def get_current_function_name(self) -> str:
frame = self.process.GetSelectedThread().GetFrameAtIndex(0)
return frame.GetFunctionName()
def cleanup(self) -> None:
if self.process and self.process.IsValid():
self.process.Kill()
lldb.SBDebugger.Destroy(self.debugger)
def run_console(self) -> bool:
log("\nEntering LLDB interactive mode.")
log("Type 'quit' to exit and continue with the next test case.")
log("Use Ctrl+D to exit and continue, or Ctrl+C to abort all tests.")
old_stdin, old_stdout, old_stderr = sys.stdin, sys.stdout, sys.stderr
sys.stdin, sys.stdout, sys.stderr = sys.__stdin__, sys.__stdout__, sys.__stderr__
self.debugger.SetAsync(True)
self.debugger.HandleCommand("settings set auto-confirm true")
self.debugger.HandleCommand("command script import lldb")
interpreter = self.debugger.GetCommandInterpreter()
continue_tests = True
def keyboard_interrupt_handler(_sig: Any, _frame: Any) -> None:
nonlocal continue_tests
log("\nTest execution aborted by user.")
continue_tests = False
raise KeyboardInterrupt
original_handler = signal.signal(
signal.SIGINT, keyboard_interrupt_handler)
try:
while continue_tests:
log("\n(lldb) ", end="")
try:
command = input().strip()
except EOFError:
log("\nExiting LLDB interactive mode. Continuing with next test case.")
break
except KeyboardInterrupt:
break
if command.lower() == 'quit':
log("\nExiting LLDB interactive mode. Continuing with next test case.")
break
result = lldb.SBCommandReturnObject()
interpreter.HandleCommand(command, result)
log(result.GetOutput().rstrip() if result.Succeeded()
else result.GetError().rstrip())
finally:
signal.signal(signal.SIGINT, original_handler)
sys.stdin, sys.stdout, sys.stderr = old_stdin, old_stdout, old_stderr
return continue_tests
def parse_expected_values(source_files: List[str]) -> List[TestCase]:
test_cases: List[TestCase] = []
for source_file in source_files:
with open(source_file, 'r', encoding='utf-8') as f:
content = f.readlines()
i = 0
while i < len(content):
line = content[i].strip()
if line.startswith('// Expected:'):
start_line = i + 1
tests: List[Test] = []
i += 1
while i < len(content):
line = content[i].strip()
if not line.startswith('//'):
break
parts = line.lstrip('//').strip().split(':', 1)
if len(parts) == 2:
var, value = map(str.strip, parts)
tests.append(Test(source_file, i + 1, var, value))
i += 1
end_line = i
test_cases.append(
TestCase(source_file, start_line, end_line, tests))
else:
i += 1
return test_cases
def execute_tests(executable_path: str, test_cases: List[TestCase], verbose: bool, interactive: bool, plugin_path: Optional[str]) -> TestResults:
results = TestResults()
for test_case in test_cases:
debugger = LLDBDebugger(executable_path, plugin_path)
try:
if verbose:
log(
f"\nSetting breakpoint at {test_case.source_file}:{test_case.end_line}")
debugger.setup()
debugger.set_breakpoint(test_case.source_file, test_case.end_line)
debugger.run_to_breakpoint()
all_variable_names = debugger.get_all_variable_names()
case_result = execute_test_case(
debugger, test_case, all_variable_names)
results.total += len(case_result.results)
results.passed += sum(1 for r in case_result.results if r.status == 'pass')
results.failed += sum(1 for r in case_result.results if r.status != 'pass')
results.case_results.append(case_result)
case = case_result.test_case
loc = f"{case.source_file}:{case.start_line}-{case.end_line}"
if verbose or interactive or any(r.status != 'pass' for r in case_result.results):
log(f"\nTest case: {loc} in function '{case_result.function}'")
for result in case_result.results:
print_test_result(result, verbose=verbose)
if interactive and any(r.status != 'pass' for r in case_result.results):
log("\nTest case failed. Entering LLDB interactive mode.")
continue_tests = debugger.run_console()
if not continue_tests:
log("Aborting all tests.")
break
finally:
debugger.cleanup()
return results
def run_tests(executable_path: str, source_files: List[str], verbose: bool, interactive: bool, plugin_path: Optional[str]) -> int:
test_cases = parse_expected_values(source_files)
if verbose:
log(f"Running tests for {', '.join(source_files)} with {executable_path}")
log(f"Found {len(test_cases)} test cases")
results = execute_tests(executable_path, test_cases,
verbose, interactive, plugin_path)
print_test_results(results)
# Return 0 if all tests passed, 1 otherwise
return 0 if results.failed == 0 else 1
def execute_test_case(debugger: LLDBDebugger, test_case: TestCase, all_variable_names: Set[str]) -> CaseResult:
results: List[TestResult] = []
for test in test_case.tests:
if test.variable == "all variables":
result = execute_all_variables_test(test, all_variable_names)
else:
result = execute_single_variable_test(debugger, test)
results.append(result)
return CaseResult(test_case, debugger.get_current_function_name(), results)
def execute_all_variables_test(test: Test, all_variable_names: Set[str]) -> TestResult:
expected_vars = set(test.expected_value.split())
if expected_vars == all_variable_names:
return TestResult(
test=test,
status='pass',
actual=all_variable_names
)
else:
return TestResult(
test=test,
status='fail',
actual=all_variable_names,
missing=expected_vars - all_variable_names,
extra=all_variable_names - expected_vars
)
def execute_single_variable_test(debugger: LLDBDebugger, test: Test) -> TestResult:
actual_value = debugger.get_variable_value(test.variable)
if actual_value is None:
return TestResult(
test=test,
status='error',
message=f'Unable to fetch value for {test.variable}'
)
actual_value = actual_value.strip()
expected_value = test.expected_value.strip()
if actual_value == expected_value:
return TestResult(
test=test,
status='pass',
actual=actual_value
)
else:
return TestResult(
test=test,
status='fail',
actual=actual_value
)
def print_test_results(results: TestResults) -> None:
log("\nTest results:")
log(f" Total tests: {results.total}")
log(f" Passed tests: {results.passed}")
log(f" Failed tests: {results.failed}")
if results.total == results.passed:
log("All tests passed!")
else:
log("Some tests failed")
def print_test_result(result: TestResult, verbose: bool) -> None:
status_symbol = "" if result.status == 'pass' else ""
status_text = "Pass" if result.status == 'pass' else "Fail"
test = result.test
if result.status == 'pass':
if verbose:
log(f"{status_symbol} Line {test.line_number}, {test.variable}: {status_text}")
if test.variable == 'all variables':
log(f" Variables: {', '.join(sorted(result.actual))}")
else: # fail or error
log(f"{status_symbol} Line {test.line_number}, {test.variable}: {status_text}")
if test.variable == 'all variables':
if result.missing:
log(f" Missing variables: {', '.join(sorted(result.missing))}")
if result.extra:
log(f" Extra variables: {', '.join(sorted(result.extra))}")
log(f" Expected: {', '.join(sorted(test.expected_value.split()))}")
log(f" Actual: {', '.join(sorted(result.actual))}")
elif result.status == 'error':
log(f" Error: {result.message}")
else:
log(f" Expected: {test.expected_value}")
log(f" Actual: {result.actual}")
def run_tests_with_result(executable_path: str, source_files: List[str], verbose: bool, interactive: bool, plugin_path: Optional[str], result_path: str) -> int:
try:
exit_code = run_tests(executable_path, source_files,
verbose, interactive, plugin_path)
except Exception as e:
log(f"An error occurred during test execution: {str(e)}")
exit_code = 2 # Use a different exit code for unexpected errors
try:
with open(result_path, 'w', encoding='utf-8') as f:
f.write(str(exit_code))
except IOError as e:
log(f"Error writing result to file {result_path}: {str(e)}")
# If we can't write to the file, we should still return the exit code
return exit_code
def main() -> None:
log(sys.argv)
parser = argparse.ArgumentParser(
description="LLDB 18 Debug Script with DWARF 5 Support")
parser.add_argument("executable", help="Path to the executable")
parser.add_argument("sources", nargs='+', help="Paths to the source files")
parser.add_argument("-v", "--verbose", action="store_true",
help="Enable verbose output")
parser.add_argument("-i", "--interactive", action="store_true",
help="Enable interactive mode on test failure")
parser.add_argument("--plugin", help="Path to the LLDB plugin")
parser.add_argument("--result-path", help="Path to write the result")
args = parser.parse_args()
plugin_path = args.plugin or os.path.join(os.path.dirname(
os.path.realpath(__file__)), "go_lldb_plugin.py")
try:
if args.result_path:
exit_code = run_tests_with_result(args.executable, args.sources,
args.verbose, args.interactive, plugin_path, args.result_path)
else:
exit_code = run_tests(args.executable, args.sources,
args.verbose, args.interactive, plugin_path)
except Exception as e:
log(f"An unexpected error occurred: {str(e)}")
exit_code = 2 # Use a different exit code for unexpected errors
sys.exit(exit_code)
if __name__ == "__main__":
main()

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/math"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/math"
"github.com/goplus/lib/py/std"
)
func main() {

5
_pydemo/go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/goplus/llgo/_pydemo
go 1.20
require github.com/goplus/lib v0.2.0

2
_pydemo/go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g=
github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0=

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/numpy"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/numpy"
"github.com/goplus/lib/py/std"
)
func main() {

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/std"
)
func main() {

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/py/math"
"github.com/goplus/lib/c"
"github.com/goplus/lib/py/math"
)
func main() {

View File

@@ -1,8 +1,8 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/std"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/std"
)
func main() {

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/statistics"
"github.com/goplus/lib/c"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/statistics"
)
func main() {

View File

@@ -1,9 +1,9 @@
package main
import (
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/std"
"github.com/goplus/llgo/py/torch"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/std"
"github.com/goplus/lib/py/torch"
)
func main() {

221
_xtool/castdump/castdump.go Normal file
View File

@@ -0,0 +1,221 @@
package main
import (
"fmt"
"os"
"strings"
"unsafe"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/clang"
)
type Data struct {
Depth c.Uint
Unit *clang.TranslationUnit
}
var accessMap = map[clang.CXXAccessSpecifier]string{
clang.CXXInvalidAccessSpecifier: "invalid",
clang.CXXPublic: "public",
clang.CXXProtected: "protected",
clang.CXXPrivate: "private",
}
func printIndent(depth c.Uint) {
fmt.Print(strings.Repeat(" ", int(depth)))
}
func accessToString(spec clang.CXXAccessSpecifier) string {
if str, ok := accessMap[spec]; ok {
return str
}
return "unknown"
}
func visit(cursor, parent clang.Cursor, ClientData c.Pointer) clang.ChildVisitResult {
data := (*Data)(ClientData)
printAST(cursor, data)
return clang.ChildVisit_Continue
}
func printType(t clang.Type, data *Data) {
printIndent(data.Depth)
typeSpell := t.String()
typeKind := t.Kind.String()
if t.Kind == clang.TypeInvalid {
} else if t.Kind == clang.TypeUnexposed {
c.Printf(c.Str("<UnexposedType|%s>: %s\n"), typeKind.CStr(), typeSpell.CStr())
} else if t.Kind >= clang.TypeFirstBuiltin && t.Kind <= clang.TypeLastBuiltin {
c.Printf(c.Str("<BuiltinType|%s>: %s\n"), typeKind.CStr(), typeSpell.CStr())
} else if t.Kind > clang.TypeComplex {
c.Printf(c.Str("<ComplexType|%s>: %s\n"), typeKind.CStr(), typeSpell.CStr())
}
data.Depth++
switch t.Kind {
case clang.TypePointer:
printType(t.PointeeType(), data)
case clang.TypeIncompleteArray, clang.TypeVariableArray, clang.TypeDependentSizedArray, clang.TypeConstantArray:
printType(t.ArrayElementType(), data)
case clang.TypeTypedef:
printType(t.TypeDeclaration().TypedefDeclUnderlyingType(), data)
case clang.TypeElaborated:
printType(t.NamedType(), data)
case clang.TypeFunctionProto:
printType(t.ResultType(), data)
for i := 0; i < int(t.NumArgTypes()); i++ {
printType(t.ArgType(c.Uint(i)), data)
}
}
data.Depth--
typeKind.Dispose()
typeSpell.Dispose()
}
func printLocation(cursor clang.Cursor) {
loc := cursor.Location()
var file clang.File
var line, column c.Uint
loc.SpellingLocation(&file, &line, &column, nil)
filename := file.FileName()
defer filename.Dispose()
c.Printf(c.Str("(Loc:%s:%d:%d)\n"), filename.CStr(), line, column)
}
func printAccess(cursor clang.Cursor) {
kind := cursor.Kind.String()
spell := cursor.String()
defer kind.Dispose()
defer spell.Dispose()
c.Printf(c.Str("%s: %s %s"), kind.CStr(), spell.CStr(), c.AllocaCStr(accessToString(cursor.CXXAccessSpecifier())))
printLocation(cursor)
}
func printMacro(cursor clang.Cursor, unit *clang.TranslationUnit) {
kind := cursor.Kind.String()
defer kind.Dispose()
c.Printf(c.Str("%s: "), kind.CStr())
ran := cursor.Extent()
var numTokens c.Uint
var tokens *clang.Token
unit.Tokenize(ran, &tokens, &numTokens)
defer unit.DisposeTokens(tokens, numTokens)
tokensSlice := unsafe.Slice(tokens, int(numTokens))
for _, tok := range tokensSlice {
tokStr := unit.Token(tok)
c.Printf(c.Str("%s "), tokStr.CStr())
tokStr.Dispose()
}
printLocation(cursor)
}
func printFunc(cursor clang.Cursor, data *Data) {
kind := cursor.Kind.String()
spell := cursor.String()
symbol := cursor.Mangling()
defer symbol.Dispose()
defer kind.Dispose()
defer spell.Dispose()
c.Printf(c.Str("%s: %s (Symbol: %s)"), kind.CStr(), spell.CStr(), symbol.CStr())
printLocation(cursor)
printType(cursor.Type(), data)
}
func printEnumConstant(cursor clang.Cursor) {
kind := cursor.Kind.String()
spell := cursor.String()
defer kind.Dispose()
defer spell.Dispose()
c.Printf(c.Str("%s: %s:%lld"), kind.CStr(), spell.CStr(), cursor.EnumConstantDeclValue())
printLocation(cursor)
}
func printDefault(cursor clang.Cursor, data *Data) {
kind := cursor.Kind.String()
spell := cursor.String()
defer kind.Dispose()
defer spell.Dispose()
// node which has type
if cursor.Type().Kind != clang.TypeInvalid {
c.Printf(c.Str("%s: %s"), kind.CStr(), spell.CStr())
printLocation(cursor)
printType(cursor.Type(), data)
} else {
c.Printf(c.Str("%s: %s\n"), kind.CStr(), spell.CStr())
}
}
func printAST(cursor clang.Cursor, data *Data) {
kind := cursor.Kind.String()
spell := cursor.String()
printIndent(data.Depth)
switch cursor.Kind {
case clang.CursorCXXAccessSpecifier:
printAccess(cursor)
case clang.CursorMacroDefinition:
printMacro(cursor, data.Unit)
case clang.CursorFunctionDecl, clang.CursorCXXMethod, clang.CursorConstructor, clang.CursorDestructor:
printFunc(cursor, data)
case clang.CursorEnumConstantDecl:
printEnumConstant(cursor)
default:
printDefault(cursor, data)
}
data.Depth++
clang.VisitChildren(cursor, visit, c.Pointer(data))
data.Depth--
kind.Dispose()
spell.Dispose()
}
func main() {
if c.Argc != 2 {
fmt.Fprintln(os.Stderr, "Usage: castdump <headerFile>")
return
}
args := make([]*c.Char, 3)
args[0] = c.Str("-x")
args[1] = c.Str("c++")
args[2] = c.Str("-std=c++11")
sourceFile := *c.Advance(c.Argv, 1)
index := clang.CreateIndex(0, 0)
unit := index.ParseTranslationUnit(
sourceFile,
unsafe.SliceData(args), 3,
nil, 0,
clang.DetailedPreprocessingRecord,
)
defer index.Dispose()
defer unit.Dispose()
if unit == nil {
println("Unable to parse translation unit. Quitting.")
c.Exit(1)
}
cursor := unit.Cursor()
Data := &Data{
Depth: 0,
Unit: unit,
}
printAST(cursor, Data)
}

5
_xtool/go.mod Normal file
View File

@@ -0,0 +1,5 @@
module github.com/goplus/llgo/_xtool
go 1.20
require github.com/goplus/lib v0.2.0

2
_xtool/go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/goplus/lib v0.2.0 h1:AjqkN1XK5H23wZMMlpaUYAMCDAdSBQ2NMFrLtSh7W4g=
github.com/goplus/lib v0.2.0/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0=

View File

@@ -17,10 +17,10 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/cjson"
"github.com/goplus/llgo/py"
"github.com/goplus/llgo/py/inspect"
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/cjson"
"github.com/goplus/lib/py"
"github.com/goplus/lib/py/inspect"
)
func main() {
@@ -38,7 +38,7 @@ func main() {
items := cjson.Array()
mod := py.ImportModule(pyLib)
keys := mod.ModuleGetDict().DictKeys()
for i, n := uintptr(0), keys.ListLen(); i < n; i++ {
for i, n := 0, keys.ListLen(); i < n; i++ {
key := keys.ListItem(i)
val := mod.GetAttr(key)
doc := val.GetAttrString(c.Str("__doc__"))

View File

@@ -1,17 +0,0 @@
typedef union {
double d;
float f;
long v;
} castUnion;
double llgoToFloat64(long v) {
castUnion k;
k.v = v;
return k.d;
}
float llgoToFloat32(long v) {
castUnion k;
k.v = v;
return k.f;
}

View File

@@ -1,31 +0,0 @@
LLGo wrapper of DaveGamble/cJSON
=====
## How to install
### on macOS (Homebrew)
```sh
brew install cjson
```
### on Linux (Debian/Ubuntu)
```sh
apt-get install -y libcjson-dev
```
## Demos
The `_demo` directory contains our demos (it start with `_` to prevent the `go` command from compiling it):
* [mkjson](_demo/mkjson/mkjson.go): create a json object and print it
### How to run demos
To run the demos in directory `_demo`:
```sh
cd <demo-directory> # eg. cd _demo/mkjson
llgo run .
```

View File

@@ -1,43 +0,0 @@
package main
import (
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/cjson"
)
func main() {
mod := cjson.Object()
mod.SetItem(c.Str("name"), cjson.String(c.Str("math")))
syms := cjson.Array()
fn := cjson.Object()
fn.SetItem(c.Str("name"), cjson.String(c.Str("sqrt")))
fn.SetItem(c.Str("sig"), cjson.String(c.Str("(x, /)")))
syms.AddItem(fn)
v := cjson.Object()
v.SetItem(c.Str("name"), cjson.String(c.Str("pi")))
syms.AddItem(v)
mod.SetItem(c.Str("items"), syms)
cstr := mod.CStr()
str := c.GoString(cstr)
c.Printf(c.Str("%s\n"), cstr)
cjson.FreeCStr(cstr)
mod.Delete()
cjsonLoad(str)
}
func cjsonLoad(str string) {
mod := cjson.ParseString(str)
cstr := mod.Print()
c.Printf(c.Str("%s\n"), cstr)
cjson.FreeCStr(cstr)
mod.Delete()
}

View File

@@ -1,153 +0,0 @@
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cjson
import (
"unsafe"
"github.com/goplus/llgo/c"
)
const (
LLGoPackage = "link: $(pkg-config --libs libcjson); -lcjson"
)
// llgo:type C
type JSON struct {
Unused [0]byte
}
//go:linkname Parse C.cJSON_Parse
func Parse(value *c.Char) *JSON
//go:linkname ParseWithLength C.cJSON_ParseWithLength
func ParseWithLength(value *byte, valueLength uintptr) *JSON
func ParseBytes(value []byte) *JSON {
return ParseWithLength(unsafe.SliceData(value), uintptr(len(value)))
}
func ParseString(value string) *JSON {
return ParseWithLength(unsafe.StringData(value), uintptr(len(value)))
}
//go:linkname Null C.cJSON_CreateNull
func Null() *JSON
//go:linkname True C.cJSON_CreateTrue
func True() *JSON
//go:linkname False C.cJSON_CreateFalse
func False() *JSON
//go:linkname Bool C.cJSON_CreateBool
func Bool(boolean c.Int) *JSON
//go:linkname Number C.cJSON_CreateNumber
func Number(num float64) *JSON
//go:linkname String C.cJSON_CreateString
func String(str *c.Char) *JSON
//go:linkname Array C.cJSON_CreateArray
func Array() *JSON
//go:linkname Object C.cJSON_CreateObject
func Object() *JSON
// raw json
//
//go:linkname Raw C.cJSON_CreateRaw
func Raw(raw *c.Char) *JSON
// Create a string where valuestring references a string so
// it will not be freed by Delete
//
//go:linkname StringRef C.cJSON_CreateStringReference
func StringRef(str *c.Char) *JSON
// Create an object that only references it's elements so
// they will not be freed by Delete
//
//go:linkname ObjectRef C.cJSON_CreateObjectReference
func ObjectRef(child *JSON) *JSON
// Create an array that only references it's elements so
// they will not be freed by Delete
//
//go:linkname ArrayRef C.cJSON_CreateArrayReference
func ArrayRef(child *JSON) *JSON
// Delete a JSON entity and all subentities.
//
// llgo:link (*JSON).Delete C.cJSON_Delete
func (o *JSON) Delete() {}
// Append item to the specified array.
//
// llgo:link (*JSON).AddItem C.cJSON_AddItemToArray
func (o *JSON) AddItem(item *JSON) c.Int { return 0 }
// Append item to the specified object.
//
// llgo:link (*JSON).SetItem C.cJSON_AddItemToObject
func (o *JSON) SetItem(key *c.Char, item *JSON) c.Int { return 0 }
// llgo:link (*JSON).CStr C.cJSON_PrintUnformatted
func (o *JSON) CStr() *c.Char { return nil }
// Same as CStr. Provided for Go+.
//
// llgo:link (*JSON).Cstr C.cJSON_PrintUnformatted
func (o *JSON) Cstr() *c.Char { return nil }
// Render a JSON entity to text for transfer/storage.
//
// llgo:link (*JSON).Print C.cJSON_Print
func (o *JSON) Print() *c.Char { return nil }
// Render a JSON entity to text for transfer/storage without any formatting.
//
// llgo:link (*JSON).PrintUnformatted C.cJSON_PrintUnformatted
func (o *JSON) PrintUnformatted() *c.Char { return nil }
// Render a JSON entity to text using a buffered strategy.
//
// prebuffer is a guess at the final size. guessing well reduces reallocation.
//
// fmt=0 gives unformatted, =1 gives formatted.
//
// llgo:link (*JSON).PrintBuffered C.cJSON_PrintBuffered
func (o *JSON) PrintBuffered(prebuffer c.Int, fmt c.Int) *c.Char { return nil }
// llgo:link (*JSON).GetObjectItemCaseSensitive C.cJSON_GetObjectItemCaseSensitive
func (o *JSON) GetObjectItemCaseSensitive(key *c.Char) *JSON { return nil }
// llgo:link (*JSON).GetArraySize C.cJSON_GetArraySize
func (o *JSON) GetArraySize() c.Int { return 0 }
// llgo:link (*JSON).GetArrayItem C.cJSON_GetArrayItem
func (o *JSON) GetArrayItem(index c.Int) *JSON { return nil }
// llgo:link (*JSON).GetStringValue C.cJSON_GetStringValue
func (o *JSON) GetStringValue() *c.Char { return nil }
//go:linkname Free C.cJSON_free
func Free(ptr unsafe.Pointer)
//go:linkname FreeCStr C.cJSON_free
func FreeCStr(*c.Char)

Some files were not shown because too many files have changed in this diff Show More