func (p *cgoPackage) addElaboratedTypes() {
	if len(p.elaboratedTypes) == 0 {
		return
	}
	gen := &ast.GenDecl{
		TokPos: token.NoPos,
		Tok:    token.TYPE,
	}
	names := make([]string, 0, len(p.elaboratedTypes))
	for name := range p.elaboratedTypes {
		names = append(names, name)
	}
	sort.Strings(names)
	for _, name := range names {
		typ := p.elaboratedTypes[name]
		typeName := "C." + name
		obj := &ast.Object{
			Kind: ast.Typ,
			Name: typeName,
		}
		typeSpec := &ast.TypeSpec{
			Name: &ast.Ident{
				NamePos: typ.pos,
				Name:    typeName,
				Obj:     obj,
			},
			Type: typ.typeExpr,
		}
		obj.Decl = typeSpec
		gen.Specs = append(gen.Specs, typeSpec)
	}
	p.generated.Decls = append(p.generated.Decls, gen)
}
// addElaboratedTypes adds C elaborated types as aliases. These are the "struct
// foo" or "union foo" types, often used in a typedef.
//
// See also:
// https://en.cppreference.com/w/cpp/language/elaborated_type_specifier
addElaboratedTypes adds C elaborated types as aliases. These are the "struct
foo" or "union foo" types, often used in a typedef.


// addElaboratedTypes adds C elaborated types as aliases . These are the " struct // foo " or " union foo " types often used in a typedef . // // See also : // https : // en . cppreference . com / w / cpp / language / elaborated_type_specifier
func (p *cgoPackage) addElaboratedTypes() {
	if len(p.elaboratedTypes) == 0 {
		return
	}
	gen := &ast.GenDecl{
		TokPos: token.NoPos,
		Tok:    token.TYPE,
	}
	names := make([]string, 0, len(p.elaboratedTypes))
	for name := range p.elaboratedTypes {
		names = append(names, name)
	}
	sort.Strings(names)
	for _, name := range names {
		typ := p.elaboratedTypes[name]
		typeName := "C." + name
		obj := &ast.Object{
			Kind: ast.Typ,
			Name: typeName,
		}
		typeSpec := &ast.TypeSpec{
			Name: &ast.Ident{
				NamePos: typ.pos,
				Name:    typeName,
				Obj:     obj,
			},
			Type: typ.typeExpr,
		}
		obj.Decl = typeSpec
		gen.Specs = append(gen.Specs, typeSpec)
	}
	p.generated.Decls = append(p.generated.Decls, gen)
}
func ( p * cgoPackage ) addElaboratedTypes ( ) { if len ( p . elaboratedTypes ) == 0 { return } gen := & ast . GenDecl { TokPos : token . NoPos , Tok : token . TYPE , } names := make ( [ ] string , 0 , len ( p . elaboratedTypes ) ) for name := range p . elaboratedTypes { names = append ( names , name ) } sort . Strings ( names ) for _ , name := range names { typ := p . elaboratedTypes [ name ] typeName := " " + name obj := & ast . Object { Kind : ast . Typ , Name : typeName , } typeSpec := & ast . TypeSpec { Name : & ast . Ident { NamePos : typ . pos , Name : typeName , Obj : obj , } , Type : typ . typeExpr , } obj . Decl = typeSpec gen . Specs = append ( gen . Specs , typeSpec ) } p . generated . Decls = append ( p . generated . Decls , gen ) }
addElaboratedTypes adds C elaborated types as aliases.
addElaboratedTypes adds C elaborated types as aliases .