Documentation
¶
Index ¶
- Constants
- func CallFinals() error
- func ErrorWithPos(err error, where token.Position) error
- func ErrorfWithPos(where token.Position, format string, args ...any) error
- func IsNil(e Expr) bool
- func Parse(c *libs.Env, root, fname string, sconf SourceConfig) (*cc.AST, error)
- func ParseSource(env *libs.Env, c ParseConfig) (*cc.AST, error)
- func PreprocessSource(w io.Writer, env *libs.Env, c ParseConfig) error
- func PrintGo(w io.Writer, pkg string, decls []GoDecl, donotedit bool) error
- func RegisterASTHookC(fnc ASTHookCFunc)
- func RegisterFinal(fnc func() error)
- func ToFuncExpr(exp types.Type) *types.FuncType
- func Translate(root, fname, out string, env *libs.Env, conf Config) error
- type ASTHookCFunc
- type BaseBlock
- type BinaryBoolExpr
- func (e *BinaryBoolExpr) AsExpr() GoExpr
- func (e *BinaryBoolExpr) CType(types.Type) types.Type
- func (e *BinaryBoolExpr) HasSideEffects() bool
- func (e *BinaryBoolExpr) IsConst() bool
- func (e *BinaryBoolExpr) Negate() BoolExpr
- func (e *BinaryBoolExpr) Uses() []types.Usage
- func (e *BinaryBoolExpr) Visit(v Visitor)
- type BinaryOp
- type Block
- type BlockSet
- type BlockStmt
- type Bool
- type BoolAssert
- type BoolExpr
- type BoolIdent
- type BoolOp
- type BoolToInt
- type CAlignofExpr
- type CAsmExpr
- type CAssignExpr
- func (e *CAssignExpr) AsExpr() GoExpr
- func (e *CAssignExpr) CType(types.Type) types.Type
- func (e *CAssignExpr) HasSideEffects() bool
- func (e *CAssignExpr) IsConst() bool
- func (e *CAssignExpr) ToStmt(inline bool) []CStmt
- func (e *CAssignExpr) Uses() []types.Usage
- func (e *CAssignExpr) Visit(v Visitor)
- type CAssignStmt
- type CBinaryExpr
- type CBreakStmt
- type CCaseStmt
- type CCastExpr
- type CCompLitExpr
- type CCompStmt
- type CContinueStmt
- type CDecl
- type CDeclStmt
- type CExprStmt
- type CForStmt
- type CFuncDecl
- type CGotoStmt
- type CIfStmt
- type CIncrExpr
- type CIncrStmt
- type CIndexExpr
- type CLabelStmt
- type CLitKind
- type CLiteral
- type CMultiExpr
- type CParentExpr
- type CReturnStmt
- type CSelectExpr
- type CSizeofExpr
- type CStmt
- type CStmtConv
- type CStmtFunc
- type CSwitchStmt
- type CTernaryExpr
- func (e *CTernaryExpr) AsExpr() GoExpr
- func (e *CTernaryExpr) CType(types.Type) types.Type
- func (e *CTernaryExpr) HasSideEffects() bool
- func (e *CTernaryExpr) IsConst() bool
- func (e *CTernaryExpr) ToStmt(inline bool) []CStmt
- func (e *CTernaryExpr) Uses() []types.Usage
- func (e *CTernaryExpr) Visit(v Visitor)
- type CTypeDef
- type CUnaryExpr
- type CVarDecl
- type CVarSpec
- type CallExpr
- type CodeBlock
- type CompLitField
- type Comparison
- type ComparisonOp
- type CondBlock
- type Config
- type ControlFlow
- type Define
- type Deref
- type ExpandExpr
- type Expr
- type FileError
- type FloatLit
- func (l FloatLit) AsExpr() GoExpr
- func (l FloatLit) CType(exp types.Type) types.Type
- func (l FloatLit) HasSideEffects() bool
- func (l FloatLit) IsConst() bool
- func (l FloatLit) IsNegative() bool
- func (l FloatLit) IsOne() bool
- func (l FloatLit) IsZero() bool
- func (l FloatLit) Negate() Number
- func (l FloatLit) Uses() []types.Usage
- func (FloatLit) Visit(v Visitor)
- type FuncAssert
- func (e FuncAssert) AsExpr() GoExpr
- func (e FuncAssert) CType(types.Type) types.Type
- func (e FuncAssert) FuncType(*types.FuncType) *types.FuncType
- func (e FuncAssert) HasSideEffects() bool
- func (e FuncAssert) IsConst() bool
- func (e FuncAssert) Uses() []types.Usage
- func (e FuncAssert) Visit(v Visitor)
- type FuncComparison
- func (e *FuncComparison) AsExpr() GoExpr
- func (e *FuncComparison) CType(types.Type) types.Type
- func (e *FuncComparison) HasSideEffects() bool
- func (e *FuncComparison) IsConst() bool
- func (e *FuncComparison) Negate() BoolExpr
- func (e *FuncComparison) Uses() []types.Usage
- func (e *FuncComparison) Visit(v Visitor)
- type FuncExpr
- type FuncIdent
- type FuncLit
- type FuncToInt
- type FuncToPtr
- type GoDecl
- type GoExpr
- type GoField
- type GoStmt
- type GoType
- type Ident
- type IdentConfig
- type IdentExpr
- type IfElseStmt
- type IntLit
- func (l IntLit) AsExpr() GoExpr
- func (l IntLit) CType(exp types.Type) types.Type
- func (IntLit) HasSideEffects() bool
- func (l IntLit) Int() int64
- func (IntLit) IsConst() bool
- func (l IntLit) IsNeg() bool
- func (l IntLit) IsNegative() bool
- func (l IntLit) IsOne() bool
- func (l IntLit) IsUint() bool
- func (l IntLit) IsZero() bool
- func (l IntLit) MulLit(v int64) IntLit
- func (l IntLit) Negate() Number
- func (l IntLit) NegateLit() IntLit
- func (l IntLit) OverflowInt(sz int) IntLit
- func (l IntLit) OverflowUint(sz int) IntLit
- func (l IntLit) String() string
- func (l IntLit) Uint() uint64
- func (l IntLit) Uses() []types.Usage
- func (IntLit) Visit(v Visitor)
- type IntToFunc
- func (e *IntToFunc) AsExpr() GoExpr
- func (e *IntToFunc) CType(types.Type) types.Type
- func (e *IntToFunc) FuncType(*types.FuncType) *types.FuncType
- func (e *IntToFunc) HasSideEffects() bool
- func (e *IntToFunc) IsConst() bool
- func (e *IntToFunc) Uses() []types.Usage
- func (e *IntToFunc) Visit(v Visitor)
- type IntToPtr
- type MakeExpr
- type NewExpr
- type Nil
- func (Nil) AsExpr() GoExpr
- func (e Nil) CType(exp types.Type) types.Type
- func (e Nil) FuncType(exp *types.FuncType) *types.FuncType
- func (Nil) HasSideEffects() bool
- func (Nil) IsConst() bool
- func (e Nil) PtrType(exp types.PtrType) types.PtrType
- func (e Nil) Uses() []types.Usage
- func (Nil) Visit(v Visitor)
- type Node
- type Not
- type Number
- type ParseConfig
- type PtrAssert
- type PtrComparison
- func (e *PtrComparison) AsExpr() GoExpr
- func (e *PtrComparison) CType(types.Type) types.Type
- func (e *PtrComparison) HasSideEffects() bool
- func (e *PtrComparison) IsConst() bool
- func (e *PtrComparison) Negate() BoolExpr
- func (e *PtrComparison) Uses() []types.Usage
- func (e *PtrComparison) Visit(v Visitor)
- type PtrDiff
- type PtrElemOffset
- func (e *PtrElemOffset) AsExpr() GoExpr
- func (e *PtrElemOffset) CType(exp types.Type) types.Type
- func (e *PtrElemOffset) HasSideEffects() bool
- func (e *PtrElemOffset) IsConst() bool
- func (e *PtrElemOffset) PtrType(exp types.PtrType) types.PtrType
- func (e *PtrElemOffset) Uses() []types.Usage
- func (e *PtrElemOffset) Visit(v Visitor)
- type PtrExpr
- type PtrIdent
- type PtrOffset
- func (e *PtrOffset) AsExpr() GoExpr
- func (e *PtrOffset) CType(exp types.Type) types.Type
- func (e *PtrOffset) HasSideEffects() bool
- func (e *PtrOffset) IsConst() bool
- func (e *PtrOffset) PtrType(exp types.PtrType) types.PtrType
- func (e *PtrOffset) Uses() []types.Usage
- func (e *PtrOffset) Visit(v Visitor)
- type PtrToFunc
- func (e *PtrToFunc) AsExpr() GoExpr
- func (e *PtrToFunc) CType(types.Type) types.Type
- func (e *PtrToFunc) FuncType(*types.FuncType) *types.FuncType
- func (e *PtrToFunc) HasSideEffects() bool
- func (e *PtrToFunc) IsConst() bool
- func (e *PtrToFunc) Uses() []types.Usage
- func (e *PtrToFunc) Visit(v Visitor)
- type PtrToInt
- type PtrToPtr
- type PtrVarOffset
- func (e *PtrVarOffset) AsExpr() GoExpr
- func (e *PtrVarOffset) CType(exp types.Type) types.Type
- func (e *PtrVarOffset) HasSideEffects() bool
- func (e *PtrVarOffset) IsConst() bool
- func (e *PtrVarOffset) PtrType(exp types.PtrType) types.PtrType
- func (e *PtrVarOffset) Uses() []types.Usage
- func (e *PtrVarOffset) Visit(v Visitor)
- type Range
- type Replacer
- type ReturnBlock
- type SliceExpr
- type SourceConfig
- type SrcFunc
- type StringLit
- func (l StringLit) AsExpr() GoExpr
- func (l StringLit) CType(types.Type) types.Type
- func (l StringLit) HasSideEffects() bool
- func (l StringLit) IsConst() bool
- func (l StringLit) IsWide() bool
- func (l StringLit) String() string
- func (l StringLit) Uses() []types.Usage
- func (l StringLit) Value() string
- func (StringLit) Visit(v Visitor)
- type StringToPtr
- func (e *StringToPtr) AsExpr() GoExpr
- func (e *StringToPtr) CType(exp types.Type) types.Type
- func (e *StringToPtr) HasSideEffects() bool
- func (e *StringToPtr) IsConst() bool
- func (e *StringToPtr) PtrType(types.PtrType) types.PtrType
- func (e *StringToPtr) Uses() []types.Usage
- func (e *StringToPtr) Visit(v Visitor)
- type SwitchBlock
- type TakeAddr
- type TypeAssert
- type TypeHint
- type UnaryOp
- type UnusedVar
- type Visitor
Constants ¶
const ( CLitChar = CLitKind(iota) CLitWChar )
const ( HintBool = TypeHint("bool") // force the type to Go bool HintSlice = TypeHint("slice") // force type to Go slice (for pointers and arrays) HintIface = TypeHint("iface") // force type to Go interface{} HintString = TypeHint("string") // force type to Go string )
Variables ¶
This section is empty.
Functions ¶
func CallFinals ¶
func CallFinals() error
func ErrorfWithPos ¶ added in v0.3.7
func ParseSource ¶
func ParseSource(env *libs.Env, c ParseConfig) (*cc.AST, error)
func PreprocessSource ¶ added in v0.5.0
func RegisterASTHookC ¶
func RegisterASTHookC(fnc ASTHookCFunc)
func RegisterFinal ¶
func RegisterFinal(fnc func() error)
Types ¶
type BaseBlock ¶
type BaseBlock struct {
// contains filtered or unexported fields
}
func (*BaseBlock) AddPrevBlock ¶
func (*BaseBlock) PrevBlocks ¶
type BinaryBoolExpr ¶
func (*BinaryBoolExpr) AsExpr ¶
func (e *BinaryBoolExpr) AsExpr() GoExpr
func (*BinaryBoolExpr) HasSideEffects ¶
func (e *BinaryBoolExpr) HasSideEffects() bool
func (*BinaryBoolExpr) IsConst ¶
func (e *BinaryBoolExpr) IsConst() bool
func (*BinaryBoolExpr) Negate ¶
func (e *BinaryBoolExpr) Negate() BoolExpr
func (*BinaryBoolExpr) Uses ¶
func (e *BinaryBoolExpr) Uses() []types.Usage
func (*BinaryBoolExpr) Visit ¶
func (e *BinaryBoolExpr) Visit(v Visitor)
type BinaryOp ¶
type BinaryOp string
func (BinaryOp) GoAssignToken ¶
func (BinaryOp) IsCommutative ¶
func (BinaryOp) Precedence ¶
type BlockStmt ¶
type BlockStmt struct { Stmts []CStmt // contains filtered or unexported fields }
func (*BlockStmt) GoBlockStmt ¶
type BoolAssert ¶
type BoolAssert struct {
X Expr
}
func (BoolAssert) AsExpr ¶
func (e BoolAssert) AsExpr() GoExpr
func (BoolAssert) HasSideEffects ¶
func (e BoolAssert) HasSideEffects() bool
func (BoolAssert) IsConst ¶
func (e BoolAssert) IsConst() bool
func (BoolAssert) Negate ¶
func (e BoolAssert) Negate() BoolExpr
func (BoolAssert) Uses ¶
func (e BoolAssert) Uses() []types.Usage
func (BoolAssert) Visit ¶
func (e BoolAssert) Visit(v Visitor)
type BoolExpr ¶
type BoolExpr interface { Expr // Negate a bool expression. Alternative of !x, but for any expression. // It may invert the comparison operator or just return !x. Negate() BoolExpr }
BoolExpr is a expression that returns a bool value.
func CompareFuncs ¶
func CompareFuncs(x FuncExpr, op ComparisonOp, y FuncExpr) BoolExpr
func ComparePtrs ¶
func ComparePtrs(x PtrExpr, op ComparisonOp, y PtrExpr) BoolExpr
type CAlignofExpr ¶
func (*CAlignofExpr) AsExpr ¶
func (e *CAlignofExpr) AsExpr() GoExpr
func (*CAlignofExpr) HasSideEffects ¶
func (e *CAlignofExpr) HasSideEffects() bool
func (*CAlignofExpr) IsConst ¶
func (e *CAlignofExpr) IsConst() bool
func (*CAlignofExpr) Uses ¶
func (e *CAlignofExpr) Uses() []types.Usage
func (*CAlignofExpr) Visit ¶
func (e *CAlignofExpr) Visit(v Visitor)
type CAsmExpr ¶
type CAsmExpr struct {
// contains filtered or unexported fields
}
func (*CAsmExpr) HasSideEffects ¶
type CAssignExpr ¶
type CAssignExpr struct {
Stmt *CAssignStmt
}
func (*CAssignExpr) AsExpr ¶
func (e *CAssignExpr) AsExpr() GoExpr
func (*CAssignExpr) HasSideEffects ¶
func (e *CAssignExpr) HasSideEffects() bool
func (*CAssignExpr) IsConst ¶
func (e *CAssignExpr) IsConst() bool
func (*CAssignExpr) ToStmt ¶
func (e *CAssignExpr) ToStmt(inline bool) []CStmt
func (*CAssignExpr) Uses ¶
func (e *CAssignExpr) Uses() []types.Usage
func (*CAssignExpr) Visit ¶
func (e *CAssignExpr) Visit(v Visitor)
type CAssignStmt ¶
type CAssignStmt struct { Left Expr Op BinaryOp Right Expr // contains filtered or unexported fields }
func (*CAssignStmt) AsStmt ¶
func (s *CAssignStmt) AsStmt() []GoStmt
func (*CAssignStmt) Uses ¶
func (s *CAssignStmt) Uses() []types.Usage
func (*CAssignStmt) Visit ¶
func (s *CAssignStmt) Visit(v Visitor)
type CBinaryExpr ¶
func (*CBinaryExpr) AsExpr ¶
func (e *CBinaryExpr) AsExpr() GoExpr
func (*CBinaryExpr) HasSideEffects ¶
func (e *CBinaryExpr) HasSideEffects() bool
func (*CBinaryExpr) IsConst ¶
func (e *CBinaryExpr) IsConst() bool
func (*CBinaryExpr) Uses ¶
func (e *CBinaryExpr) Uses() []types.Usage
func (*CBinaryExpr) Visit ¶
func (e *CBinaryExpr) Visit(v Visitor)
type CBreakStmt ¶
type CBreakStmt struct{}
func (*CBreakStmt) AsStmt ¶
func (s *CBreakStmt) AsStmt() []GoStmt
func (*CBreakStmt) Uses ¶
func (s *CBreakStmt) Uses() []types.Usage
func (*CBreakStmt) Visit ¶
func (s *CBreakStmt) Visit(v Visitor)
type CCaseStmt ¶
func (*CCaseStmt) GoCaseClause ¶
func (s *CCaseStmt) GoCaseClause() *ast.CaseClause
type CCastExpr ¶
func (*CCastExpr) HasSideEffects ¶
type CCompLitExpr ¶
type CCompLitExpr struct { Type types.Type Fields []*CompLitField }
func (*CCompLitExpr) AsExpr ¶
func (e *CCompLitExpr) AsExpr() GoExpr
func (*CCompLitExpr) HasSideEffects ¶
func (e *CCompLitExpr) HasSideEffects() bool
func (*CCompLitExpr) IsConst ¶
func (e *CCompLitExpr) IsConst() bool
func (*CCompLitExpr) Uses ¶
func (e *CCompLitExpr) Uses() []types.Usage
func (*CCompLitExpr) Visit ¶
func (e *CCompLitExpr) Visit(v Visitor)
type CContinueStmt ¶
type CContinueStmt struct{}
func (*CContinueStmt) AsStmt ¶
func (s *CContinueStmt) AsStmt() []GoStmt
func (*CContinueStmt) Uses ¶
func (s *CContinueStmt) Uses() []types.Usage
func (*CContinueStmt) Visit ¶
func (s *CContinueStmt) Visit(v Visitor)
type CIfStmt ¶
type CIfStmt struct { Cond BoolExpr Then *BlockStmt Else IfElseStmt // contains filtered or unexported fields }
type CIncrExpr ¶
func (*CIncrExpr) HasSideEffects ¶
type CIndexExpr ¶
func (*CIndexExpr) AsExpr ¶
func (e *CIndexExpr) AsExpr() GoExpr
func (*CIndexExpr) HasSideEffects ¶
func (e *CIndexExpr) HasSideEffects() bool
func (*CIndexExpr) IndexZero ¶
func (e *CIndexExpr) IndexZero() bool
func (*CIndexExpr) IsConst ¶
func (e *CIndexExpr) IsConst() bool
func (*CIndexExpr) Uses ¶
func (e *CIndexExpr) Uses() []types.Usage
func (*CIndexExpr) Visit ¶
func (e *CIndexExpr) Visit(v Visitor)
type CLabelStmt ¶
type CLabelStmt struct {
Label string
}
func (*CLabelStmt) AsStmt ¶
func (s *CLabelStmt) AsStmt() []GoStmt
func (*CLabelStmt) Uses ¶
func (s *CLabelStmt) Uses() []types.Usage
func (*CLabelStmt) Visit ¶
func (s *CLabelStmt) Visit(v Visitor)
type CLiteral ¶
func (*CLiteral) HasSideEffects ¶
type CMultiExpr ¶
type CMultiExpr struct { Exprs []Expr // contains filtered or unexported fields }
CMultiExpr is a list of C expressions executed one by one, and returning the result of the last one.
func (*CMultiExpr) AsExpr ¶
func (e *CMultiExpr) AsExpr() GoExpr
func (*CMultiExpr) HasSideEffects ¶
func (e *CMultiExpr) HasSideEffects() bool
func (*CMultiExpr) IsConst ¶
func (e *CMultiExpr) IsConst() bool
func (*CMultiExpr) Uses ¶
func (e *CMultiExpr) Uses() []types.Usage
func (*CMultiExpr) Visit ¶
func (e *CMultiExpr) Visit(v Visitor)
type CParentExpr ¶
type CParentExpr struct {
Expr Expr
}
func (*CParentExpr) AsExpr ¶
func (e *CParentExpr) AsExpr() GoExpr
func (*CParentExpr) HasSideEffects ¶
func (e *CParentExpr) HasSideEffects() bool
func (*CParentExpr) IsConst ¶
func (e *CParentExpr) IsConst() bool
func (*CParentExpr) Uses ¶
func (e *CParentExpr) Uses() []types.Usage
func (*CParentExpr) Visit ¶
func (e *CParentExpr) Visit(v Visitor)
type CReturnStmt ¶
type CReturnStmt struct {
Expr Expr
}
func (*CReturnStmt) AsStmt ¶
func (s *CReturnStmt) AsStmt() []GoStmt
func (*CReturnStmt) Uses ¶
func (s *CReturnStmt) Uses() []types.Usage
func (*CReturnStmt) Visit ¶
func (s *CReturnStmt) Visit(v Visitor)
type CSelectExpr ¶
func (*CSelectExpr) AsExpr ¶
func (e *CSelectExpr) AsExpr() GoExpr
func (*CSelectExpr) HasSideEffects ¶
func (e *CSelectExpr) HasSideEffects() bool
func (*CSelectExpr) IsConst ¶
func (e *CSelectExpr) IsConst() bool
func (*CSelectExpr) Uses ¶
func (e *CSelectExpr) Uses() []types.Usage
func (*CSelectExpr) Visit ¶
func (e *CSelectExpr) Visit(v Visitor)
type CSizeofExpr ¶
func (*CSizeofExpr) AsExpr ¶
func (e *CSizeofExpr) AsExpr() GoExpr
func (*CSizeofExpr) HasSideEffects ¶
func (e *CSizeofExpr) HasSideEffects() bool
func (*CSizeofExpr) IsConst ¶
func (e *CSizeofExpr) IsConst() bool
func (*CSizeofExpr) Uses ¶
func (e *CSizeofExpr) Uses() []types.Usage
func (*CSizeofExpr) Visit ¶
func (e *CSizeofExpr) Visit(v Visitor)
type CSwitchStmt ¶
func (*CSwitchStmt) AsStmt ¶
func (s *CSwitchStmt) AsStmt() []GoStmt
func (*CSwitchStmt) EachStmt ¶
func (s *CSwitchStmt) EachStmt(fnc CStmtFunc) bool
func (*CSwitchStmt) Uses ¶
func (s *CSwitchStmt) Uses() []types.Usage
func (*CSwitchStmt) Visit ¶
func (s *CSwitchStmt) Visit(v Visitor)
type CTernaryExpr ¶
type CTernaryExpr struct { Cond BoolExpr Then Expr Else Expr // contains filtered or unexported fields }
func (*CTernaryExpr) AsExpr ¶
func (e *CTernaryExpr) AsExpr() GoExpr
func (*CTernaryExpr) HasSideEffects ¶
func (e *CTernaryExpr) HasSideEffects() bool
func (*CTernaryExpr) IsConst ¶
func (e *CTernaryExpr) IsConst() bool
func (*CTernaryExpr) ToStmt ¶
func (e *CTernaryExpr) ToStmt(inline bool) []CStmt
func (*CTernaryExpr) Uses ¶
func (e *CTernaryExpr) Uses() []types.Usage
func (*CTernaryExpr) Visit ¶
func (e *CTernaryExpr) Visit(v Visitor)
type CUnaryExpr ¶
func (*CUnaryExpr) AsExpr ¶
func (e *CUnaryExpr) AsExpr() GoExpr
func (*CUnaryExpr) HasSideEffects ¶
func (e *CUnaryExpr) HasSideEffects() bool
func (*CUnaryExpr) IsConst ¶
func (e *CUnaryExpr) IsConst() bool
func (*CUnaryExpr) Uses ¶
func (e *CUnaryExpr) Uses() []types.Usage
func (*CUnaryExpr) Visit ¶
func (e *CUnaryExpr) Visit(v Visitor)
type CVarSpec ¶
type CallExpr ¶
func (*CallExpr) HasSideEffects ¶
type CompLitField ¶
func (*CompLitField) Visit ¶
func (e *CompLitField) Visit(v Visitor)
type Comparison ¶
type Comparison struct { X Expr Op ComparisonOp Y Expr // contains filtered or unexported fields }
func (*Comparison) AsExpr ¶
func (e *Comparison) AsExpr() GoExpr
func (*Comparison) HasSideEffects ¶
func (e *Comparison) HasSideEffects() bool
func (*Comparison) IsConst ¶
func (e *Comparison) IsConst() bool
func (*Comparison) Negate ¶
func (e *Comparison) Negate() BoolExpr
func (*Comparison) Uses ¶
func (e *Comparison) Uses() []types.Usage
func (*Comparison) Visit ¶
func (e *Comparison) Visit(v Visitor)
type ComparisonOp ¶
type ComparisonOp string
ComparisonOp is a comparison operator.
const ( BinOpEq ComparisonOp = "==" BinOpNeq ComparisonOp = "!=" BinOpLt ComparisonOp = "<" BinOpGt ComparisonOp = ">" BinOpLte ComparisonOp = "<=" BinOpGte ComparisonOp = ">=" )
func (ComparisonOp) GoToken ¶
func (op ComparisonOp) GoToken() token.Token
func (ComparisonOp) IsEquality ¶
func (op ComparisonOp) IsEquality() bool
func (ComparisonOp) IsRelational ¶
func (op ComparisonOp) IsRelational() bool
func (ComparisonOp) Negate ¶
func (op ComparisonOp) Negate() ComparisonOp
type Config ¶
type Config struct { Root string Package string GoFile string GoFilePref string Include []string SysInclude []string IncludeMap map[string]string MaxDecls int Predef string Define []Define FlattenAll bool ForwardDecl bool SkipDecl map[string]bool Idents []IdentConfig Replace []Replacer Hooks bool FixImplicitReturns bool IgnoreIncludeDir bool UnexportedFields bool // do not export struct fields for Go IntReformat bool // automatically select new base for formatting int literals KeepFree bool // do not rewrite free() calls to nil assignments DoNotEdit bool // generate DO NOT EDIT header comments }
type ControlFlow ¶
type ControlFlow struct { Start Block // contains filtered or unexported fields }
func (*ControlFlow) Dom ¶
func (cf *ControlFlow) Dom(a, b Block) bool
func (*ControlFlow) Flatten ¶
func (cf *ControlFlow) Flatten() []CStmt
func (*ControlFlow) IDom ¶
func (cf *ControlFlow) IDom(a Block) Block
func (*ControlFlow) SDom ¶
func (cf *ControlFlow) SDom(a, b Block) bool
type Deref ¶
type Deref struct { X PtrExpr // contains filtered or unexported fields }
func (*Deref) HasSideEffects ¶
type ExpandExpr ¶
type ExpandExpr struct {
X Expr
}
func (*ExpandExpr) AsExpr ¶
func (e *ExpandExpr) AsExpr() GoExpr
func (*ExpandExpr) HasSideEffects ¶
func (e *ExpandExpr) HasSideEffects() bool
func (*ExpandExpr) IsConst ¶
func (e *ExpandExpr) IsConst() bool
func (*ExpandExpr) Uses ¶
func (e *ExpandExpr) Uses() []types.Usage
func (*ExpandExpr) Visit ¶
func (e *ExpandExpr) Visit(v Visitor)
type Expr ¶
type FloatLit ¶
type FloatLit struct {
// contains filtered or unexported fields
}
func (FloatLit) HasSideEffects ¶
func (FloatLit) IsNegative ¶ added in v0.3.7
type FuncAssert ¶
type FuncAssert struct {
X Expr
}
func (FuncAssert) AsExpr ¶
func (e FuncAssert) AsExpr() GoExpr
func (FuncAssert) HasSideEffects ¶
func (e FuncAssert) HasSideEffects() bool
func (FuncAssert) IsConst ¶
func (e FuncAssert) IsConst() bool
func (FuncAssert) Uses ¶
func (e FuncAssert) Uses() []types.Usage
func (FuncAssert) Visit ¶
func (e FuncAssert) Visit(v Visitor)
type FuncComparison ¶
type FuncComparison struct { X FuncExpr Op ComparisonOp Y FuncExpr }
func (*FuncComparison) AsExpr ¶
func (e *FuncComparison) AsExpr() GoExpr
func (*FuncComparison) HasSideEffects ¶
func (e *FuncComparison) HasSideEffects() bool
func (*FuncComparison) IsConst ¶
func (e *FuncComparison) IsConst() bool
func (*FuncComparison) Negate ¶
func (e *FuncComparison) Negate() BoolExpr
func (*FuncComparison) Uses ¶
func (e *FuncComparison) Uses() []types.Usage
func (*FuncComparison) Visit ¶
func (e *FuncComparison) Visit(v Visitor)
type FuncExpr ¶
type FuncExpr interface { Expr // FuncType return an underlying function type. FuncType(exp *types.FuncType) *types.FuncType }
FuncExpr is an expression that returns a function value.
type FuncLit ¶
func (*FuncLit) HasSideEffects ¶
type FuncToInt ¶
func (*FuncToInt) HasSideEffects ¶
type FuncToPtr ¶
type FuncToPtr struct { X FuncExpr // contains filtered or unexported fields }
func (*FuncToPtr) HasSideEffects ¶
type GoDecl ¶
func ImportsFor ¶ added in v0.3.6
ImportsFor generates import specs for well-known imports required for given declarations.
type IdentConfig ¶
type IdentConfig struct { Name string `yaml:"name" json:"name"` // identifier name in C Index int `yaml:"index" json:"index"` // argument index, only for Fields in the function decl Rename string `yaml:"rename" json:"rename"` // rename the identifier Alias bool `yaml:"alias" json:"alias"` // omit declaration, use underlying type instead Type TypeHint `yaml:"type" json:"type"` // changes the Go type of this identifier Flatten *bool `yaml:"flatten" json:"flatten"` // flattens function control flow to workaround invalid gotos Fields []IdentConfig `yaml:"fields" json:"fields"` // configs for struct fields or func arguments }
type IfElseStmt ¶
type IfElseStmt interface { CStmt // contains filtered or unexported methods }
type IntLit ¶
type IntLit struct {
// contains filtered or unexported fields
}
func (IntLit) HasSideEffects ¶
func (IntLit) IsNegative ¶ added in v0.3.7
func (IntLit) OverflowInt ¶
func (IntLit) OverflowUint ¶
type IntToFunc ¶
func (*IntToFunc) HasSideEffects ¶
type IntToPtr ¶
func (*IntToPtr) HasSideEffects ¶
type MakeExpr ¶
type MakeExpr struct { Elem types.Type Size Expr Cap Expr // contains filtered or unexported fields }
func (*MakeExpr) HasSideEffects ¶
type NewExpr ¶
func (*NewExpr) HasSideEffects ¶
type Nil ¶
type Nil struct {
// contains filtered or unexported fields
}
func (Nil) HasSideEffects ¶
type Node ¶
type Node interface { // Visit calls the provided interface for all child nodes. // It's the visitor's responsibility to recurse by calling n.Visit(v). Visit(v Visitor) }
type Not ¶
type Not struct {
X BoolExpr
}
Not negates a bool expression. It's only useful for identifiers and function calls.
func (*Not) HasSideEffects ¶
type ParseConfig ¶
type PtrComparison ¶
type PtrComparison struct { X PtrExpr Op ComparisonOp Y PtrExpr }
func (*PtrComparison) AsExpr ¶
func (e *PtrComparison) AsExpr() GoExpr
func (*PtrComparison) HasSideEffects ¶
func (e *PtrComparison) HasSideEffects() bool
func (*PtrComparison) IsConst ¶
func (e *PtrComparison) IsConst() bool
func (*PtrComparison) Negate ¶
func (e *PtrComparison) Negate() BoolExpr
func (*PtrComparison) Uses ¶
func (e *PtrComparison) Uses() []types.Usage
func (*PtrComparison) Visit ¶
func (e *PtrComparison) Visit(v Visitor)
type PtrDiff ¶
func (*PtrDiff) HasSideEffects ¶
type PtrElemOffset ¶
PtrElemOffset acts like a pointer arithmetic with a variable value. The index is always multiplied only by the pointer elements size, as opposed to PtrVarOffset. This operation is preferable over PtrVarOffset because the size of C and Go structs may not match.
func (*PtrElemOffset) AsExpr ¶
func (e *PtrElemOffset) AsExpr() GoExpr
func (*PtrElemOffset) HasSideEffects ¶
func (e *PtrElemOffset) HasSideEffects() bool
func (*PtrElemOffset) IsConst ¶
func (e *PtrElemOffset) IsConst() bool
func (*PtrElemOffset) Uses ¶
func (e *PtrElemOffset) Uses() []types.Usage
func (*PtrElemOffset) Visit ¶
func (e *PtrElemOffset) Visit(v Visitor)
type PtrExpr ¶
type PtrExpr interface { Expr // PtrType return an underlying pointer type. PtrType(exp types.PtrType) types.PtrType }
PtrExpr is an expression that returns a pointer value.
type PtrOffset ¶
PtrOffset acts like a pointer arithmetic with a constant value. The index is NOT multiplied by the pointer element size. It optionally converts the pointer to Conv type.
func (*PtrOffset) HasSideEffects ¶
type PtrToFunc ¶
func (*PtrToFunc) HasSideEffects ¶
type PtrToInt ¶
func (*PtrToInt) HasSideEffects ¶
type PtrToPtr ¶
func (*PtrToPtr) HasSideEffects ¶
type PtrVarOffset ¶
PtrVarOffset acts like a pointer arithmetic with a variable value. The index is multiplied only by a Mul, but not the pointer element size. It optionally converts the pointer to Conv type.
func (*PtrVarOffset) AsExpr ¶
func (e *PtrVarOffset) AsExpr() GoExpr
func (*PtrVarOffset) HasSideEffects ¶
func (e *PtrVarOffset) HasSideEffects() bool
func (*PtrVarOffset) IsConst ¶
func (e *PtrVarOffset) IsConst() bool
func (*PtrVarOffset) Uses ¶
func (e *PtrVarOffset) Uses() []types.Usage
func (*PtrVarOffset) Visit ¶
func (e *PtrVarOffset) Visit(v Visitor)
type ReturnBlock ¶
type ReturnBlock struct { BaseBlock *CReturnStmt }
func (*ReturnBlock) NextBlocks ¶
func (b *ReturnBlock) NextBlocks() []Block
func (*ReturnBlock) ReplaceNext ¶
func (b *ReturnBlock) ReplaceNext(old, rep Block)
type SliceExpr ¶
func (*SliceExpr) HasSideEffects ¶
type SourceConfig ¶
type SrcFunc ¶
type StringLit ¶
type StringLit struct {
// contains filtered or unexported fields
}
func (StringLit) HasSideEffects ¶
type StringToPtr ¶
type StringToPtr struct { X StringLit // contains filtered or unexported fields }
func (*StringToPtr) AsExpr ¶
func (e *StringToPtr) AsExpr() GoExpr
func (*StringToPtr) HasSideEffects ¶
func (e *StringToPtr) HasSideEffects() bool
func (*StringToPtr) IsConst ¶
func (e *StringToPtr) IsConst() bool
func (*StringToPtr) Uses ¶
func (e *StringToPtr) Uses() []types.Usage
func (*StringToPtr) Visit ¶
func (e *StringToPtr) Visit(v Visitor)
type SwitchBlock ¶
func (*SwitchBlock) NextBlocks ¶
func (b *SwitchBlock) NextBlocks() []Block
func (*SwitchBlock) ReplaceNext ¶
func (b *SwitchBlock) ReplaceNext(old, rep Block)
type TakeAddr ¶
type TakeAddr struct { X Expr // contains filtered or unexported fields }
func (*TakeAddr) HasSideEffects ¶
type TypeAssert ¶
func (*TypeAssert) AsExpr ¶
func (e *TypeAssert) AsExpr() GoExpr
func (*TypeAssert) HasSideEffects ¶
func (e *TypeAssert) HasSideEffects() bool
func (*TypeAssert) IsConst ¶
func (e *TypeAssert) IsConst() bool