Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func Do(config *ConverterConfig) (*ast.File, error)
 - func IsExplicitSigned(t clang.Type) bool
 - func IsExplicitUnsigned(t clang.Type) bool
 - func PostOrderVisitChildren(cursor clang.Cursor, collect func(c, p clang.Cursor) bool) []clang.Cursor
 - func SetDebug(dbgFlags dbgFlags)
 - func XMarshalASTDecl(decl ast.Decl) map[string]any
 - func XMarshalASTExpr(t ast.Expr) map[string]any
 - func XMarshalASTFile(file *ast.File) map[string]any
 - func XMarshalDeclList(list []ast.Decl) []map[string]any
 - func XMarshalFieldList(list []*ast.Field) []map[string]any
 - func XMarshalIdentList(list []*ast.Ident) []map[string]any
 - func XMarshalIncludeList(list []*ast.Include) []map[string]any
 - func XMarshalLocation(loc *ast.Location) map[string]any
 - func XMarshalMacroList(list []*ast.Macro) []map[string]any
 - func XMarshalObject(decl ast.Object, root map[string]any)
 - func XMarshalToken(tok *ast.Token) map[string]any
 - func XMarshalTokenList(list []*ast.Token) []map[string]any
 - type Converter
 - func (ct *Converter) BuildScopingExpr(cursor clang.Cursor) ast.Expr
 - func (ct *Converter) Convert() (*ast.File, error)
 - func (ct *Converter) CreateObject(cursor clang.Cursor, name *ast.Ident) ast.Object
 - func (ct *Converter) Dispose()
 - func (ct *Converter) GetTokens(cursor clang.Cursor) []*ast.Token
 - func (ct *Converter) InFile(cursor clang.Cursor) bool
 - func (ct *Converter) ParseComment(rawComment string) *ast.CommentGroup
 - func (ct *Converter) ParseCommentGroup(cursor clang.Cursor) (comentGroup *ast.CommentGroup, isDoc bool)
 - func (ct *Converter) ProcessBuiltinType(t clang.Type) *ast.BuiltinType
 - func (ct *Converter) ProcessClassDecl(cursor clang.Cursor) *ast.TypeDecl
 - func (ct *Converter) ProcessElaboratedType(t clang.Type) ast.Expr
 - func (ct *Converter) ProcessEnumDecl(cursor clang.Cursor) *ast.EnumTypeDecl
 - func (ct *Converter) ProcessEnumType(cursor clang.Cursor) *ast.EnumType
 - func (ct *Converter) ProcessFieldList(cursor clang.Cursor) *ast.FieldList
 - func (ct *Converter) ProcessFuncDecl(cursor clang.Cursor) *ast.FuncDecl
 - func (ct *Converter) ProcessFunctionType(t clang.Type) *ast.FuncType
 - func (ct *Converter) ProcessInclude(cursor clang.Cursor) (*ast.Include, error)
 - func (ct *Converter) ProcessMacro(cursor clang.Cursor) *ast.Macro
 - func (ct *Converter) ProcessMethodAttributes(cursor clang.Cursor, fn *ast.FuncDecl)
 - func (ct *Converter) ProcessMethods(cursor clang.Cursor) []*ast.FuncDecl
 - func (ct *Converter) ProcessRecordDecl(cursor clang.Cursor) []ast.Decl
 - func (ct *Converter) ProcessRecordType(cursor clang.Cursor) *ast.RecordType
 - func (ct *Converter) ProcessStructDecl(cursor clang.Cursor) []ast.Decl
 - func (ct *Converter) ProcessType(t clang.Type) ast.Expr
 - func (ct *Converter) ProcessTypeDefDecl(cursor clang.Cursor) *ast.TypedefDecl
 - func (ct *Converter) ProcessTypeDefType(t clang.Type) ast.Expr
 - func (ct *Converter) ProcessUnderlyingType(cursor clang.Cursor) ast.Expr
 - func (ct *Converter) ProcessUnionDecl(cursor clang.Cursor) []ast.Decl
 
- type ConverterConfig
 
Constants ¶
const ( DbgParse dbgFlags = 1 << iota DbgFlagAll = DbgParse )
Variables ¶
This section is empty.
Functions ¶
func IsExplicitSigned ¶
func IsExplicitUnsigned ¶
func PostOrderVisitChildren ¶ added in v0.7.3
func XMarshalIncludeList ¶ added in v0.5.1
Types ¶
type Converter ¶
type Converter struct {
	// contains filtered or unexported fields
}
    func NewConverter ¶
func NewConverter(config *ConverterConfig) (*Converter, error)
func (*Converter) BuildScopingExpr ¶
Constructs a complete scoping expression by traversing the semantic parents, starting from the given clang.Cursor For anonymous decl of typedef references, use their anonymous name
func (*Converter) CreateObject ¶
func (*Converter) ParseComment ¶
func (ct *Converter) ParseComment(rawComment string) *ast.CommentGroup
func (*Converter) ParseCommentGroup ¶
func (ct *Converter) ParseCommentGroup(cursor clang.Cursor) (comentGroup *ast.CommentGroup, isDoc bool)
extracts and parses comments associated with a given Clang cursor, distinguishing between documentation comments and line comments.
The function determines whether a comment is a documentation comment or a line comment by comparing the range of the comment node with the range of the declaration node in the AST.
Note: In cases where both documentation comments and line comments conceptually exist, only the line comment will be preserved.
func (*Converter) ProcessBuiltinType ¶
func (ct *Converter) ProcessBuiltinType(t clang.Type) *ast.BuiltinType
func (*Converter) ProcessClassDecl ¶
func (*Converter) ProcessElaboratedType ¶
process ElaboratedType Reference
1. Named elaborated type references: - Examples: struct MyStruct, union MyUnion, class MyClass, enum MyEnum - Handling: Constructed as TagExpr or ScopingExpr references
2. Anonymous elaborated type references: - Examples: struct { int x; int y; }, union { int a; float b; } - Handling: Retrieve their corresponding concrete types
func (*Converter) ProcessEnumDecl ¶
func (ct *Converter) ProcessEnumDecl(cursor clang.Cursor) *ast.EnumTypeDecl
func (*Converter) ProcessEnumType ¶
func (*Converter) ProcessFieldList ¶
For Record Type(struct, union ...)'s FieldList
func (*Converter) ProcessFuncDecl ¶
converts functions, methods, constructors, destructors (including out-of-class decl) to ast.FuncDecl nodes.
func (*Converter) ProcessFunctionType ¶
For function types, we can only obtain the parameter types, but not the parameter names. This is because we cannot reverse-lookup the corresponding declaration node from a function type. Note: For function declarations, parameter names are collected in the ProcessFuncDecl method.
func (*Converter) ProcessInclude ¶
func (*Converter) ProcessMacro ¶
current only collect macro which defined in file
func (*Converter) ProcessMethodAttributes ¶
get Methods Attributes
func (*Converter) ProcessMethods ¶
Note:Public Method is considered
func (*Converter) ProcessRecordDecl ¶
func (*Converter) ProcessRecordType ¶
func (ct *Converter) ProcessRecordType(cursor clang.Cursor) *ast.RecordType
func (*Converter) ProcessStructDecl ¶
func (*Converter) ProcessTypeDefDecl ¶
func (ct *Converter) ProcessTypeDefDecl(cursor clang.Cursor) *ast.TypedefDecl