...

Package demangle

import "cmd/vendor/github.com/ianlancetaylor/demangle"
Overview
Index

Overview ▾

Package demangle defines functions that demangle GCC/LLVM C++ and Rust symbol names. This package recognizes names that were mangled according to the C++ ABI defined at http://codesourcery.com/cxx-abi/ and the Rust ABI defined at https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html

Most programs will want to call Filter or ToString.

Index ▾

Variables
func ASTToString(a AST, options ...Option) string
func Filter(name string, options ...Option) string
func ToString(name string, options ...Option) (string, error)
type AST
    func ToAST(name string, options ...Option) (AST, error)
type ArgumentPack
    func (ap *ArgumentPack) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ap *ArgumentPack) GoString() string
    func (ap *ArgumentPack) Traverse(fn func(AST) bool)
type ArrayType
    func (at *ArrayType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (at *ArrayType) GoString() string
    func (at *ArrayType) Traverse(fn func(AST) bool)
type Binary
    func (b *Binary) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (b *Binary) GoString() string
    func (b *Binary) Traverse(fn func(AST) bool)
type BinaryFP
    func (bfp *BinaryFP) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (bfp *BinaryFP) GoString() string
    func (bfp *BinaryFP) Traverse(fn func(AST) bool)
type BuiltinType
    func (bt *BuiltinType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (bt *BuiltinType) GoString() string
    func (bt *BuiltinType) Traverse(fn func(AST) bool)
type Cast
    func (c *Cast) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (c *Cast) GoString() string
    func (c *Cast) Traverse(fn func(AST) bool)
type Clone
    func (c *Clone) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (c *Clone) GoString() string
    func (c *Clone) Traverse(fn func(AST) bool)
type Closure
    func (cl *Closure) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (cl *Closure) GoString() string
    func (cl *Closure) Traverse(fn func(AST) bool)
type ComplexType
    func (ct *ComplexType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ct *ComplexType) GoString() string
    func (ct *ComplexType) Traverse(fn func(AST) bool)
type Constructor
    func (c *Constructor) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (c *Constructor) GoString() string
    func (c *Constructor) Traverse(fn func(AST) bool)
type Decltype
    func (dt *Decltype) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (dt *Decltype) GoString() string
    func (dt *Decltype) Traverse(fn func(AST) bool)
type DefaultArg
    func (da *DefaultArg) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (da *DefaultArg) GoString() string
    func (da *DefaultArg) Traverse(fn func(AST) bool)
type Destructor
    func (d *Destructor) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (d *Destructor) GoString() string
    func (d *Destructor) Traverse(fn func(AST) bool)
type ElaboratedType
    func (et *ElaboratedType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (et *ElaboratedType) GoString() string
    func (et *ElaboratedType) Traverse(fn func(AST) bool)
type EnableIf
    func (ei *EnableIf) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ei *EnableIf) GoString() string
    func (ei *EnableIf) Traverse(fn func(AST) bool)
type ExprList
    func (el *ExprList) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (el *ExprList) GoString() string
    func (el *ExprList) Traverse(fn func(AST) bool)
type FixedType
    func (ft *FixedType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ft *FixedType) GoString() string
    func (ft *FixedType) Traverse(fn func(AST) bool)
type Fold
    func (f *Fold) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (f *Fold) GoString() string
    func (f *Fold) Traverse(fn func(AST) bool)
type FunctionParam
    func (fp *FunctionParam) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (fp *FunctionParam) GoString() string
    func (fp *FunctionParam) Traverse(fn func(AST) bool)
type FunctionType
    func (ft *FunctionType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ft *FunctionType) GoString() string
    func (ft *FunctionType) Traverse(fn func(AST) bool)
type GlobalCDtor
    func (gcd *GlobalCDtor) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (gcd *GlobalCDtor) GoString() string
    func (gcd *GlobalCDtor) Traverse(fn func(AST) bool)
type ImaginaryType
    func (it *ImaginaryType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (it *ImaginaryType) GoString() string
    func (it *ImaginaryType) Traverse(fn func(AST) bool)
type InitializerList
    func (il *InitializerList) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (il *InitializerList) GoString() string
    func (il *InitializerList) Traverse(fn func(AST) bool)
type LambdaAuto
    func (la *LambdaAuto) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (la *LambdaAuto) GoString() string
    func (la *LambdaAuto) Traverse(fn func(AST) bool)
type LambdaExpr
    func (le *LambdaExpr) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (le *LambdaExpr) GoString() string
    func (le *LambdaExpr) Traverse(fn func(AST) bool)
type Literal
    func (l *Literal) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (l *Literal) GoString() string
    func (l *Literal) Traverse(fn func(AST) bool)
type MethodWithQualifiers
    func (mwq *MethodWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (mwq *MethodWithQualifiers) GoString() string
    func (mwq *MethodWithQualifiers) Traverse(fn func(AST) bool)
type Name
    func (n *Name) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (n *Name) GoString() string
    func (n *Name) Traverse(fn func(AST) bool)
type New
    func (n *New) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (n *New) GoString() string
    func (n *New) Traverse(fn func(AST) bool)
type NonTypeTemplateParam
    func (nttp *NonTypeTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (nttp *NonTypeTemplateParam) GoString() string
    func (nttp *NonTypeTemplateParam) Traverse(fn func(AST) bool)
type Nullary
    func (n *Nullary) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (n *Nullary) GoString() string
    func (n *Nullary) Traverse(fn func(AST) bool)
type Operator
    func (op *Operator) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (op *Operator) GoString() string
    func (op *Operator) Traverse(fn func(AST) bool)
type Option
    func MaxLength(pow int) Option
type PackExpansion
    func (pe *PackExpansion) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (pe *PackExpansion) GoString() string
    func (pe *PackExpansion) Traverse(fn func(AST) bool)
type PointerType
    func (pt *PointerType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (pt *PointerType) GoString() string
    func (pt *PointerType) Traverse(fn func(AST) bool)
type PtrMem
    func (pm *PtrMem) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (pm *PtrMem) GoString() string
    func (pm *PtrMem) Traverse(fn func(AST) bool)
type PtrMemCast
    func (pmc *PtrMemCast) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (pmc *PtrMemCast) GoString() string
    func (pmc *PtrMemCast) Traverse(fn func(AST) bool)
type Qualified
    func (q *Qualified) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (q *Qualified) GoString() string
    func (q *Qualified) Traverse(fn func(AST) bool)
type Qualifier
    func (q *Qualifier) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (q *Qualifier) GoString() string
    func (q *Qualifier) Traverse(fn func(AST) bool)
type Qualifiers
    func (qs *Qualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (qs *Qualifiers) GoString() string
    func (qs *Qualifiers) Traverse(fn func(AST) bool)
type ReferenceType
    func (rt *ReferenceType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (rt *ReferenceType) GoString() string
    func (rt *ReferenceType) Traverse(fn func(AST) bool)
type RvalueReferenceType
    func (rt *RvalueReferenceType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (rt *RvalueReferenceType) GoString() string
    func (rt *RvalueReferenceType) Traverse(fn func(AST) bool)
type SizeofArgs
    func (sa *SizeofArgs) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (sa *SizeofArgs) GoString() string
    func (sa *SizeofArgs) Traverse(fn func(AST) bool)
type SizeofPack
    func (sp *SizeofPack) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (sp *SizeofPack) GoString() string
    func (sp *SizeofPack) Traverse(fn func(AST) bool)
type Special
    func (s *Special) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (s *Special) GoString() string
    func (s *Special) Traverse(fn func(AST) bool)
type Special2
    func (s *Special2) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (s *Special2) GoString() string
    func (s *Special2) Traverse(fn func(AST) bool)
type StringLiteral
    func (sl *StringLiteral) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (sl *StringLiteral) GoString() string
    func (sl *StringLiteral) Traverse(fn func(AST) bool)
type StructuredBindings
    func (sb *StructuredBindings) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (sb *StructuredBindings) GoString() string
    func (sb *StructuredBindings) Traverse(fn func(AST) bool)
type Subobject
    func (so *Subobject) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (so *Subobject) GoString() string
    func (so *Subobject) Traverse(fn func(AST) bool)
type TaggedName
    func (t *TaggedName) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (t *TaggedName) GoString() string
    func (t *TaggedName) Traverse(fn func(AST) bool)
type Template
    func (t *Template) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (t *Template) GoString() string
    func (t *Template) Traverse(fn func(AST) bool)
type TemplateParam
    func (tp *TemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (tp *TemplateParam) GoString() string
    func (tp *TemplateParam) Traverse(fn func(AST) bool)
type TemplateParamName
    func (tpn *TemplateParamName) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (tpn *TemplateParamName) GoString() string
    func (tpn *TemplateParamName) Traverse(fn func(AST) bool)
type TemplateParamPack
    func (tpp *TemplateParamPack) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (tpp *TemplateParamPack) GoString() string
    func (tpp *TemplateParamPack) Traverse(fn func(AST) bool)
type TemplateTemplateParam
    func (ttp *TemplateTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ttp *TemplateTemplateParam) GoString() string
    func (ttp *TemplateTemplateParam) Traverse(fn func(AST) bool)
type Trinary
    func (t *Trinary) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (t *Trinary) GoString() string
    func (t *Trinary) Traverse(fn func(AST) bool)
type TypeTemplateParam
    func (ttp *TypeTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ttp *TypeTemplateParam) GoString() string
    func (ttp *TypeTemplateParam) Traverse(fn func(AST) bool)
type TypeWithQualifiers
    func (twq *TypeWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (twq *TypeWithQualifiers) GoString() string
    func (twq *TypeWithQualifiers) Traverse(fn func(AST) bool)
type Typed
    func (t *Typed) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (t *Typed) GoString() string
    func (t *Typed) Traverse(fn func(AST) bool)
type Unary
    func (u *Unary) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (u *Unary) GoString() string
    func (u *Unary) Traverse(fn func(AST) bool)
type UnnamedType
    func (ut *UnnamedType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (ut *UnnamedType) GoString() string
    func (ut *UnnamedType) Traverse(fn func(AST) bool)
type VectorType
    func (vt *VectorType) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (vt *VectorType) GoString() string
    func (vt *VectorType) Traverse(fn func(AST) bool)
type VendorQualifier
    func (vq *VendorQualifier) Copy(fn func(AST) AST, skip func(AST) bool) AST
    func (vq *VendorQualifier) GoString() string
    func (vq *VendorQualifier) Traverse(fn func(AST) bool)

Package files

ast.go demangle.go rust.go

Variables

ErrNotMangledName is returned by CheckedDemangle if the string does not appear to be a C++ symbol name.

var ErrNotMangledName = errors.New("not a C++ or Rust mangled name")

func ASTToString

func ASTToString(a AST, options ...Option) string

ASTToString returns the demangled name of the AST.

func Filter

func Filter(name string, options ...Option) string

Filter demangles a C++ or Rust symbol name, returning the human-readable C++ or Rust name. If any error occurs during demangling, the input string is returned.

func ToString

func ToString(name string, options ...Option) (string, error)

ToString demangles a C++ or Rust symbol name, returning a human-readable C++ or Rust name or an error. If the name does not appear to be a C++ or Rust symbol name at all, the error will be ErrNotMangledName.

type AST

AST is an abstract syntax tree representing a C++ declaration. This is sufficient for the demangler but is by no means a general C++ AST. This abstract syntax tree is only used for C++ symbols, not Rust symbols.

type AST interface {

    // Traverse each element of an AST.  If the function returns
    // false, traversal of children of that element is skipped.
    Traverse(func(AST) bool)

    // Copy an AST with possible transformations.
    // If the skip function returns true, no copy is required.
    // If the copy function returns nil, no copy is required.
    // The Copy method will do the right thing if copy returns nil
    // for some components of an AST but not others, so a good
    // copy function will only return non-nil for AST values that
    // need to change.
    // Copy itself returns either a copy or nil.
    Copy(copy func(AST) AST, skip func(AST) bool) AST

    // Implement the fmt.GoStringer interface.
    GoString() string
    // contains filtered or unexported methods
}

func ToAST

func ToAST(name string, options ...Option) (AST, error)

ToAST demangles a C++ symbol name into an abstract syntax tree representing the symbol. If the NoParams option is passed, and the name has a function type, the parameter types are not demangled. If the name does not appear to be a C++ symbol name at all, the error will be ErrNotMangledName. This function does not currently support Rust symbol names.

type ArgumentPack

ArgumentPack is an argument pack.

type ArgumentPack struct {
    Args []AST
}

func (*ArgumentPack) Copy

func (ap *ArgumentPack) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ArgumentPack) GoString

func (ap *ArgumentPack) GoString() string

func (*ArgumentPack) Traverse

func (ap *ArgumentPack) Traverse(fn func(AST) bool)

type ArrayType

ArrayType is an array type.

type ArrayType struct {
    Dimension AST
    Element   AST
}

func (*ArrayType) Copy

func (at *ArrayType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ArrayType) GoString

func (at *ArrayType) GoString() string

func (*ArrayType) Traverse

func (at *ArrayType) Traverse(fn func(AST) bool)

type Binary

Binary is a binary operation in an expression.

type Binary struct {
    Op    AST
    Left  AST
    Right AST
}

func (*Binary) Copy

func (b *Binary) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Binary) GoString

func (b *Binary) GoString() string

func (*Binary) Traverse

func (b *Binary) Traverse(fn func(AST) bool)

type BinaryFP

BinaryFP is a binary floating-point type.

type BinaryFP struct {
    Bits int
}

func (*BinaryFP) Copy

func (bfp *BinaryFP) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*BinaryFP) GoString

func (bfp *BinaryFP) GoString() string

func (*BinaryFP) Traverse

func (bfp *BinaryFP) Traverse(fn func(AST) bool)

type BuiltinType

BuiltinType is a builtin type, like "int".

type BuiltinType struct {
    Name string
}

func (*BuiltinType) Copy

func (bt *BuiltinType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*BuiltinType) GoString

func (bt *BuiltinType) GoString() string

func (*BuiltinType) Traverse

func (bt *BuiltinType) Traverse(fn func(AST) bool)

type Cast

Cast is a type cast.

type Cast struct {
    To AST
}

func (*Cast) Copy

func (c *Cast) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Cast) GoString

func (c *Cast) GoString() string

func (*Cast) Traverse

func (c *Cast) Traverse(fn func(AST) bool)

type Clone

Clone is a clone of a function, with a distinguishing suffix.

type Clone struct {
    Base   AST
    Suffix string
}

func (*Clone) Copy

func (c *Clone) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Clone) GoString

func (c *Clone) GoString() string

func (*Clone) Traverse

func (c *Clone) Traverse(fn func(AST) bool)

type Closure

Closure is a closure, or lambda expression.

type Closure struct {
    TemplateArgs []AST
    Types        []AST
    Num          int
}

func (*Closure) Copy

func (cl *Closure) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Closure) GoString

func (cl *Closure) GoString() string

func (*Closure) Traverse

func (cl *Closure) Traverse(fn func(AST) bool)

type ComplexType

ComplexType is a complex type.

type ComplexType struct {
    Base AST
}

func (*ComplexType) Copy

func (ct *ComplexType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ComplexType) GoString

func (ct *ComplexType) GoString() string

func (*ComplexType) Traverse

func (ct *ComplexType) Traverse(fn func(AST) bool)

type Constructor

Constructor is a constructor.

type Constructor struct {
    Name AST
    Base AST // base class of inheriting constructor
}

func (*Constructor) Copy

func (c *Constructor) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Constructor) GoString

func (c *Constructor) GoString() string

func (*Constructor) Traverse

func (c *Constructor) Traverse(fn func(AST) bool)

type Decltype

Decltype is the decltype operator.

type Decltype struct {
    Expr AST
}

func (*Decltype) Copy

func (dt *Decltype) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Decltype) GoString

func (dt *Decltype) GoString() string

func (*Decltype) Traverse

func (dt *Decltype) Traverse(fn func(AST) bool)

type DefaultArg

DefaultArg holds a default argument for a local name.

type DefaultArg struct {
    Num int
    Arg AST
}

func (*DefaultArg) Copy

func (da *DefaultArg) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*DefaultArg) GoString

func (da *DefaultArg) GoString() string

func (*DefaultArg) Traverse

func (da *DefaultArg) Traverse(fn func(AST) bool)

type Destructor

Destructor is a destructor.

type Destructor struct {
    Name AST
}

func (*Destructor) Copy

func (d *Destructor) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Destructor) GoString

func (d *Destructor) GoString() string

func (*Destructor) Traverse

func (d *Destructor) Traverse(fn func(AST) bool)

type ElaboratedType

ElaboratedType is an elaborated struct/union/enum type.

type ElaboratedType struct {
    Kind string
    Type AST
}

func (*ElaboratedType) Copy

func (et *ElaboratedType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ElaboratedType) GoString

func (et *ElaboratedType) GoString() string

func (*ElaboratedType) Traverse

func (et *ElaboratedType) Traverse(fn func(AST) bool)

type EnableIf

EnableIf is used by clang for an enable_if attribute.

type EnableIf struct {
    Type AST
    Args []AST
}

func (*EnableIf) Copy

func (ei *EnableIf) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*EnableIf) GoString

func (ei *EnableIf) GoString() string

func (*EnableIf) Traverse

func (ei *EnableIf) Traverse(fn func(AST) bool)

type ExprList

ExprList is a list of expressions, typically arguments to a function call in an expression.

type ExprList struct {
    Exprs []AST
}

func (*ExprList) Copy

func (el *ExprList) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ExprList) GoString

func (el *ExprList) GoString() string

func (*ExprList) Traverse

func (el *ExprList) Traverse(fn func(AST) bool)

type FixedType

FixedType is a fixed numeric type of unknown size.

type FixedType struct {
    Base  AST
    Accum bool
    Sat   bool
}

func (*FixedType) Copy

func (ft *FixedType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*FixedType) GoString

func (ft *FixedType) GoString() string

func (*FixedType) Traverse

func (ft *FixedType) Traverse(fn func(AST) bool)

type Fold

Fold is a C++17 fold-expression. Arg2 is nil for a unary operator.

type Fold struct {
    Left bool
    Op   AST
    Arg1 AST
    Arg2 AST
}

func (*Fold) Copy

func (f *Fold) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Fold) GoString

func (f *Fold) GoString() string

func (*Fold) Traverse

func (f *Fold) Traverse(fn func(AST) bool)

type FunctionParam

FunctionParam is a parameter of a function, used for last-specified return type in a closure.

type FunctionParam struct {
    Index int
}

func (*FunctionParam) Copy

func (fp *FunctionParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*FunctionParam) GoString

func (fp *FunctionParam) GoString() string

func (*FunctionParam) Traverse

func (fp *FunctionParam) Traverse(fn func(AST) bool)

type FunctionType

FunctionType is a function type.

type FunctionType struct {
    Return AST
    Args   []AST

    // The forLocalName field reports whether this FunctionType
    // was created for a local name. With the default GNU demangling
    // output we don't print the return type in that case.
    ForLocalName bool
}

func (*FunctionType) Copy

func (ft *FunctionType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*FunctionType) GoString

func (ft *FunctionType) GoString() string

func (*FunctionType) Traverse

func (ft *FunctionType) Traverse(fn func(AST) bool)

type GlobalCDtor

GlobalCDtor is a global constructor or destructor.

type GlobalCDtor struct {
    Ctor bool
    Key  AST
}

func (*GlobalCDtor) Copy

func (gcd *GlobalCDtor) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*GlobalCDtor) GoString

func (gcd *GlobalCDtor) GoString() string

func (*GlobalCDtor) Traverse

func (gcd *GlobalCDtor) Traverse(fn func(AST) bool)

type ImaginaryType

ImaginaryType is an imaginary type.

type ImaginaryType struct {
    Base AST
}

func (*ImaginaryType) Copy

func (it *ImaginaryType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ImaginaryType) GoString

func (it *ImaginaryType) GoString() string

func (*ImaginaryType) Traverse

func (it *ImaginaryType) Traverse(fn func(AST) bool)

type InitializerList

InitializerList is an initializer list: an optional type with a list of expressions.

type InitializerList struct {
    Type  AST
    Exprs AST
}

func (*InitializerList) Copy

func (il *InitializerList) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*InitializerList) GoString

func (il *InitializerList) GoString() string

func (*InitializerList) Traverse

func (il *InitializerList) Traverse(fn func(AST) bool)

type LambdaAuto

LambdaAuto is a lambda auto parameter.

type LambdaAuto struct {
    Index int
}

func (*LambdaAuto) Copy

func (la *LambdaAuto) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*LambdaAuto) GoString

func (la *LambdaAuto) GoString() string

func (*LambdaAuto) Traverse

func (la *LambdaAuto) Traverse(fn func(AST) bool)

type LambdaExpr

LambdaExpr is a literal that is a lambda expression.

type LambdaExpr struct {
    Type AST
}

func (*LambdaExpr) Copy

func (le *LambdaExpr) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*LambdaExpr) GoString

func (le *LambdaExpr) GoString() string

func (*LambdaExpr) Traverse

func (le *LambdaExpr) Traverse(fn func(AST) bool)

type Literal

Literal is a literal in an expression.

type Literal struct {
    Type AST
    Val  string
    Neg  bool
}

func (*Literal) Copy

func (l *Literal) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Literal) GoString

func (l *Literal) GoString() string

func (*Literal) Traverse

func (l *Literal) Traverse(fn func(AST) bool)

type MethodWithQualifiers

MethodWithQualifiers is a method with qualifiers.

type MethodWithQualifiers struct {
    Method       AST
    Qualifiers   AST
    RefQualifier string // "" or "&" or "&&"
}

func (*MethodWithQualifiers) Copy

func (mwq *MethodWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*MethodWithQualifiers) GoString

func (mwq *MethodWithQualifiers) GoString() string

func (*MethodWithQualifiers) Traverse

func (mwq *MethodWithQualifiers) Traverse(fn func(AST) bool)

type Name

Name is an unqualified name.

type Name struct {
    Name string
}

func (*Name) Copy

func (n *Name) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Name) GoString

func (n *Name) GoString() string

func (*Name) Traverse

func (n *Name) Traverse(fn func(AST) bool)

type New

New is a use of operator new in an expression.

type New struct {
    Op    AST
    Place AST
    Type  AST
    Init  AST
}

func (*New) Copy

func (n *New) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*New) GoString

func (n *New) GoString() string

func (*New) Traverse

func (n *New) Traverse(fn func(AST) bool)

type NonTypeTemplateParam

NonTypeTemplateParam is a non-type template parameter that appears in a lambda with explicit template parameters.

type NonTypeTemplateParam struct {
    Name AST
    Type AST
}

func (*NonTypeTemplateParam) Copy

func (nttp *NonTypeTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*NonTypeTemplateParam) GoString

func (nttp *NonTypeTemplateParam) GoString() string

func (*NonTypeTemplateParam) Traverse

func (nttp *NonTypeTemplateParam) Traverse(fn func(AST) bool)

type Nullary

Nullary is an operator in an expression with no arguments, such as throw.

type Nullary struct {
    Op AST
}

func (*Nullary) Copy

func (n *Nullary) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Nullary) GoString

func (n *Nullary) GoString() string

func (*Nullary) Traverse

func (n *Nullary) Traverse(fn func(AST) bool)

type Operator

Operator is an operator.

type Operator struct {
    Name string
}

func (*Operator) Copy

func (op *Operator) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Operator) GoString

func (op *Operator) GoString() string

func (*Operator) Traverse

func (op *Operator) Traverse(fn func(AST) bool)

type Option

Option is the type of demangler options.

type Option int
const (
    // The NoParams option disables demangling of function parameters.
    // It only omits the parameters of the function name being demangled,
    // not the parameter types of other functions that may be mentioned.
    // Using the option will speed up the demangler and cause it to
    // use less memory.
    NoParams Option = iota

    // The NoTemplateParams option disables demangling of template parameters.
    // This applies to both C++ and Rust.
    NoTemplateParams

    // The NoEnclosingParams option disables demangling of the function
    // parameter types of the enclosing function when demangling a
    // local name defined within a function.
    NoEnclosingParams

    // The NoClones option disables inclusion of clone suffixes.
    // NoParams implies NoClones.
    NoClones

    // The NoRust option disables demangling of old-style Rust
    // mangled names, which can be confused with C++ style mangled
    // names. New style Rust mangled names are still recognized.
    NoRust

    // The Verbose option turns on more verbose demangling.
    Verbose

    // LLVMStyle tries to translate an AST to a string in the
    // style of the LLVM demangler. This does not affect
    // the parsing of the AST, only the conversion of the AST
    // to a string.
    LLVMStyle
)

func MaxLength

func MaxLength(pow int) Option

MaxLength returns an Option that limits the maximum length of a demangled string. The maximum length is expressed as a power of 2, so a value of 1 limits the returned string to 2 characters, and a value of 16 limits the returned string to 65,536 characters. The value must be between 1 and 30.

type PackExpansion

PackExpansion is a pack expansion. The Pack field may be nil.

type PackExpansion struct {
    Base AST
    Pack *ArgumentPack
}

func (*PackExpansion) Copy

func (pe *PackExpansion) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*PackExpansion) GoString

func (pe *PackExpansion) GoString() string

func (*PackExpansion) Traverse

func (pe *PackExpansion) Traverse(fn func(AST) bool)

type PointerType

PointerType is a pointer type.

type PointerType struct {
    Base AST
}

func (*PointerType) Copy

func (pt *PointerType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*PointerType) GoString

func (pt *PointerType) GoString() string

func (*PointerType) Traverse

func (pt *PointerType) Traverse(fn func(AST) bool)

type PtrMem

PtrMem is a pointer-to-member expression.

type PtrMem struct {
    Class  AST
    Member AST
}

func (*PtrMem) Copy

func (pm *PtrMem) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*PtrMem) GoString

func (pm *PtrMem) GoString() string

func (*PtrMem) Traverse

func (pm *PtrMem) Traverse(fn func(AST) bool)

type PtrMemCast

PtrMemCast is a conversion of an expression to a pointer-to-member type. This is used for C++20 manglings of class types used as the type of non-type template arguments.

See https://github.com/itanium-cxx-abi/cxx-abi/issues/47.

type PtrMemCast struct {
    Type   AST
    Expr   AST
    Offset int
}

func (*PtrMemCast) Copy

func (pmc *PtrMemCast) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*PtrMemCast) GoString

func (pmc *PtrMemCast) GoString() string

func (*PtrMemCast) Traverse

func (pmc *PtrMemCast) Traverse(fn func(AST) bool)

type Qualified

Qualified is a name in a scope.

type Qualified struct {
    Scope AST
    Name  AST

    // The LocalName field is true if this is parsed as a
    // <local-name>.  We shouldn't really need this, but in some
    // cases (for the unary sizeof operator) the standard
    // demangler prints a local name slightly differently.  We
    // keep track of this for compatibility.
    LocalName bool // A full local name encoding
}

func (*Qualified) Copy

func (q *Qualified) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Qualified) GoString

func (q *Qualified) GoString() string

func (*Qualified) Traverse

func (q *Qualified) Traverse(fn func(AST) bool)

type Qualifier

Qualifier is a single type qualifier.

type Qualifier struct {
    Name  string // qualifier name: const, volatile, etc.
    Exprs []AST  // can be non-nil for noexcept and throw
}

func (*Qualifier) Copy

func (q *Qualifier) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Qualifier) GoString

func (q *Qualifier) GoString() string

func (*Qualifier) Traverse

func (q *Qualifier) Traverse(fn func(AST) bool)

type Qualifiers

Qualifiers is an ordered list of type qualifiers.

type Qualifiers struct {
    Qualifiers []AST
}

func (*Qualifiers) Copy

func (qs *Qualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Qualifiers) GoString

func (qs *Qualifiers) GoString() string

func (*Qualifiers) Traverse

func (qs *Qualifiers) Traverse(fn func(AST) bool)

type ReferenceType

ReferenceType is a reference type.

type ReferenceType struct {
    Base AST
}

func (*ReferenceType) Copy

func (rt *ReferenceType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*ReferenceType) GoString

func (rt *ReferenceType) GoString() string

func (*ReferenceType) Traverse

func (rt *ReferenceType) Traverse(fn func(AST) bool)

type RvalueReferenceType

RvalueReferenceType is an rvalue reference type.

type RvalueReferenceType struct {
    Base AST
}

func (*RvalueReferenceType) Copy

func (rt *RvalueReferenceType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*RvalueReferenceType) GoString

func (rt *RvalueReferenceType) GoString() string

func (*RvalueReferenceType) Traverse

func (rt *RvalueReferenceType) Traverse(fn func(AST) bool)

type SizeofArgs

SizeofArgs is the size of a captured template parameter pack from an alias template.

type SizeofArgs struct {
    Args []AST
}

func (*SizeofArgs) Copy

func (sa *SizeofArgs) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*SizeofArgs) GoString

func (sa *SizeofArgs) GoString() string

func (*SizeofArgs) Traverse

func (sa *SizeofArgs) Traverse(fn func(AST) bool)

type SizeofPack

SizeofPack is the sizeof operator applied to an argument pack.

type SizeofPack struct {
    Pack *ArgumentPack
}

func (*SizeofPack) Copy

func (sp *SizeofPack) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*SizeofPack) GoString

func (sp *SizeofPack) GoString() string

func (*SizeofPack) Traverse

func (sp *SizeofPack) Traverse(fn func(AST) bool)

type Special

Special is a special symbol, printed as a prefix plus another value.

type Special struct {
    Prefix string
    Val    AST
}

func (*Special) Copy

func (s *Special) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Special) GoString

func (s *Special) GoString() string

func (*Special) Traverse

func (s *Special) Traverse(fn func(AST) bool)

type Special2

Special2 is like special, but uses two values.

type Special2 struct {
    Prefix string
    Val1   AST
    Middle string
    Val2   AST
}

func (*Special2) Copy

func (s *Special2) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Special2) GoString

func (s *Special2) GoString() string

func (*Special2) Traverse

func (s *Special2) Traverse(fn func(AST) bool)

type StringLiteral

StringLiteral is a string literal.

type StringLiteral struct {
    Type AST
}

func (*StringLiteral) Copy

func (sl *StringLiteral) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*StringLiteral) GoString

func (sl *StringLiteral) GoString() string

func (*StringLiteral) Traverse

func (sl *StringLiteral) Traverse(fn func(AST) bool)

type StructuredBindings

StructuredBindings is a structured binding declaration.

type StructuredBindings struct {
    Bindings []AST
}

func (*StructuredBindings) Copy

func (sb *StructuredBindings) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*StructuredBindings) GoString

func (sb *StructuredBindings) GoString() string

func (*StructuredBindings) Traverse

func (sb *StructuredBindings) Traverse(fn func(AST) bool)

type Subobject

Subobject is a a reference to an offset in an expression. This is used for C++20 manglings of class types used as the type of non-type template arguments.

See https://github.com/itanium-cxx-abi/cxx-abi/issues/47.

type Subobject struct {
    Type      AST
    SubExpr   AST
    Offset    int
    Selectors []int
    PastEnd   bool
}

func (*Subobject) Copy

func (so *Subobject) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Subobject) GoString

func (so *Subobject) GoString() string

func (*Subobject) Traverse

func (so *Subobject) Traverse(fn func(AST) bool)

type TaggedName

TaggedName is a name with an ABI tag.

type TaggedName struct {
    Name AST
    Tag  AST
}

func (*TaggedName) Copy

func (t *TaggedName) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TaggedName) GoString

func (t *TaggedName) GoString() string

func (*TaggedName) Traverse

func (t *TaggedName) Traverse(fn func(AST) bool)

type Template

Template is a template with arguments.

type Template struct {
    Name AST
    Args []AST
}

func (*Template) Copy

func (t *Template) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Template) GoString

func (t *Template) GoString() string

func (*Template) Traverse

func (t *Template) Traverse(fn func(AST) bool)

type TemplateParam

TemplateParam is a template parameter. The Template field is filled in while parsing the demangled string. We don't normally see these while printing--they are replaced by the simplify function.

type TemplateParam struct {
    Index    int
    Template *Template
}

func (*TemplateParam) Copy

func (tp *TemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TemplateParam) GoString

func (tp *TemplateParam) GoString() string

func (*TemplateParam) Traverse

func (tp *TemplateParam) Traverse(fn func(AST) bool)

type TemplateParamName

TemplateParamName is the name of a template parameter that the demangler introduced for a lambda that has explicit template parameters. This is a prefix with an index.

type TemplateParamName struct {
    Prefix string
    Index  int
}

func (*TemplateParamName) Copy

func (tpn *TemplateParamName) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TemplateParamName) GoString

func (tpn *TemplateParamName) GoString() string

func (*TemplateParamName) Traverse

func (tpn *TemplateParamName) Traverse(fn func(AST) bool)

type TemplateParamPack

TemplateParamPack is a template parameter pack that appears in a lambda with explicit template parameters.

type TemplateParamPack struct {
    Param AST
}

func (*TemplateParamPack) Copy

func (tpp *TemplateParamPack) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TemplateParamPack) GoString

func (tpp *TemplateParamPack) GoString() string

func (*TemplateParamPack) Traverse

func (tpp *TemplateParamPack) Traverse(fn func(AST) bool)

type TemplateTemplateParam

TemplateTemplateParam is a template template parameter that appears in a lambda with explicit template parameters.

type TemplateTemplateParam struct {
    Name   AST
    Params []AST
}

func (*TemplateTemplateParam) Copy

func (ttp *TemplateTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TemplateTemplateParam) GoString

func (ttp *TemplateTemplateParam) GoString() string

func (*TemplateTemplateParam) Traverse

func (ttp *TemplateTemplateParam) Traverse(fn func(AST) bool)

type Trinary

Trinary is the ?: trinary operation in an expression.

type Trinary struct {
    Op     AST
    First  AST
    Second AST
    Third  AST
}

func (*Trinary) Copy

func (t *Trinary) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Trinary) GoString

func (t *Trinary) GoString() string

func (*Trinary) Traverse

func (t *Trinary) Traverse(fn func(AST) bool)

type TypeTemplateParam

TypeTemplateParam is a type template parameter that appears in a lambda with explicit template parameters.

type TypeTemplateParam struct {
    Name AST
}

func (*TypeTemplateParam) Copy

func (ttp *TypeTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TypeTemplateParam) GoString

func (ttp *TypeTemplateParam) GoString() string

func (*TypeTemplateParam) Traverse

func (ttp *TypeTemplateParam) Traverse(fn func(AST) bool)

type TypeWithQualifiers

TypeWithQualifiers is a type with standard qualifiers.

type TypeWithQualifiers struct {
    Base       AST
    Qualifiers AST
}

func (*TypeWithQualifiers) Copy

func (twq *TypeWithQualifiers) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*TypeWithQualifiers) GoString

func (twq *TypeWithQualifiers) GoString() string

func (*TypeWithQualifiers) Traverse

func (twq *TypeWithQualifiers) Traverse(fn func(AST) bool)

type Typed

Typed is a typed name.

type Typed struct {
    Name AST
    Type AST
}

func (*Typed) Copy

func (t *Typed) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Typed) GoString

func (t *Typed) GoString() string

func (*Typed) Traverse

func (t *Typed) Traverse(fn func(AST) bool)

type Unary

Unary is a unary operation in an expression.

type Unary struct {
    Op         AST
    Expr       AST
    Suffix     bool // true for ++ -- when used as postfix
    SizeofType bool // true for sizeof (type)
}

func (*Unary) Copy

func (u *Unary) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*Unary) GoString

func (u *Unary) GoString() string

func (*Unary) Traverse

func (u *Unary) Traverse(fn func(AST) bool)

type UnnamedType

UnnamedType is an unnamed type, that just has an index.

type UnnamedType struct {
    Num int
}

func (*UnnamedType) Copy

func (ut *UnnamedType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*UnnamedType) GoString

func (ut *UnnamedType) GoString() string

func (*UnnamedType) Traverse

func (ut *UnnamedType) Traverse(fn func(AST) bool)

type VectorType

VectorType is a vector type.

type VectorType struct {
    Dimension AST
    Base      AST
}

func (*VectorType) Copy

func (vt *VectorType) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*VectorType) GoString

func (vt *VectorType) GoString() string

func (*VectorType) Traverse

func (vt *VectorType) Traverse(fn func(AST) bool)

type VendorQualifier

VendorQualifier is a type qualified by a vendor-specific qualifier.

type VendorQualifier struct {
    Qualifier AST
    Type      AST
}

func (*VendorQualifier) Copy

func (vq *VendorQualifier) Copy(fn func(AST) AST, skip func(AST) bool) AST

func (*VendorQualifier) GoString

func (vq *VendorQualifier) GoString() string

func (*VendorQualifier) Traverse

func (vq *VendorQualifier) Traverse(fn func(AST) bool)