Documentation
¶
Overview ¶
Package locality defines the source-level TLS and GLS declaration model. It intentionally has no dependency on LLGo's SSA or LLVM lowering layers.
Index ¶
- Constants
- func Directive(kind Kind) string
- func Prepare(fset *token.FileSet, pkgPath string, pkg *types.Package, typeInfo *types.Info, ...) (map[string]Info, error)
- func ValidateDoc(fset *token.FileSet, doc *ast.CommentGroup) error
- func ValidateFuncBody(fset *token.FileSet, body *ast.BlockStmt) error
- func ValidateNonPackageVar(fset *token.FileSet, decl *ast.GenDecl) error
- func ValidatePrepared(pkgPath string, vars map[string]Info) error
- type Info
- type Kind
- type Variable
Constants ¶
const ( ThreadDirective = "//llgo:tls" GoroutineDirective = "//llgo:gls" InitPrefix = "__llgo_local_init_" )
Variables ¶
This section is empty.
Functions ¶
func Prepare ¶
func Prepare(fset *token.FileSet, pkgPath string, pkg *types.Package, typeInfo *types.Info, files []*ast.File, vars map[string]Info) (map[string]Info, error)
Prepare rewrites local package initializers into replayable synthetic functions and returns updated metadata. It is idempotent for repeated calls, including calls made by another compiler Program reusing the same syntax and types.Package objects.
func ValidateDoc ¶
func ValidateDoc(fset *token.FileSet, doc *ast.CommentGroup) error
ValidateDoc rejects a locality directive outside a package-level var.
func ValidateFuncBody ¶
ValidateFuncBody rejects locality directives on declarations nested inside a function or function literal.
func ValidateNonPackageVar ¶
ValidateNonPackageVar rejects locality directives on declarations other than package-level vars, including grouped import/type/const specs.
Types ¶
type Kind ¶
type Kind uint8
Kind identifies the execution context that owns a package variable.