demangle

Imports

Imports #

"errors"
"fmt"
"strings"
"fmt"
"math"
"math/bits"
"strings"
"unicode/utf8"
"fmt"
"strings"

Constants & Variables

ErrNotMangledName var #

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

var ErrNotMangledName = *ast.CallExpr

LLVMStyle const #

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.

const LLVMStyle

NoClones const #

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

const NoClones

NoEnclosingParams const #

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

const NoEnclosingParams

NoParams 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.

const NoParams Option = iota

NoRust const #

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.

const NoRust

NoTemplateParams const #

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

const NoTemplateParams

Verbose const #

The Verbose option turns on more verbose demangling.

const Verbose

builtinTypeFloat var #

Builtin float types.

var builtinTypeFloat = map[string]bool{...}

builtinTypeSuffix var #

Suffixes to use for constants of the given integer type.

var builtinTypeSuffix = map[string]string{...}

builtinTypes var #

builtinTypes maps the type letter to the type name.

var builtinTypes = map[byte]string{...}

forLocalName const #

const forLocalName forLocalNameType = iota

maxLengthMask const #

maxLengthMask is a mask for the maxLength value.

const maxLengthMask = *ast.BinaryExpr

maxLengthShift const #

maxLengthShift is how we shift the MaxLength value.

const maxLengthShift = 16

notForLocalName const #

const notForLocalName

operators var #

The operators map maps the mangled operator names to information about them.

var operators = map[string]operator{...}

precAdd const #

The precedence values, in order from high to low.

const precAdd

precAnd const #

The precedence values, in order from high to low.

const precAnd

precAssign const #

The precedence values, in order from high to low.

const precAssign

precCast const #

The precedence values, in order from high to low.

const precCast

precComma const #

The precedence values, in order from high to low.

const precComma

precCond const #

The precedence values, in order from high to low.

const precCond

precDefault const #

The precedence values, in order from high to low.

const precDefault

precEqual const #

The precedence values, in order from high to low.

const precEqual

precLogicalAnd const #

The precedence values, in order from high to low.

const precLogicalAnd

precLogicalOr const #

The precedence values, in order from high to low.

const precLogicalOr

precMul const #

The precedence values, in order from high to low.

const precMul

precOr const #

The precedence values, in order from high to low.

const precOr

precPostfix const #

The precedence values, in order from high to low.

const precPostfix

precPrimary const #

The precedence values, in order from high to low.

const precPrimary precedence = iota

precPtrMem const #

The precedence values, in order from high to low.

const precPtrMem

precRel const #

The precedence values, in order from high to low.

const precRel

precShift const #

The precedence values, in order from high to low.

const precShift

precSpaceship const #

The precedence values, in order from high to low.

const precSpaceship

precUnary const #

The precedence values, in order from high to low.

const precUnary

precXor const #

The precedence values, in order from high to low.

const precXor

qualifiers var #

qualifiers maps from the character used in the mangled name to the string to print.

var qualifiers = map[byte]string{...}

rustBasicTypes var #

var rustBasicTypes = map[byte]string{...}

subAST var #

subAST maps standard substitution codes to the corresponding AST.

var subAST = map[byte]AST{...}

verboseAST var #

verboseAST maps standard substitution codes to the long form of the corresponding AST. We use this when the Verbose option is used, to match the standard demangler.

var verboseAST = map[byte]AST{...}

Type Aliases

Option type #

Option is the type of demangler options.

type Option int

forLocalNameType type #

type forLocalNameType int

precedence type #

precedence is used for operator precedence. This is used to avoid unnecessary parentheses when printing expressions in the LLVM style.

type precedence int

substitutions type #

substitutions is the list of substitution candidates that may appear later in the string.

type substitutions []AST

Interfaces

AST interface #

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 {
print(*printState)
Traverse(func(AST) bool)
Copy(copy func(AST) AST, skip func(AST) bool) AST
GoString() string
goString(indent int, field string) string
}

hasPrec interface #

hasPrec matches the AST nodes that have a prec method that returns the node's precedence.

type hasPrec interface {
prec() precedence
}

innerPrinter interface #

innerPrinter is an interface for types that can print themselves as inner types.

type innerPrinter interface {
printInner(*printState)
}

Structs

ArgumentPack struct #

ArgumentPack is an argument pack.

type ArgumentPack struct {
Args []AST
}

ArrayType struct #

ArrayType is an array type.

type ArrayType struct {
Dimension AST
Element AST
}

Binary struct #

Binary is a binary operation in an expression.

type Binary struct {
Op AST
Left AST
Right AST
}

BinaryFP struct #

BinaryFP is a binary floating-point type.

type BinaryFP struct {
Bits int
}

BitIntType struct #

BitIntType is the C++23 _BitInt(N) type.

type BitIntType struct {
Size AST
Signed bool
}

BuiltinType struct #

BuiltinType is a builtin type, like "int".

type BuiltinType struct {
Name string
}

Cast struct #

Cast is a type cast.

type Cast struct {
To AST
}

Clone struct #

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

type Clone struct {
Base AST
Suffix string
}

Closure struct #

Closure is a closure, or lambda expression.

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

ComplexType struct #

ComplexType is a complex type.

type ComplexType struct {
Base AST
}

ConstrainedTypeTemplateParam struct #

ConstrainedTypeTemplateParam is a constrained template type parameter declaration.

type ConstrainedTypeTemplateParam struct {
Name AST
Constraint AST
}

Constraint struct #

Constraint represents an AST with a constraint.

type Constraint struct {
Name AST
Requires AST
}

Constructor struct #

Constructor is a constructor.

type Constructor struct {
Name AST
Base AST
}

Decltype struct #

Decltype is the decltype operator.

type Decltype struct {
Expr AST
}

DefaultArg struct #

DefaultArg holds a default argument for a local name.

type DefaultArg struct {
Num int
Arg AST
}

Destructor struct #

Destructor is a destructor.

type Destructor struct {
Name AST
}

ElaboratedType struct #

ElaboratedType is an elaborated struct/union/enum type.

type ElaboratedType struct {
Kind string
Type AST
}

EnableIf struct #

EnableIf is used by clang for an enable_if attribute.

type EnableIf struct {
Type AST
Args []AST
}

ExplicitObjectParameter struct #

ExplicitObjectParameter represents a C++23 explicit object parameter.

type ExplicitObjectParameter struct {
Base AST
}

ExprList struct #

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

type ExprList struct {
Exprs []AST
}

ExprRequirement struct #

ExprRequirement is a simple requirement in a requires expression. This is an arbitrary expression.

type ExprRequirement struct {
Expr AST
Noexcept bool
TypeReq AST
}

FixedType struct #

FixedType is a fixed numeric type of unknown size.

type FixedType struct {
Base AST
Accum bool
Sat bool
}

Fold struct #

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
}

Friend struct #

Friend is a member like friend name.

type Friend struct {
Name AST
}

FunctionParam struct #

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

type FunctionParam struct {
Index int
}

FunctionType struct #

FunctionType is a function type.

type FunctionType struct {
Return AST
Args []AST
ForLocalName bool
}

GlobalCDtor struct #

GlobalCDtor is a global constructor or destructor.

type GlobalCDtor struct {
Ctor bool
Key AST
}

ImaginaryType struct #

ImaginaryType is an imaginary type.

type ImaginaryType struct {
Base AST
}

InitializerList struct #

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

type InitializerList struct {
Type AST
Exprs AST
}

LambdaAuto struct #

LambdaAuto is a lambda auto parameter.

type LambdaAuto struct {
Index int
}

LambdaExpr struct #

LambdaExpr is a literal that is a lambda expression.

type LambdaExpr struct {
Type AST
}

Literal struct #

Literal is a literal in an expression.

type Literal struct {
Type AST
Val string
Neg bool
}

MethodWithQualifiers struct #

MethodWithQualifiers is a method with qualifiers.

type MethodWithQualifiers struct {
Method AST
Qualifiers AST
RefQualifier string
}

ModuleEntity struct #

ModuleEntity is a name inside a module.

type ModuleEntity struct {
Module AST
Name AST
}

ModuleName struct #

ModuleName is a C++20 module.

type ModuleName struct {
Parent AST
Name AST
IsPartition bool
}

Name struct #

Name is an unqualified name.

type Name struct {
Name string
}

NestedRequirement struct #

NestedRequirement is a nested requirement in a requires expression.

type NestedRequirement struct {
Constraint AST
}

New struct #

New is a use of operator new in an expression.

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

NonTypeTemplateParam struct #

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

type NonTypeTemplateParam struct {
Name AST
Type AST
}

Nullary struct #

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

type Nullary struct {
Op AST
}

Operator struct #

Operator is an operator.

type Operator struct {
Name string
precedence precedence
}

PackExpansion struct #

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

type PackExpansion struct {
Base AST
Pack *ArgumentPack
}

PointerType struct #

PointerType is a pointer type.

type PointerType struct {
Base AST
}

PtrMem struct #

PtrMem is a pointer-to-member expression.

type PtrMem struct {
Class AST
Member AST
}

PtrMemCast struct #

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
}

Qualified struct #

Qualified is a name in a scope.

type Qualified struct {
Scope AST
Name AST
LocalName bool
}

Qualifier struct #

Qualifier is a single type qualifier.

type Qualifier struct {
Name string
Exprs []AST
}

Qualifiers struct #

Qualifiers is an ordered list of type qualifiers.

type Qualifiers struct {
Qualifiers []AST
}

ReferenceType struct #

ReferenceType is a reference type.

type ReferenceType struct {
Base AST
}

RequiresExpr struct #

RequiresExpr is a C++20 requires expression.

type RequiresExpr struct {
Params []AST
Requirements []AST
}

RvalueReferenceType struct #

RvalueReferenceType is an rvalue reference type.

type RvalueReferenceType struct {
Base AST
}

SizeofArgs struct #

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

type SizeofArgs struct {
Args []AST
}

SizeofPack struct #

SizeofPack is the sizeof operator applied to an argument pack.

type SizeofPack struct {
Pack *ArgumentPack
}

Special struct #

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

type Special struct {
Prefix string
Val AST
}

Special2 struct #

Special2 is like special, but uses two values.

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

StringLiteral struct #

StringLiteral is a string literal.

type StringLiteral struct {
Type AST
}

StructuredBindings struct #

StructuredBindings is a structured binding declaration.

type StructuredBindings struct {
Bindings []AST
}

Subobject struct #

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
}

SuffixType struct #

SuffixType is an type with an arbitrary suffix.

type SuffixType struct {
Base AST
Suffix string
}

TaggedName struct #

TaggedName is a name with an ABI tag.

type TaggedName struct {
Name AST
Tag AST
}

Template struct #

Template is a template with arguments.

type Template struct {
Name AST
Args []AST
}

TemplateParam struct #

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
}

TemplateParamName struct #

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
}

TemplateParamPack struct #

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

type TemplateParamPack struct {
Param AST
}

TemplateParamQualifiedArg struct #

TemplateParamQualifiedArg is used when the mangled name includes both the template parameter declaration and the template argument. See https://github.com/itanium-cxx-abi/cxx-abi/issues/47.

type TemplateParamQualifiedArg struct {
Param AST
Arg AST
}

TemplateTemplateParam struct #

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

type TemplateTemplateParam struct {
Name AST
Params []AST
Constraint AST
}

TransformedType struct #

TransformedType is a builtin type with a template argument.

type TransformedType struct {
Name string
Base AST
}

Trinary struct #

Trinary is the ?: trinary operation in an expression.

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

TypeRequirement struct #

TypeRequirement is a type requirement in a requires expression.

type TypeRequirement struct {
Type AST
}

TypeTemplateParam struct #

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

type TypeTemplateParam struct {
Name AST
}

TypeWithQualifiers struct #

TypeWithQualifiers is a type with standard qualifiers.

type TypeWithQualifiers struct {
Base AST
Qualifiers AST
}

Typed struct #

Typed is a typed name.

type Typed struct {
Name AST
Type AST
}

Unary struct #

Unary is a unary operation in an expression.

type Unary struct {
Op AST
Expr AST
Suffix bool
SizeofType bool
}

UnnamedType struct #

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

type UnnamedType struct {
Num int
}

VectorType struct #

VectorType is a vector type.

type VectorType struct {
Dimension AST
Base AST
}

VendorQualifier struct #

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

type VendorQualifier struct {
Qualifier AST
Type AST
}

demangleErr struct #

A demangleErr is an error at a specific offset in the mangled string.

type demangleErr struct {
err string
off int
}

operator struct #

An operator is the demangled name, and the number of arguments it takes in an expression.

type operator struct {
name string
args int
prec precedence
}

printState struct #

The printState type holds information needed to print an AST.

type printState struct {
tparams bool
enclosingParams bool
llvmStyle bool
max int
scopes int
buf strings.Builder
last byte
inner []AST
printing []AST
}

rustState struct #

A rustState holds the current state of demangling a Rust string.

type rustState struct {
orig string
str string
off int
buf strings.Builder
skip bool
lifetimes int64
last byte
noGenericArgs bool
max int
}

state struct #

A state holds the current state of demangling a string.

type state struct {
str string
verbose bool
off int
subs substitutions
templates []*Template
lambdaTemplateLevel int
parsingConstraint bool
typeTemplateParamCount int
nonTypeTemplateParamCount int
templateTemplateParamCount int
}

Functions

ASTToString function #

ASTToString returns the demangled name of the AST.

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

Copy method #

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

Copy method #

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

Copy method #

func (eop *ExplicitObjectParameter) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

func (nr *NestedRequirement) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

func (tr *TypeRequirement) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

func (er *ExprRequirement) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

func (re *RequiresExpr) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

func (tt *TransformedType) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

func (st *SuffixType) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

func (cttp *ConstrainedTypeTemplateParam) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

func (me *ModuleEntity) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

func (mn *ModuleName) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

func (tpqa *TemplateParamQualifiedArg) Copy(fn func(AST) AST, skip func(AST) bool) AST

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Copy method #

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

Error method #

Error implements the builtin error interface for demangleErr.

func (de demangleErr) Error() string

Filter function #

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 Filter(name string, options ...Option) string

GoString method #

func (tt *TransformedType) GoString() string

GoString method #

func (f *Fold) GoString() string

GoString method #

func (op *Operator) GoString() string

GoString method #

func (eop *ExplicitObjectParameter) GoString() string

GoString method #

func (c *Constructor) GoString() string

GoString method #

func (dt *Decltype) GoString() string

GoString method #

func (et *ElaboratedType) GoString() string

GoString method #

func (d *Destructor) GoString() string

GoString method #

func (vt *VectorType) GoString() string

GoString method #

func (gcd *GlobalCDtor) GoString() string

GoString method #

func (cl *Closure) GoString() string

GoString method #

func (sb *StructuredBindings) GoString() string

GoString method #

func (bt *BitIntType) GoString() string

GoString method #

func (t *TaggedName) GoString() string

GoString method #

func (bfp *BinaryFP) GoString() string

GoString method #

func (ft *FixedType) GoString() string

GoString method #

func (pe *PackExpansion) GoString() string

GoString method #

func (pm *PtrMem) GoString() string

GoString method #

func (da *DefaultArg) GoString() string

GoString method #

func (ut *UnnamedType) GoString() string

GoString method #

func (nr *NestedRequirement) GoString() string

GoString method #

func (il *InitializerList) GoString() string

GoString method #

func (ap *ArgumentPack) GoString() string

GoString method #

func (fp *FunctionParam) GoString() string

GoString method #

func (tr *TypeRequirement) GoString() string

GoString method #

func (sp *SizeofPack) GoString() string

GoString method #

func (ft *FunctionType) GoString() string

GoString method #

func (n *Name) GoString() string

GoString method #

func (el *ExprList) GoString() string

GoString method #

func (er *ExprRequirement) GoString() string

GoString method #

func (sa *SizeofArgs) GoString() string

GoString method #

func (le *LambdaExpr) GoString() string

GoString method #

func (at *ArrayType) GoString() string

GoString method #

func (re *RequiresExpr) GoString() string

GoString method #

func (t *Typed) GoString() string

GoString method #

func (tpn *TemplateParamName) GoString() string

GoString method #

func (ttp *TypeTemplateParam) GoString() string

GoString method #

func (vq *VendorQualifier) GoString() string

GoString method #

func (c *Clone) GoString() string

GoString method #

func (q *Qualified) GoString() string

GoString method #

func (sl *StringLiteral) GoString() string

GoString method #

func (c *Constraint) GoString() string

GoString method #

func (nttp *NonTypeTemplateParam) GoString() string

GoString method #

func (st *SuffixType) GoString() string

GoString method #

func (s *Special) GoString() string

GoString method #

func (t *Template) GoString() string

GoString method #

func (l *Literal) GoString() string

GoString method #

func (ttp *TemplateTemplateParam) GoString() string

GoString method #

func (it *ImaginaryType) GoString() string

GoString method #

func (f *Friend) GoString() string

GoString method #

func (tp *TemplateParam) GoString() string

GoString method #

func (cttp *ConstrainedTypeTemplateParam) GoString() string

GoString method #

func (n *New) GoString() string

GoString method #

func (ct *ComplexType) GoString() string

GoString method #

func (tpp *TemplateParamPack) GoString() string

GoString method #

func (la *LambdaAuto) GoString() string

GoString method #

func (rt *RvalueReferenceType) GoString() string

GoString method #

func (c *Cast) GoString() string

GoString method #

func (me *ModuleEntity) GoString() string

GoString method #

func (s *Special2) GoString() string

GoString method #

func (tpqa *TemplateParamQualifiedArg) GoString() string

GoString method #

func (pmc *PtrMemCast) GoString() string

GoString method #

func (rt *ReferenceType) GoString() string

GoString method #

func (n *Nullary) GoString() string

GoString method #

func (pt *PointerType) GoString() string

GoString method #

func (qs *Qualifiers) GoString() string

GoString method #

func (u *Unary) GoString() string

GoString method #

func (so *Subobject) GoString() string

GoString method #

func (mn *ModuleName) GoString() string

GoString method #

func (b *Binary) GoString() string

GoString method #

func (q *Qualifier) GoString() string

GoString method #

func (bt *BuiltinType) GoString() string

GoString method #

func (t *Trinary) GoString() string

GoString method #

func (mwq *MethodWithQualifiers) GoString() string

GoString method #

func (ei *EnableIf) GoString() string

GoString method #

func (twq *TypeWithQualifiers) GoString() string

MaxLength function #

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.

func MaxLength(pow int) Option

ToAST function #

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.

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

ToString function #

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.

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (mn *ModuleName) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (me *ModuleEntity) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (tpqa *TemplateParamQualifiedArg) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (cttp *ConstrainedTypeTemplateParam) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

func (st *SuffixType) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (tt *TransformedType) Traverse(fn func(AST) bool)

Traverse method #

func (eop *ExplicitObjectParameter) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (re *RequiresExpr) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (er *ExprRequirement) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

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

Traverse method #

func (tr *TypeRequirement) Traverse(fn func(AST) bool)

Traverse method #

func (nr *NestedRequirement) Traverse(fn func(AST) bool)

Traverse method #

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

Traverse method #

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

add method #

add adds a new substitution candidate.

func (subs *substitutions) add(a AST)

adjustErr function #

adjustErr adjusts the position of err, if it is a demangleErr, and returns err.

func adjustErr(err error, adj int) error

advance method #

advance advances the current string offset.

func (st *state) advance(add int)

advance method #

advance advances the current string offset.

func (rst *rustState) advance(add int)

arrayType method #

arrayType parses: ::= A <(positive dimension) number> _ <(element) type> ::= A [<(dimension) expression>] _ <(element) type>

func (st *state) arrayType(isCast bool) AST

backref method #

backref parses: = "B"

func (rst *rustState) backref(demangle func())

bareFunctionType method #

bareFunctionType parses: ::= [J]+

func (st *state) bareFunctionType(hasReturnType bool, explicitObjectParameter bool) AST

base62Number method #

base62Number parses: = {<0-9a-zA-Z>} "_"

func (rst *rustState) base62Number() int64

baseUnresolvedName method #

baseUnresolvedName parses: ::= ::= on ::= on ::= dn ::= [ ]

func (st *state) baseUnresolvedName() AST

basicType method #

basicType parses:

func (rst *rustState) basicType()

binder method #

binder parses an optional: = "G"

func (rst *rustState) binder()

callOffset method #

callOffset parses: ::= h _ ::= v _ ::= <(offset) number> ::= <(offset) number> _ <(virtual offset) number> The c parameter, if not 0, is a character we just read which is the start of the . We don't display the offset information anywhere.

func (st *state) callOffset(c byte)

checkChar method #

checkChar requires that the next character in the string be c, and advances past it.

func (st *state) checkChar(c byte)

checkChar method #

checkChar requires that the next character in the string be c, and advances past it.

func (rst *rustState) checkChar(c byte)

clearTemplateArgs method #

clearTemplateArgs gives an error for any unset Template field in args. This handles erroneous cases where a cast operator with a forward referenced template is in the scope of another cast operator.

func (st *state) clearTemplateArgs(args []AST)

cloneSuffix method #

Recognize a clone suffix. These are not part of the mangling API, but are added by GCC when cloning functions.

func (st *state) cloneSuffix(a AST) AST

closureTypeName method #

closureTypeName parses: ::= Ul E [ ] _ ::= +

func (st *state) closureTypeName() AST

compactNumber method #

compactNumber parses: _

func (st *state) compactNumber() int

constraintExpr method #

constraintExpr parses a constraint expression. This is just a regular expression, but template parameters are handled specially.

func (st *state) constraintExpr() AST

copy method #

copy returns a copy of the current state.

func (st *state) copy() *state

cvQualifiers method #

cvQualifiers parses: ::= [r] [V] [K]

func (st *state) cvQualifiers() AST

decimalNumber method #

func (rst *rustState) decimalNumber() int

demangleCastTemplateArgs method #

demangleCastTemplateArgs is for a rather hideous parse. When we see a template-param followed by a template-args, we need to decide whether we have a template-param or a template-template-param. Normally it is template-template-param, meaning that we pick up the template arguments here. But, if we are parsing the type for a cast operator, then the only way this can be template-template-param is if there is another set of template-args immediately after this set. That would look like this: -> -> -> -> -> -> cv -> cv Otherwise, we have this derivation: -> -> -> -> -> -> cv -> cv in which the template-args are actually part of the prefix. For the special case where this arises, demangleType is called with isCast as true. This function is then responsible for checking whether we see but there is not another following . In that case, we reset the parse and just return the .

func (st *state) demangleCastTemplateArgs(tp AST, addSubst bool) AST

demangleConst method #

demangleConst parses: = | "p" // placeholder, shown as _ | = ["n"] {} "_"

func (rst *rustState) demangleConst()

demangleType method #

demangleType parses: = | // named type | "A" // [T; N] | "S" // [T] | "T" {} "E" // (T1, T2, T3, ...) | "R" [] // &T | "Q" [] // &mut T | "P" // *const T | "O" // *mut T | "F" // fn(...) -> ... | "D" // dyn Trait + Send + 'a |

func (rst *rustState) demangleType()

demangleType method #

demangleType parses: ::= ::= ::= ::= ::= ::= ::= ::= ::= ::= P ::= R ::= O (C++0x) ::= C ::= G ::= U ::= various one letter codes ::= u

func (st *state) demangleType(isCast bool) AST

disambiguator method #

disambiguator parses an optional: = "s"

func (rst *rustState) disambiguator() int64

discriminator method #

discriminator parses: ::= _ <(non-negative) number> (when number < 10) __ <(non-negative) number> _ (when number >= 10)

func (st *state) discriminator(a AST) AST

doDemangle function #

The doDemangle function is the entry point into the demangler proper.

func doDemangle(name string, options ...Option) (ret AST, err error)

dynBounds method #

dynBounds parses: = [] {} "E"

func (rst *rustState) dynBounds()

dynTrait method #

dynTrait parses: = {} = "p"

func (rst *rustState) dynTrait()

encoding method #

encoding parses: encoding ::= <(function) name> <(data) name>

func (st *state) encoding(params bool, local forLocalNameType) AST

endScope method #

endScope closes a scope.

func (ps *printState) endScope(b byte)

expandPunycode method #

expandPunycode decodes the Rust version of punycode. This algorithm is taken from RFC 3492 section 6.2.

func (rst *rustState) expandPunycode(s string) string

exprList method #

exprList parses a sequence of expressions up to a terminating character.

func (st *state) exprList(stop byte) AST

exprPrimary method #

exprPrimary parses: ::= L <(value) number> E ::= L <(value) float> E ::= L E

func (st *state) exprPrimary() AST

expression method #

expression parses: ::= <(unary) operator-name> ::= <(binary) operator-name> ::= <(trinary) operator-name> ::= pp_ ::= mm_ ::= cl + E ::= cl + E ::= cv ::= cv _ * E ::= tl * E ::= il * E ::= [gs] nw * _ E ::= [gs] nw * _ ::= [gs] na * _ E ::= [gs] na * _ ::= [gs] dl ::= [gs] da ::= dc ::= sc ::= cc ::= mc [] E ::= rc ::= ti ::= te ::= so [] * [p] E ::= st ::= sz ::= at ::= az ::= nx ::= ::= ::= dt ::= pt ::= ds ::= sZ ::= sZ ::= sP * E ::= sp ::= fl ::= fr ::= fL ::= fR ::= tw ::= tr ::= u * E ::= ::= ::= fp _ ::= fp ::= fL p _ ::= fL p ::= fpT ::= ::= di ::= dx ::= dX

func (st *state) expression() AST

fail method #

fail panics with demangleErr, to be caught in doDemangle.

func (st *state) fail(err string)

fail method #

fail panics with demangleErr, to be caught in rustToString.

func (rst *rustState) fail(err string)

failEarlier method #

failEarlier is like fail, but decrements the offset to indicate that the point of failure occurred earlier in the string.

func (st *state) failEarlier(err string, dec int)

findArgumentPack method #

findArgumentPack walks the AST looking for the argument pack for a pack expansion. We find it via a template parameter.

func (st *state) findArgumentPack(a AST) *ArgumentPack

fnSig method #

fnSig parses: = [] ["U"] ["K" ] {} "E" = "C" |

func (rst *rustState) fnSig()

functionType method #

functionType parses: ::= F [Y] [] E

func (st *state) functionType() AST

genericArg method #

genericArg parses: = | | "K" // forward-compat for const generics = "L"

func (rst *rustState) genericArg()

genericArgs method #

genericArgs prints a list of generic arguments, without angle brackets.

func (rst *rustState) genericArgs()

globalCDtorName function #

globalCDtorName demangles a global constructor/destructor symbol name. The parameter is the string following the "_GLOBAL_" prefix.

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

goString method #

func (f *Fold) goString(indent int, field string) string

goString method #

func (il *InitializerList) goString(indent int, field string) string

goString method #

func (op *Operator) goString(indent int, field string) string

goString method #

func (eop *ExplicitObjectParameter) goString(indent int, field string) string

goString method #

func (dt *Decltype) goString(indent int, field string) string

goString method #

func (c *Constructor) goString(indent int, field string) string

goString method #

func (nr *NestedRequirement) goString(indent int, field string) string

goString method #

func (et *ElaboratedType) goString(indent int, field string) string

goString method #

func (d *Destructor) goString(indent int, field string) string

goString method #

func (tr *TypeRequirement) goString(indent int, field string) string

goString method #

func (vt *VectorType) goString(indent int, field string) string

goString method #

func (er *ExprRequirement) goString(indent int, field string) string

goString method #

func (re *RequiresExpr) goString(indent int, field string) string

goString method #

func (gcd *GlobalCDtor) goString(indent int, field string) string

goString method #

func (c *Constraint) goString(indent int, field string) string

goString method #

func (bt *BitIntType) goString(indent int, field string) string

goString method #

func (f *Friend) goString(indent int, field string) string

goString method #

func (bfp *BinaryFP) goString(indent int, field string) string

goString method #

func (t *TaggedName) goString(indent int, field string) string

goString method #

func (me *ModuleEntity) goString(indent int, field string) string

goString method #

func (mn *ModuleName) goString(indent int, field string) string

goString method #

func (ft *FixedType) goString(indent int, field string) string

goString method #

func (ei *EnableIf) goString(indent int, field string) string

goString method #

func (pe *PackExpansion) goString(indent int, field string) string

goString method #

func (s *Special2) goString(indent int, field string) string

goString method #

func (pm *PtrMem) goString(indent int, field string) string

goString method #

func (s *Special) goString(indent int, field string) string

goString method #

func (n *Nullary) goString(indent int, field string) string

goString method #

func (pt *PointerType) goString(indent int, field string) string

goString method #

func (ap *ArgumentPack) goString(indent int, field string) string

goString method #

func (c *Clone) goString(indent int, field string) string

goString method #

func (ut *UnnamedType) goString(indent int, field string) string

goString method #

func (fp *FunctionParam) goString(indent int, field string) string

goString method #

func (sb *StructuredBindings) goString(indent int, field string) string

goString method #

func (sp *SizeofPack) goString(indent int, field string) string

goString method #

func (u *Unary) goString(indent int, field string) string

goString method #

func (ft *FunctionType) goString(indent int, field string) string

goString method #

func (c *Cast) goString(indent int, field string) string

goString method #

func (cl *Closure) goString(indent int, field string) string

goString method #

func (sa *SizeofArgs) goString(indent int, field string) string

goString method #

func (da *DefaultArg) goString(indent int, field string) string

goString method #

func (rt *ReferenceType) goString(indent int, field string) string

goString method #

func (at *ArrayType) goString(indent int, field string) string

goString method #

func (el *ExprList) goString(indent int, field string) string

goString method #

func (tpn *TemplateParamName) goString(indent int, field string) string

goString method #

func (n *Name) goString(indent int, field string) string

goString method #

func (le *LambdaExpr) goString(indent int, field string) string

goString method #

func (t *Typed) goString(indent int, field string) string

goString method #

func (vq *VendorQualifier) goString(indent int, field string) string

goString method #

func (ttp *TypeTemplateParam) goString(indent int, field string) string

goString method #

func (sl *StringLiteral) goString(indent int, field string) string

goString method #

func (q *Qualified) goString(indent int, field string) string

goString method #

func (l *Literal) goString(indent int, field string) string

goString method #

func (t *Template) goString(indent int, field string) string

goString method #

func (tt *TransformedType) goString(indent int, field string) string

goString method #

func (nttp *NonTypeTemplateParam) goString(indent int, field string) string

goString method #

func (tp *TemplateParam) goString(indent int, field string) string

goString method #

func (n *New) goString(indent int, field string) string

goString method #

func (st *SuffixType) goString(indent int, field string) string

goString method #

func (la *LambdaAuto) goString(indent int, field string) string

goString method #

func (ttp *TemplateTemplateParam) goString(indent int, field string) string

goString method #

func (pmc *PtrMemCast) goString(indent int, field string) string

goString method #

func (tpqa *TemplateParamQualifiedArg) goString(indent int, field string) string

goString method #

func (qs *Qualifiers) goString(indent int, field string) string

goString method #

func (it *ImaginaryType) goString(indent int, field string) string

goString method #

func (so *Subobject) goString(indent int, field string) string

goString method #

func (cttp *ConstrainedTypeTemplateParam) goString(indent int, field string) string

goString method #

func (q *Qualifier) goString(indent int, field string) string

goString method #

func (twq *TypeWithQualifiers) goString(indent int, field string) string

goString method #

func (t *Trinary) goString(indent int, field string) string

goString method #

func (ct *ComplexType) goString(indent int, field string) string

goString method #

func (mwq *MethodWithQualifiers) goString(indent int, field string) string

goString method #

func (tpp *TemplateParamPack) goString(indent int, field string) string

goString method #

func (bt *BuiltinType) goString(indent int, field string) string

goString method #

func (b *Binary) goString(indent int, field string) string

goString method #

func (rt *RvalueReferenceType) goString(indent int, field string) string

hasReturnType function #

hasReturnType returns whether the mangled form of a will have a return type.

func hasReturnType(a AST) bool

identifier method #

identifier parses: = [] It returns the disambiguator and the identifier.

func (rst *rustState) identifier() (int64, string)

implPath method #

implPath parses: = []

func (rst *rustState) implPath()

isCDtorConversion function #

isCDtorConversion returns when an AST is a constructor, a destructor, or a conversion operator.

func isCDtorConversion(a AST) bool

isDesignatedInitializer function #

isDesignatedInitializer reports whether x is a designated initializer.

func isDesignatedInitializer(x AST) bool

isDigit function #

isDigit returns whetner c is a digit for demangling purposes.

func isDigit(c byte) bool

isEmpty method #

isEmpty returns whether printing a will not print anything.

func (ps *printState) isEmpty(a AST) bool

isLower function #

isLower returns whether c is a lower case letter for demangling purposes.

func isLower(c byte) bool

isMaxLength function #

isMaxLength reports whether an Option holds a maximum length.

func isMaxLength(opt Option) bool

isUpper function #

isUpper returns whether c is an upper case letter for demangling purposes.

func isUpper(c byte) bool

javaResource method #

Parse a Java resource special-name.

func (st *state) javaResource() AST

localName method #

localName parses: ::= Z <(function) encoding> E <(entity) name> [] ::= Z <(function) encoding> E s [] ::= Z <(function) encoding> E d [ number>] _ Besides the name, this returns whether it saw the code indicating a C++23 explicit object parameter.

func (st *state) localName() (AST, bool)

maxLength function #

maxLength returns the maximum length stored in an Option.

func maxLength(opt Option) int

mergeQualifiers function #

mergeQualifiers merges two qualifier lists into one.

func mergeQualifiers(q1AST AST, q2AST AST) AST

moduleName method #

moduleName parses: ::= ::= ::= # passed in by caller ::= W ::= W P The module name is optional. If it is not present, this returns the parent.

func (st *state) moduleName(parent AST) AST

name method #

name parses: ::= ::= ::= ::= ::= ::= St ::= ::= Besides the name, this returns whether it saw the code indicating a C++23 explicit object parameter.

func (st *state) name() (AST, bool)

nestedName method #

nestedName parses: ::= N [] [] E ::= N [] [] E Besides the name, this returns whether it saw the code indicating a C++23 explicit object parameter.

func (st *state) nestedName() (AST, bool)

number method #

number parses: number ::= [n] <(non-negative decimal integer)>

func (st *state) number() int

oldRustToString function #

oldRustToString demangles a Rust symbol using the old demangling. The second result reports whether this is a valid Rust mangled name.

func oldRustToString(name string, options []Option) (string, bool)

operatorName method #

operatorName parses: operator_name ::= many different two character encodings. ::= cv ::= v We need to know whether we are in an expression because it affects how we handle template parameters in the type of a cast operator.

func (st *state) operatorName(inExpression bool) (AST, int)

parenthesize function #

The parenthesize function prints the string for val, wrapped in parentheses if necessary.

func parenthesize(ps *printState, val AST)

parmlist method #

parmlist parses: +

func (st *state) parmlist(explicitObjectParameter bool) []AST

path method #

path parses: = "C" // crate root | "M" // (inherent impl) | "X" // (trait impl) | "Y" // (trait definition) | "N" // ...::ident (nested path) | "I" {} "E" // ... (generic args) | = "C" // closure | "S" // shim | // other special namespaces | // internal namespaces needsSeparator is true if we need to write out :: for a generic; it is passed as false if we are in the middle of a type.

func (rst *rustState) path(needsSeparator bool)

pathStartGenerics method #

pathStartGenerics is like path but if it sees an I to start generic arguments it won't close them. It reports whether it started generics.

func (rst *rustState) pathStartGenerics() bool

pointerToMemberType method #

pointerToMemberType parses: ::= M <(class) type> <(member) type>

func (st *state) pointerToMemberType(isCast bool) AST

prec method #

func (c *Cast) prec() precedence

prec method #

func (b *Binary) prec() precedence

prec method #

func (bt *BuiltinType) prec() precedence

prec method #

func (op *Operator) prec() precedence

prec method #

func (fp *FunctionParam) prec() precedence

prec method #

func (u *Unary) prec() precedence

prec method #

func (l *Literal) prec() precedence

prec method #

func (el *ExprList) prec() precedence

prec method #

func (n *Name) prec() precedence

prec method #

func (q *Qualified) prec() precedence

prefix method #

prefix parses: ::= ::= ::= ::= ::= ::= ::= <(template) unqualified-name> ::= ::= ::= Dt E ::= DT E

func (st *state) prefix() AST

print method #

func (sb *StructuredBindings) print(ps *printState)

print method #

func (t *Trinary) print(ps *printState)

print method #

func (c *Constructor) print(ps *printState)

print method #

func (pmc *PtrMemCast) print(ps *printState)

print method #

func (st *SuffixType) print(ps *printState)

print method #

func (qs *Qualifiers) print(ps *printState)

print method #

func (op *Operator) print(ps *printState)

print method #

func (cttp *ConstrainedTypeTemplateParam) print(ps *printState)

print method #

func (n *New) print(ps *printState)

print method #

func (tpqa *TemplateParamQualifiedArg) print(ps *printState)

print method #

func (n *Nullary) print(ps *printState)

print method #

func (la *LambdaAuto) print(ps *printState)

print method #

func (tt *TransformedType) print(ps *printState)

print method #

func (l *Literal) print(ps *printState)

print method #

func (ttp *TemplateTemplateParam) print(ps *printState)

print method #

func (tp *TemplateParam) print(ps *printState)

print method #

func (vq *VendorQualifier) print(ps *printState)

print method #

func (d *Destructor) print(ps *printState)

print method #

func (tpp *TemplateParamPack) print(ps *printState)

print method #

func (sl *StringLiteral) print(ps *printState)

print method #

func (t *Template) print(ps *printState)

print method #

func (twq *TypeWithQualifiers) print(ps *printState)

print method #

func (eop *ExplicitObjectParameter) print(ps *printState)

print method #

func (nttp *NonTypeTemplateParam) print(ps *printState)

print method #

func (le *LambdaExpr) print(ps *printState)

print method #

func (q *Qualified) print(ps *printState)

print method #

func (at *ArrayType) print(ps *printState)

print method #

func (dt *Decltype) print(ps *printState)

print method #

func (et *ElaboratedType) print(ps *printState)

print method #

func (el *ExprList) print(ps *printState)

print method #

func (t *Typed) print(ps *printState)

print method #

func (so *Subobject) print(ps *printState)

print method #

func (ttp *TypeTemplateParam) print(ps *printState)

print method #

func (u *Unary) print(ps *printState)

print method #

func (nr *NestedRequirement) print(ps *printState)

print method #

func (il *InitializerList) print(ps *printState)

print method #

func (n *Name) print(ps *printState)

print method #

func (gcd *GlobalCDtor) print(ps *printState)

print method #

func (rt *ReferenceType) print(ps *printState)

print method #

func (ft *FunctionType) print(ps *printState)

print method #

func (da *DefaultArg) print(ps *printState)

print method #

Print an AST.

func (ps *printState) print(a AST)

print method #

func (tr *TypeRequirement) print(ps *printState)

print method #

func (b *Binary) print(ps *printState)

print method #

func (tpn *TemplateParamName) print(ps *printState)

print method #

func (cl *Closure) print(ps *printState)

print method #

func (er *ExprRequirement) print(ps *printState)

print method #

func (vt *VectorType) print(ps *printState)

print method #

func (pt *PointerType) print(ps *printState)

print method #

func (mwq *MethodWithQualifiers) print(ps *printState)

print method #

func (re *RequiresExpr) print(ps *printState)

print method #

func (rt *RvalueReferenceType) print(ps *printState)

print method #

func (t *TaggedName) print(ps *printState)

print method #

func (ct *ComplexType) print(ps *printState)

print method #

func (sa *SizeofArgs) print(ps *printState)

print method #

func (fp *FunctionParam) print(ps *printState)

print method #

func (ut *UnnamedType) print(ps *printState)

print method #

func (q *Qualifier) print(ps *printState)

print method #

func (c *Constraint) print(ps *printState)

print method #

func (bt *BitIntType) print(ps *printState)

print method #

func (f *Fold) print(ps *printState)

print method #

func (c *Clone) print(ps *printState)

print method #

func (c *Cast) print(ps *printState)

print method #

func (f *Friend) print(ps *printState)

print method #

func (pe *PackExpansion) print(ps *printState)

print method #

func (sp *SizeofPack) print(ps *printState)

print method #

func (s *Special) print(ps *printState)

print method #

func (bt *BuiltinType) print(ps *printState)

print method #

func (it *ImaginaryType) print(ps *printState)

print method #

func (me *ModuleEntity) print(ps *printState)

print method #

func (pm *PtrMem) print(ps *printState)

print method #

func (s *Special2) print(ps *printState)

print method #

func (bfp *BinaryFP) print(ps *printState)

print method #

func (mn *ModuleName) print(ps *printState)

print method #

func (ft *FixedType) print(ps *printState)

print method #

func (ap *ArgumentPack) print(ps *printState)

print method #

func (ei *EnableIf) print(ps *printState)

printArgs method #

printArgs prints the arguments of a function type. It looks at the inner types for spacing.

func (ft *FunctionType) printArgs(ps *printState)

printBase function #

printBase is common print code for types that are printed with a simple suffix.

func printBase(ps *printState, qual AST, base AST)

printDimension method #

Print the array dimension.

func (at *ArrayType) printDimension(ps *printState)

printInner method #

func (t *Typed) printInner(ps *printState)

printInner method #

func (pt *PointerType) printInner(ps *printState)

printInner method #

func (cttp *ConstrainedTypeTemplateParam) printInner(ps *printState)

printInner method #

func (rt *ReferenceType) printInner(ps *printState)

printInner method #

func (st *SuffixType) printInner(ps *printState)

printInner method #

func (pm *PtrMem) printInner(ps *printState)

printInner method #

func (ct *ComplexType) printInner(ps *printState)

printInner method #

func (vq *VendorQualifier) printInner(ps *printState)

printInner method #

func (nttp *NonTypeTemplateParam) printInner(ps *printState)

printInner method #

func (tpp *TemplateParamPack) printInner(ps *printState)

printInner method #

func (at *ArrayType) printInner(ps *printState)

printInner method #

func (ft *FunctionType) printInner(ps *printState)

printInner method #

func (rt *RvalueReferenceType) printInner(ps *printState)

printInner method #

Print qualifiers as an inner type by just printing the qualifiers.

func (twq *TypeWithQualifiers) printInner(ps *printState)

printInner method #

func (it *ImaginaryType) printInner(ps *printState)

printInner method #

func (vt *VectorType) printInner(ps *printState)

printInner method #

Print the inner types.

func (ps *printState) printInner(prefixOnly bool) []AST

printInner method #

func (mwq *MethodWithQualifiers) printInner(ps *printState)

printList method #

printList prints a list of AST values separated by commas, optionally skipping some.

func (ps *printState) printList(args []AST, skip func(AST) bool)

printOneInner method #

Print the most recent inner type. If save is not nil, only print prefixes.

func (ps *printState) printOneInner(save *[]AST)

printTypes method #

func (cl *Closure) printTypes(ps *printState)

refQualifier method #

refQualifier parses: ::= R ::= O

func (st *state) refQualifier() string

requiresExpr method #

requiresExpr parses: ::= rQ _ + E ::= rq + E ::= X [N] [R ] ::= T ::= Q

func (st *state) requiresExpr() AST

rustToString function #

rustToString demangles a Rust symbol.

func rustToString(name string, options []Option) (ret string, err error)

seqID method #

seqID parses: ::= <0-9A-Z>+ We expect this to be followed by an underscore.

func (st *state) seqID(eofOK bool) int

setTemplate method #

setTemplate sets the Template field of any TemplateParam's in a. This handles the forward referencing template parameters found in cast operators.

func (st *state) setTemplate(a AST, tmpl *Template)

simplify function #

simplify replaces template parameters with their expansions, and merges qualifiers.

func simplify(a AST) AST

simplifyOne function #

simplifyOne simplifies a single AST. It returns nil if there is nothing to do.

func simplifyOne(a AST) AST

sourceName method #

sourceName parses: ::= <(positive length) number> identifier ::= <(unqualified source code identifier)>

func (st *state) sourceName() AST

specialName method #

specialName parses: ::= TV ::= TT ::= TI ::= TS ::= TA ::= GV <(object) name> ::= T <(base) encoding> ::= Tc <(base) encoding> g++ extensions: ::= TC <(offset) number> _ <(base) type> ::= TF ::= TJ ::= GR ::= GA ::= Gr ::= GTt ::= GTn ::= GI

func (st *state) specialName() AST

startScope method #

startScope starts a scope. This is used to decide whether we need to parenthesize an expression using > or >>.

func (ps *printState) startScope(b byte)

subobject method #

subobject parses: ::= so [] * [p] E ::= _ []

func (st *state) subobject() AST

substitution method #

substitution parses: ::= S _ ::= S_ ::= St ::= Sa ::= Sb ::= Ss ::= Si ::= So ::= Sd

func (st *state) substitution(forPrefix bool) AST

symbolName method #

symbolName parses: = "_R" [] [] = We've already skipped the "_R".

func (rst *rustState) symbolName()

taggedName method #

taggedName parses: ::= B

func (st *state) taggedName(a AST) AST

templateArg method #

templateArg parses: ::= ::= X E ::= ::= J * E ::= LZ E ::=

func (st *state) templateArg(prev []AST) AST

templateArgs method #

templateArgs parses: ::= I + E

func (st *state) templateArgs() []AST

templateParam method #

templateParam parses: ::= T_ ::= T <(parameter-2 non-negative) number> _ ::= TL __ ::= TL _ _ When a template parameter is a substitution candidate, any reference to that substitution refers to the template parameter with the same index in the currently active template, not to whatever the template parameter would be expanded to here. We sort this out in substitution and simplify.

func (st *state) templateParam() AST

templateParamDecl method #

templateParamDecl parses: ::= Ty # type parameter ::= Tk [] # constrained type parameter ::= Tn # non-type parameter ::= Tt * E # template parameter ::= Tp # parameter pack Returns the new AST to include in the AST we are building and the new AST to add to the list of template parameters. Returns nil, nil if not looking at a template-param-decl.

func (st *state) templateParamDecl() (AST, AST)

undisambiguatedIdentifier method #

undisambiguatedIdentifier parses: = ["u"] ["_"]

func (rst *rustState) undisambiguatedIdentifier() (id string, isPunycode bool)

unnamedTypeName method #

unnamedTypeName parses: ::= Ut [ ] _

func (st *state) unnamedTypeName() AST

unqualifiedName method #

unqualifiedName parses: ::= ::= ::= ::= ::= L

func (st *state) unqualifiedName(module AST) (r AST, isCast bool)

unresolvedName method #

unresolvedName parses: ::= [gs] ::= sr ::= srN + E ::= [gs] sr + E

func (st *state) unresolvedName() AST

vectorType method #

vectorType parses: ::= Dv _ ::= Dv _ _

func (st *state) vectorType(isCast bool) AST

writeByte method #

writeByte writes a byte to the buffer.

func (rst *rustState) writeByte(c byte)

writeByte method #

writeByte adds a byte to the string being printed.

func (ps *printState) writeByte(b byte)

writeLifetime method #

writeLifetime writes out a lifetime binding.

func (rst *rustState) writeLifetime(lifetime int64)

writeString method #

writeString writes a string to the buffer.

func (rst *rustState) writeString(s string)

writeString method #

writeString adds a string to the string being printed.

func (ps *printState) writeString(s string)

Generated with Arrow