build: fix unsafe.Sizeof for llgo:type C #524
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
unsafe.Sizeof 在 types.check 中转换为整数值,所以在 types.check 之前预先分析 []*ast.File 查找 llgo:type C 标志,用来判断 prog.TypesSize.Sizeof 和 prog.gocvt.cvtType 。
func (Deduper).SetPreload(fn func(pkg *types.Package, syntax []*ast.File))
func (Deduper).SetPkgPath(fn func(path, name string) string)
deduper.SetPreload
for checkllgo:type C
before types.check(Program).SetTypeBackground(fullName string, bg Background)
use the
goTypes.typbg
map for types.Sizes andgoTypes.cvtType
use
internal/packages.Deduper.SetPkgPath
for custome pkgPath.