github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/cgo/gcc.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // gccのデバッグ出力を解析して、Prog内のRefにCタイプのアノテーションを付ける。 6 // デバッグ出力をGoのタイプに変換する。 7 8 package main 9 10 // ProcessCgoDirectives processes the import C preamble: 11 // 1. discards all #cgo CFLAGS, LDFLAGS, nocallback and noescape directives, 12 // so they don't make their way into _cgo_export.h. 13 // 2. parse the nocallback and noescape directives. 14 func (f *File) ProcessCgoDirectives() 15 16 // Translateは、インポートされたパッケージCへの参照を削除し、 17 // 対応するGoの型、関数、変数への参照に置き換えて、f.AST(元のGoの入力)を書き換えます。 18 func (p *Package) Translate(f *File) 19 20 // Stringは現在の型の表現を返します。フォーマット引数はこのメソッド内で組み立てられるため、可変な値の変更が考慮されます。 21 func (tr *TypeRepr) String() string 22 23 func (tr *TypeRepr) Empty() bool 24 25 // Setは型の表現を変更します。 26 // fargsが指定されている場合、reprはfmt.Sprintfのフォーマットとして使用されます。 27 // それ以外の場合、reprは処理されずに型の表現として使用されます。 28 func (tr *TypeRepr) Set(repr string, fargs ...interface{})