Documentation ¶
Overview ¶
Package ast parses the clang AST output into AST structures.
Index ¶
- func GenerateErrorMessage(e error, n Node) string
- func GenerateWarningMessage(e error, n Node) string
- func GenerateWarningOrErrorMessage(e error, n Node, isError bool) string
- func Position(node Node) string
- type AlignedAttr
- type AlwaysInlineAttr
- type ArrayFiller
- type ArraySubscriptExpr
- type AsmLabelAttr
- type AvailabilityAttr
- type BinaryOperator
- type BreakStmt
- type BuiltinType
- type CStyleCastExpr
- type CallExpr
- type CaseStmt
- type CharacterLiteral
- type CompoundAssignOperator
- type CompoundStmt
- type ConditionalOperator
- type ConstAttr
- type ConstantArrayType
- type ContinueStmt
- type DeclRefExpr
- type DeclStmt
- type DefaultStmt
- type DeprecatedAttr
- type DoStmt
- type ElaboratedType
- type Enum
- type EnumConstantDecl
- type EnumDecl
- type EnumType
- type FieldDecl
- type FloatingLiteral
- type ForStmt
- type FormatAttr
- type FunctionDecl
- type FunctionProtoType
- type GotoStmt
- type IfStmt
- type ImplicitCastExpr
- type ImplicitValueInitExpr
- type IncompleteArrayType
- type IndirectFieldDecl
- type InitListExpr
- type IntegerLiteral
- type LabelStmt
- type MallocAttr
- type MaxFieldAlignmentAttr
- type MemberExpr
- type ModeAttr
- type NoInlineAttr
- type NoThrowAttr
- type Node
- type NonNullAttr
- type OffsetOfExpr
- type PackedAttr
- type ParenExpr
- type ParenType
- type ParmVarDecl
- type PointerType
- type PredefinedExpr
- type PureAttr
- type QualType
- type Record
- type RecordDecl
- type RecordType
- type RestrictAttr
- type ReturnStmt
- type ReturnsTwiceAttr
- type StringLiteral
- type SwitchStmt
- type TranslationUnitDecl
- type TransparentUnionAttr
- type Typedef
- type TypedefDecl
- type TypedefType
- type UnaryExprOrTypeTraitExpr
- type UnaryOperator
- type UnusedAttr
- type VAArgExpr
- type VarDecl
- type WarnUnusedResultAttr
- type WeakAttr
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateErrorMessage ¶ added in v0.12.3
func GenerateWarningMessage ¶ added in v0.12.3
func GenerateWarningOrErrorMessage ¶ added in v0.12.3
Types ¶
type AlignedAttr ¶ added in v0.11.2
AlignedAttr is a type of attribute that is optionally attached to a variable or struct field definition.
func (*AlignedAttr) AddChild ¶ added in v0.11.2
func (n *AlignedAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type AlwaysInlineAttr ¶
AlwaysInlineAttr is a type of attribute that is optionally attached to a variable or struct field definition.
func (*AlwaysInlineAttr) AddChild ¶
func (n *AlwaysInlineAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ArrayFiller ¶ added in v0.11.2
type ArrayFiller struct {
Children []Node
}
func (*ArrayFiller) AddChild ¶ added in v0.11.2
func (n *ArrayFiller) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ArraySubscriptExpr ¶
type ArraySubscriptExpr struct { Address string Position string Type string Kind string Children []Node }
func (*ArraySubscriptExpr) AddChild ¶
func (n *ArraySubscriptExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type AsmLabelAttr ¶
type AsmLabelAttr struct { Address string Position string Inherited bool FunctionName string Children []Node }
func (*AsmLabelAttr) AddChild ¶
func (n *AsmLabelAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type AvailabilityAttr ¶
type AvailabilityAttr struct { Address string Position string OS string Version string Unknown1 float64 Unknown2 int Message1 string Message2 string IsInherited bool Children []Node }
func (*AvailabilityAttr) AddChild ¶
func (n *AvailabilityAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type BinaryOperator ¶
type BinaryOperator struct { Address string Position string Type string Operator string Children []Node }
func (*BinaryOperator) AddChild ¶
func (n *BinaryOperator) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type BuiltinType ¶
func (*BuiltinType) AddChild ¶
func (n *BuiltinType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type CStyleCastExpr ¶
type CStyleCastExpr struct { Address string Position string Type string Kind string Children []Node }
func (*CStyleCastExpr) AddChild ¶
func (n *CStyleCastExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type CharacterLiteral ¶
type CharacterLiteral struct { Address string Position string Type string Value int Children []Node }
func (*CharacterLiteral) AddChild ¶
func (n *CharacterLiteral) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type CompoundAssignOperator ¶ added in v0.10.4
type CompoundAssignOperator struct { Address string Position string Type string Opcode string ComputationLHSType string ComputationResultType string Children []Node }
func (*CompoundAssignOperator) AddChild ¶ added in v0.10.4
func (n *CompoundAssignOperator) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type CompoundStmt ¶
type CompoundStmt struct { Address string Position string Children []Node // TODO: remove this BelongsToSwitch bool }
func (*CompoundStmt) AddChild ¶
func (n *CompoundStmt) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ConditionalOperator ¶
func (*ConditionalOperator) AddChild ¶
func (n *ConditionalOperator) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ConstantArrayType ¶
func (*ConstantArrayType) AddChild ¶
func (n *ConstantArrayType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ContinueStmt ¶ added in v0.10.2
func (*ContinueStmt) AddChild ¶ added in v0.10.2
func (n *ContinueStmt) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type DeclRefExpr ¶
type DeclRefExpr struct { Address string Position string Type string Lvalue bool For string Address2 string Name string Type2 string Children []Node }
func (*DeclRefExpr) AddChild ¶
func (n *DeclRefExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type DefaultStmt ¶ added in v0.9.2
func (*DefaultStmt) AddChild ¶ added in v0.9.2
func (n *DefaultStmt) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type DeprecatedAttr ¶
type DeprecatedAttr struct { Address string Position string Message1 string Message2 string Children []Node }
func (*DeprecatedAttr) AddChild ¶
func (n *DeprecatedAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ElaboratedType ¶
func (*ElaboratedType) AddChild ¶
func (n *ElaboratedType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type EnumConstantDecl ¶
type EnumConstantDecl struct { Address string Position string Position2 string Referenced bool Name string Type string Children []Node }
func (*EnumConstantDecl) AddChild ¶
func (n *EnumConstantDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type EnumDecl ¶
type FieldDecl ¶
type FloatingLiteral ¶
type FloatingLiteral struct { Address string Position string Type string Value float64 Children []Node }
func (*FloatingLiteral) AddChild ¶
func (n *FloatingLiteral) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type FormatAttr ¶
type FormatAttr struct { Address string Position string Implicit bool Inherited bool FunctionName string Unknown1 int Unknown2 int Children []Node }
func (*FormatAttr) AddChild ¶
func (n *FormatAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type FunctionDecl ¶
type FunctionDecl struct { Address string Position string Prev string Position2 string Name string Type string IsExtern bool IsImplicit bool IsUsed bool IsReferenced bool Children []Node }
func (*FunctionDecl) AddChild ¶
func (n *FunctionDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type FunctionProtoType ¶
func (*FunctionProtoType) AddChild ¶
func (n *FunctionProtoType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type GotoStmt ¶ added in v0.11.2
type ImplicitCastExpr ¶
type ImplicitCastExpr struct { Address string Position string Type string Kind string Children []Node }
func (*ImplicitCastExpr) AddChild ¶
func (n *ImplicitCastExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ImplicitValueInitExpr ¶ added in v0.11.2
type ImplicitValueInitExpr struct { Address string Position string Type1 string Type2 string Children []Node }
func (*ImplicitValueInitExpr) AddChild ¶ added in v0.11.2
func (n *ImplicitValueInitExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type IncompleteArrayType ¶ added in v0.11.2
func (*IncompleteArrayType) AddChild ¶ added in v0.11.2
func (n *IncompleteArrayType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type IndirectFieldDecl ¶ added in v0.13.7
type IndirectFieldDecl struct { Address string Position string Position2 string Implicit bool Name string Type string Children []Node }
func (*IndirectFieldDecl) AddChild ¶ added in v0.13.7
func (n *IndirectFieldDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type InitListExpr ¶ added in v0.11.2
func (*InitListExpr) AddChild ¶ added in v0.11.2
func (n *InitListExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type IntegerLiteral ¶
type IntegerLiteral struct { Address string Position string Type string Value string Children []Node }
func (*IntegerLiteral) AddChild ¶
func (n *IntegerLiteral) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type MallocAttr ¶
func (*MallocAttr) AddChild ¶
func (n *MallocAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type MaxFieldAlignmentAttr ¶ added in v0.11.2
func (*MaxFieldAlignmentAttr) AddChild ¶ added in v0.11.2
func (n *MaxFieldAlignmentAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type MemberExpr ¶
type MemberExpr struct { Address string Position string Type string Type2 string Name string IsLvalue bool IsBitfield bool Address2 string IsPointer bool Children []Node }
func (*MemberExpr) AddChild ¶
func (n *MemberExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
func (*MemberExpr) GetDeclRefExpr ¶ added in v0.13.3
func (n *MemberExpr) GetDeclRefExpr() *DeclRefExpr
GetDeclRefExpr gets DeclRefExpr from MemberExpr, or nil if there is no DeclRefExpr
type NoInlineAttr ¶ added in v0.11.2
func (*NoInlineAttr) AddChild ¶ added in v0.11.2
func (n *NoInlineAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type NoThrowAttr ¶
func (*NoThrowAttr) AddChild ¶
func (n *NoThrowAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type Node ¶
type Node interface {
AddChild(node Node)
}
Node represents any node in the AST.
func GetAllNodesOfType ¶ added in v0.13.7
GetAllNodesOfType returns all of the nodes of the tree that match the type provided. The type should be a pointer to an object in the ast package.
The nodes returned may reference each other and there is no guarenteed order in which the nodes are returned.
type NonNullAttr ¶
func (*NonNullAttr) AddChild ¶
func (n *NonNullAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type OffsetOfExpr ¶ added in v0.11.2
func (*OffsetOfExpr) AddChild ¶ added in v0.11.2
func (n *OffsetOfExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type PackedAttr ¶ added in v0.11.2
func (*PackedAttr) AddChild ¶ added in v0.11.2
func (n *PackedAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ParmVarDecl ¶
type ParmVarDecl struct { Address string Position string Position2 string Name string Type string Type2 string IsUsed bool Children []Node }
func (*ParmVarDecl) AddChild ¶
func (n *ParmVarDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type PointerType ¶
func (*PointerType) AddChild ¶
func (n *PointerType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type PredefinedExpr ¶
type PredefinedExpr struct { Address string Position string Type string Name string Lvalue bool Children []Node }
func (*PredefinedExpr) AddChild ¶
func (n *PredefinedExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type PureAttr ¶ added in v0.9.0
type RecordDecl ¶
type RecordDecl struct { Address string Position string Prev string Position2 string Kind string Name string Definition bool Children []Node }
func (*RecordDecl) AddChild ¶
func (n *RecordDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type RecordType ¶
func (*RecordType) AddChild ¶
func (n *RecordType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type RestrictAttr ¶
func (*RestrictAttr) AddChild ¶
func (n *RestrictAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ReturnStmt ¶
func (*ReturnStmt) AddChild ¶
func (n *ReturnStmt) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type ReturnsTwiceAttr ¶ added in v0.11.2
func (*ReturnsTwiceAttr) AddChild ¶ added in v0.11.2
func (n *ReturnsTwiceAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type StringLiteral ¶
type StringLiteral struct { Address string Position string Type string Value string Lvalue bool Children []Node }
func (*StringLiteral) AddChild ¶
func (n *StringLiteral) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type SwitchStmt ¶ added in v0.9.2
func (*SwitchStmt) AddChild ¶ added in v0.9.2
func (n *SwitchStmt) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type TranslationUnitDecl ¶
func (*TranslationUnitDecl) AddChild ¶
func (n *TranslationUnitDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type TransparentUnionAttr ¶ added in v0.9.0
func (*TransparentUnionAttr) AddChild ¶ added in v0.9.0
func (n *TransparentUnionAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type TypedefDecl ¶
type TypedefDecl struct { Address string Position string Position2 string Name string Type string Type2 string IsImplicit bool IsReferenced bool Children []Node }
func (*TypedefDecl) AddChild ¶
func (n *TypedefDecl) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type TypedefType ¶
func (*TypedefType) AddChild ¶
func (n *TypedefType) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type UnaryExprOrTypeTraitExpr ¶ added in v0.11.0
type UnaryExprOrTypeTraitExpr struct { Address string Position string Type1 string Function string Type2 string Children []Node }
func (*UnaryExprOrTypeTraitExpr) AddChild ¶ added in v0.11.0
func (n *UnaryExprOrTypeTraitExpr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type UnaryOperator ¶
type UnaryOperator struct { Address string Position string Type string IsLvalue bool IsPrefix bool Operator string Children []Node }
func (*UnaryOperator) AddChild ¶
func (n *UnaryOperator) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type UnusedAttr ¶ added in v0.14.0
func (*UnusedAttr) AddChild ¶ added in v0.14.0
func (n *UnusedAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
type VarDecl ¶
type WarnUnusedResultAttr ¶ added in v0.9.0
func (*WarnUnusedResultAttr) AddChild ¶ added in v0.9.0
func (n *WarnUnusedResultAttr) AddChild(node Node)
AddChild adds a new child node. Child nodes can then be accessed with the Children attribute.
Source Files ¶
- aligned_attr.go
- always_inline_attr.go
- array_filler.go
- array_subscript_expr.go
- asm_label_attr.go
- ast.go
- availability_attr.go
- binary_operator.go
- break_stmt.go
- builtin_type.go
- c_style_cast_expr.go
- call_expr.go
- case_stmt.go
- character_literal.go
- compound_assign_operator.go
- compound_stmt.go
- conditional_operator.go
- const_attr.go
- constant_array_type.go
- continue_stmt.go
- decl_ref_expr.go
- decl_stmt.go
- default_stmt.go
- deprecated_attr.go
- do_stmt.go
- elaborated_type.go
- enum.go
- enum_constant_decl.go
- enum_decl.go
- enum_type.go
- field_decl.go
- floating_literal.go
- for_stmt.go
- format_attr.go
- function_decl.go
- function_proto_type.go
- go_stmt.go
- if_stmt.go
- implicit_cast_expr.go
- implicit_value_init_expr.go
- incomplete_array_type.go
- indirect_field_decl.go
- init_list_expr.go
- integer_literal.go
- label_stmt.go
- malloc_attr.go
- max_field_alignment_attr.go
- member_expr.go
- mode_attr.go
- no_inline_attr.go
- no_throw_attr.go
- non_null_attr.go
- offset_of_expr.go
- packed_attr.go
- paren_expr.go
- paren_type.go
- parm_var_decl.go
- pointer_type.go
- predefined_expr.go
- pure_attr.go
- qual_type.go
- record.go
- record_decl.go
- record_type.go
- restrict_attr.go
- return_stmt.go
- returns_twice_attr.go
- string_literal.go
- switch_stmt.go
- translation_unit_decl.go
- transparent_union_attr.go
- traverse.go
- typedef.go
- typedef_decl.go
- typedef_type.go
- unary_expr_or_type_trait_expr.go
- unary_operator.go
- unused_attr.go
- util.go
- va_arg_expr.go
- var_decl.go
- warn_unused_result_attr.go
- weak_attr.go
- while_stmt.go