demangle.go
func globalCDtorName(name string, options ...Option) (AST, error) {
	if len(name) < 4 {
		return nil, ErrNotMangledName
	}
	switch name[0] {
	case '.', '_', '$':
	default:
		return nil, ErrNotMangledName
	}

	var ctor bool
	switch name[1] {
	case 'I':
		ctor = true
	case 'D':
		ctor = false
	default:
		return nil, ErrNotMangledName
	}

	if name[2] != '_' {
		return nil, ErrNotMangledName
	}

	if !strings.HasPrefix(name[3:], "_Z") {
		return &GlobalCDtor{Ctor: ctor, Key: &Name{Name: name}}, nil
	} else {
		a, err := doDemangle(name[5:], options...)
		if err != nil {
			return nil, adjustErr(err, 5)
		}
		return &GlobalCDtor{Ctor: ctor, Key: a}, nil
	}
}
func globalCDtorName(name string, options ...Option) (AST, error) {
	if len(name) < 4 {
		return nil, ErrNotMangledName
	}
	switch name[0] {
	case '.', '_', '$':
	default:
		return nil, ErrNotMangledName
	}

	var ctor bool
	switch name[1] {
	case 'I':
		ctor = true
	case 'D':
		ctor = false
	default:
		return nil, ErrNotMangledName
	}

	if name[2] != '_' {
		return nil, ErrNotMangledName
	}

	if !strings.HasPrefix(name[3:], "_Z") {
		return &GlobalCDtor{Ctor: ctor, Key: &Name{Name: name}}, nil
	} else {
		a, err := doDemangle(name[5:], options...)
		if err != nil {
			return nil, adjustErr(err, 5)
		}
		return &GlobalCDtor{Ctor: ctor, Key: a}, nil
	}
}
func globalCDtorName ( name string , options ... Option ) ( AST , error ) { if len ( name ) < 4 { return nil , ErrNotMangledName } switch name [ 0 ] { case '.' , '_' , '$' : default : return nil , ErrNotMangledName } var ctor bool switch name [ 1 ] { case 'I' : ctor = true case 'D' : ctor = false default : return nil , ErrNotMangledName } if name [ 2 ] != '_' { return nil , ErrNotMangledName } if ! strings . HasPrefix ( name [ 3 : ] , " " ) { return & GlobalCDtor { Ctor : ctor , Key : & Name { Name : name } } , nil } else { a , err := doDemangle ( name [ 5 : ] , options ... ) if err != nil { return nil , adjustErr ( err , 5 ) } return & GlobalCDtor { Ctor : ctor , Key : a } , nil } }
// globalCDtorName demangles a global constructor/destructor symbol name.
// The parameter is the string following the "_GLOBAL_" prefix.
globalCDtorName demangles a global constructor / destructor symbol name . The parameter is the string following the _GLOBAL_ prefix .