Constants & Variables
aixbigafMagic
const
#
const aixbigafMagic = "
arDateOff
const
#
const arDateOff = *ast.BinaryExpr
arDateSize
const
#
const arDateSize = 12
arFmagOff
const
#
const arFmagOff = *ast.BinaryExpr
arFmagSize
const
#
const arFmagSize = 2
arGIDOff
const
#
const arGIDOff = *ast.BinaryExpr
arGIDSize
const
#
const arGIDSize = 6
arHdrSize
const
#
const arHdrSize = *ast.BinaryExpr
arModeOff
const
#
const arModeOff = *ast.BinaryExpr
arModeSize
const
#
const arModeSize = 8
arNameOff
const
#
const arNameOff = 0
arNameSize
const
#
const arNameSize = 16
arSizeOff
const
#
const arSizeOff = *ast.BinaryExpr
arSizeSize
const
#
const arSizeSize = 10
arUIDOff
const
#
const arUIDOff = *ast.BinaryExpr
arUIDSize
const
#
const arUIDSize = 6
archiveMagic
const
#
const archiveMagic = "!
arfmag
const
#
const arfmag = "`\n"
armag
const
#
const armag = "!\n"
armagb
const
#
const armagb = "\n"
armagt
const
#
const armagt = "!\n"
gccgoBuiltinANY
const
#
const gccgoBuiltinANY = 22
gccgoBuiltinBOOL
const
#
const gccgoBuiltinBOOL = 15
gccgoBuiltinBYTE
const
#
const gccgoBuiltinBYTE = 20
gccgoBuiltinCOMPLEX128
const
#
const gccgoBuiltinCOMPLEX128 = 18
gccgoBuiltinCOMPLEX64
const
#
const gccgoBuiltinCOMPLEX64 = 17
gccgoBuiltinERROR
const
#
const gccgoBuiltinERROR = 19
gccgoBuiltinFLOAT32
const
#
const gccgoBuiltinFLOAT32 = 9
gccgoBuiltinFLOAT64
const
#
const gccgoBuiltinFLOAT64 = 10
gccgoBuiltinINT
const
#
const gccgoBuiltinINT = 11
gccgoBuiltinINT16
const
#
const gccgoBuiltinINT16 = 2
gccgoBuiltinINT32
const
#
const gccgoBuiltinINT32 = 3
gccgoBuiltinINT64
const
#
const gccgoBuiltinINT64 = 4
gccgoBuiltinINT8
const
#
const gccgoBuiltinINT8 = 1
gccgoBuiltinRUNE
const
#
const gccgoBuiltinRUNE = 21
gccgoBuiltinSTRING
const
#
const gccgoBuiltinSTRING = 16
gccgoBuiltinUINT
const
#
const gccgoBuiltinUINT = 12
gccgoBuiltinUINT16
const
#
const gccgoBuiltinUINT16 = 6
gccgoBuiltinUINT32
const
#
const gccgoBuiltinUINT32 = 7
gccgoBuiltinUINT64
const
#
const gccgoBuiltinUINT64 = 8
gccgoBuiltinUINT8
const
#
const gccgoBuiltinUINT8 = 5
gccgoBuiltinUINTPTR
const
#
const gccgoBuiltinUINTPTR = 13
gccgov1Magic
const
#
const gccgov1Magic = "v1;\n"
gccgov2Magic
const
#
const gccgov2Magic = "v2;\n"
gccgov3Magic
const
#
const gccgov3Magic = "v3;\n"
goimporterMagic
const
#
const goimporterMagic = "\n$$ "
reserved
var
#
var reserved = *ast.CallExpr
Functions
Error
method
#
func (e importError) Error() string
GetImporter
function
#
func GetImporter(searchpaths []string, initmap map[*types.Package]InitData) Importer
GetImporter
method
#
Return an importer that searches incpaths followed by the gcc installation's
built-in search paths and the current directory.
func (inst *GccgoInstallation) GetImporter(incpaths []string, initmap map[*types.Package]InitData) Importer
InitFromDriver
method
#
Ask the driver at the given path for information for this GccgoInstallation.
The given arguments are passed directly to the call of the driver.
func (inst *GccgoInstallation) InitFromDriver(gccgoPath string, args ...string) (err error)
ReadAt
method
#
func (sra seekerReadAt) ReadAt(p []byte, off int64) (int, error)
SearchPaths
method
#
Return the list of export search paths for this GccgoInstallation.
func (inst *GccgoInstallation) SearchPaths() (paths []string)
aixBigArExportData
function
#
aixBigArExportData returns export data from an AIX big archive.
func aixBigArExportData(archive io.ReadSeeker) (io.ReadSeeker, error)
arExportData
function
#
arExportData takes an archive file and returns a ReadSeeker for the
export data in that file. This assumes that there is only one
object in the archive containing export data, which is not quite
what gccgo does; gccgo concatenates together all the export data
for all the objects in the file. In practice that case does not arise.
func arExportData(archive io.ReadSeeker) (io.ReadSeeker, error)
deref
function
#
func deref(typ types.Type) types.Type
elfFromAr
function
#
elfFromAr tries to get export data from an archive member as an ELF file.
If there is no export data, this returns nil, nil.
func elfFromAr(member *io.SectionReader) (io.ReadSeeker, error)
error
method
#
func (p *parser) error(err any)
errorf
method
#
func (p *parser) errorf(format string, args ...any)
expect
method
#
func (p *parser) expect(tok rune) string
expectEOL
method
#
func (p *parser) expectEOL()
expectKeyword
method
#
func (p *parser) expectKeyword(keyword string)
findExportFile
function
#
Locate the file from which to read export data.
This is intended to replicate the logic in gofrontend.
func findExportFile(searchpaths []string, pkgpath string) (string, error)
getPkg
method
#
getPkg returns the package for a given path. If the package is
not found but we have a package name, create the package and
add it to the p.imports map.
func (p *parser) getPkg(pkgpath string, name string) *types.Package
init
method
#
func (p *parser) init(filename string, src io.Reader, imports map[string]*types.Package)
initScanner
method
#
func (p *parser) initScanner(filename string, src io.Reader)
lookupBuiltinType
function
#
func lookupBuiltinType(typ int) types.Type
maybeCreatePackage
method
#
Create the package if we have parsed both the package path and package name.
func (p *parser) maybeCreatePackage()
next
method
#
func (p *parser) next()
openExportFile
function
#
Opens the export data file at the given path. If this is an ELF file,
searches for and opens the .go_export section. If this is an archive,
reads the export data from the first member, which is assumed to be an ELF file.
This is intended to replicate the logic in gofrontend.
func openExportFile(fpath string) (reader io.ReadSeeker, closer io.Closer, err error)
parseArrayOrSliceType
method
#
ArrayOrSliceType = "[" [ int ] "]" Type .
func (p *parser) parseArrayOrSliceType(pkg *types.Package, nlist []any) types.Type
parseChanType
method
#
ChanType = "chan" ["<-" | "-<"] Type .
func (p *parser) parseChanType(pkg *types.Package, nlist []any) types.Type
parseConst
method
#
Const = Name [Type] "=" ConstValue .
func (p *parser) parseConst(pkg *types.Package) *types.Const
parseConstValue
method
#
ConstValue = string | "false" | "true" | ["-"] (int ["'"] | FloatOrComplex) | Conversion .
FloatOrComplex = float ["i" | ("+"|"-") float "i"] .
func (p *parser) parseConstValue(pkg *types.Package) (val constant.Value, typ types.Type)
parseConversion
method
#
Conversion = "convert" "(" Type "," ConstValue ")" .
func (p *parser) parseConversion(pkg *types.Package) (val constant.Value, typ types.Type)
parseDirective
method
#
Directive = InitDataDirective |
"package" unquotedString [ unquotedString ] [ unquotedString ] ";" |
"pkgpath" unquotedString ";" |
"prefix" unquotedString ";" |
"import" unquotedString unquotedString string ";" |
"indirectimport" unquotedString unquotedstring ";" |
"func" Func ";" |
"type" Type ";" |
"var" Var ";" |
"const" Const ";" .
func (p *parser) parseDirective()
parseExportedName
method
#
parseExportedName is like parseQualifiedName, but
the package path is resolved to an imported *types.Package.
ExportedName = string [string] .
func (p *parser) parseExportedName() (pkg *types.Package, name string)
parseField
method
#
Field = Name Type [string] .
func (p *parser) parseField(pkg *types.Package) (field *types.Var, tag string)
parseFunc
method
#
Func = Name FunctionType [InlineBody] .
func (p *parser) parseFunc(pkg *types.Package) *types.Func
parseFunctionType
method
#
FunctionType = ParamList ResultList .
func (p *parser) parseFunctionType(pkg *types.Package, nlist []any) *types.Signature
parseInitDataDirective
method
#
InitDataDirective = ( "v1" | "v2" | "v3" ) ";" |
"priority" int ";" |
"init" { PackageInit } ";" |
"checksum" unquotedString ";" .
func (p *parser) parseInitDataDirective()
parseInt
method
#
func (p *parser) parseInt() int
parseInt64
method
#
func (p *parser) parseInt64() int64
parseInterfaceType
method
#
InterfaceType = "interface" "{" { ("?" Type | Func) ";" } "}" .
func (p *parser) parseInterfaceType(pkg *types.Package, nlist []any) types.Type
parseMapType
method
#
MapType = "map" "[" Type "]" Type .
func (p *parser) parseMapType(pkg *types.Package, nlist []any) types.Type
parseName
method
#
Name = QualifiedName | "?" .
func (p *parser) parseName() string
parseNamedType
method
#
NamedType = TypeName [ "=" ] Type { Method } .
TypeName = ExportedName .
Method = "func" "(" Param ")" Name ParamList ResultList [InlineBody] ";" .
func (p *parser) parseNamedType(nlist []any) types.Type
parsePackage
method
#
Package = { Directive } .
func (p *parser) parsePackage() *types.Package
parsePackageInit
method
#
PackageInit = unquotedString unquotedString int .
func (p *parser) parsePackageInit() PackageInit
parseParam
method
#
Param = Name ["..."] Type .
func (p *parser) parseParam(pkg *types.Package) (param *types.Var, isVariadic bool)
parseParamList
method
#
ParamList = "(" [ { Parameter "," } Parameter ] ")" .
func (p *parser) parseParamList(pkg *types.Package) (*types.Tuple, bool)
parsePointerType
method
#
PointerType = "*" ("any" | Type) .
func (p *parser) parsePointerType(pkg *types.Package, nlist []any) types.Type
parseQualifiedName
method
#
func (p *parser) parseQualifiedName() (path string, name string)
parseQualifiedNameStr
method
#
qualifiedName = [ ["."] unquotedString "." ] unquotedString .
The above production uses greedy matching.
func (p *parser) parseQualifiedNameStr(unquotedName string) (pkgpath string, name string)
parseResultList
method
#
ResultList = Type | ParamList .
func (p *parser) parseResultList(pkg *types.Package) *types.Tuple
parseSavedType
method
#
parseSavedType parses one saved type definition.
func (p *parser) parseSavedType(pkg *types.Package, i int, nlist []any)
parseString
method
#
func (p *parser) parseString() string
parseStructType
method
#
StructType = "struct" "{" { Field } "}" .
func (p *parser) parseStructType(pkg *types.Package, nlist []any) types.Type
parseType
method
#
Type = "<" "type" ( "-" int | int [ TypeSpec ] ) ">" .
parseType updates the type map to t for all type numbers n.
func (p *parser) parseType(pkg *types.Package, n ...any) types.Type
parseTypeAfterAngle
method
#
(*parser).Type after reading the "<".
func (p *parser) parseTypeAfterAngle(pkg *types.Package, n ...any) (t types.Type, n1 int)
parseTypeExtended
method
#
parseTypeExtended is identical to parseType, but if the type in
question is a saved type, returns the index as well as the type
pointer (index returned is zero if we parsed a builtin).
func (p *parser) parseTypeExtended(pkg *types.Package, n ...any) (t types.Type, n1 int)
parseTypeSpec
method
#
TypeSpec = NamedType | MapType | ChanType | StructType | InterfaceType | PointerType | ArrayOrSliceType | FunctionType .
func (p *parser) parseTypeSpec(pkg *types.Package, nlist []any) types.Type
parseTypes
method
#
Types = "types" maxp1 exportedp1 (offset length)* .
func (p *parser) parseTypes(pkg *types.Package)
parseUnquotedQualifiedName
method
#
func (p *parser) parseUnquotedQualifiedName() (path string, name string)
parseUnquotedString
method
#
unquotedString = { unquotedStringChar } .
unquotedStringChar = .
func (p *parser) parseUnquotedString() string
parseVar
method
#
Var = Name Type .
func (p *parser) parseVar(pkg *types.Package) *types.Var
readMagic
function
#
readMagic reads the four bytes at the start of a ReadSeeker and
returns them as a string.
func readMagic(reader io.ReadSeeker) (string, error)
readerAtFromSeeker
function
#
readerAtFromSeeker turns an io.ReadSeeker into an io.ReaderAt.
This is only safe because there won't be any concurrent seeks
while this code is executing.
func readerAtFromSeeker(rs io.ReadSeeker) io.ReaderAt
reserve
method
#
reserve reserves the type map entry n for future use.
func (p *parser) reserve(n int)
skipInlineBody
method
#
InlineBody = "" .{NN}
Reports whether a body was skipped.
func (p *parser) skipInlineBody()
standardArExportData
function
#
standardArExportData returns export data from a standard archive.
func standardArExportData(archive io.ReadSeeker) (io.ReadSeeker, error)
update
method
#
update sets the type map entries for the entries in nlist to t.
An entry in nlist can be a type number in p.typeList,
used to resolve named types, or it can be a *types.Pointer,
used to resolve pointers to named types in case they are referenced
by embedded fields.
func (p *parser) update(t types.Type, nlist []any)