summaryrefslogtreecommitdiff
path: root/src/cmd/cgo/gcc.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2010-01-15 13:27:45 -0800
committerRobert Griesemer <gri@golang.org>2010-01-15 13:27:45 -0800
commit1dd0f7c2e78657111e265fbc76f281f7850c38c5 (patch)
treef7a2ae997c05b400635bc380102dd73102b05b0f /src/cmd/cgo/gcc.go
parent2442a6ddd956d1a902282d9bef429c16348fcf37 (diff)
downloadgolang-1dd0f7c2e78657111e265fbc76f281f7850c38c5.tar.gz
Steps towards tracking scopes for identifiers.
- Identifiers refer now to the language entity (Object) that they denote. At the moment this is at best an approximation. - Initial data structures for language entities (Objects) and expression types (Type) independent of the actual type notations. - Initial support for declaring and looking up identifiers. - Updated various dependent files and added support functions. - Extensively tested to avoid breakage. This is an AST change. R=rsc CC=golang-dev, rog http://codereview.appspot.com/189080
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r--src/cmd/cgo/gcc.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index c525b492a..07002a4c7 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -559,7 +559,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
t.Go = name // publish before recursive calls
switch dt.Kind {
case "union", "class":
- c.typedef[name.Value] = c.Opaque(t.Size)
+ c.typedef[name.Name()] = c.Opaque(t.Size)
if t.C == "" {
t.C = fmt.Sprintf("typeof(unsigned char[%d])", t.Size)
}
@@ -569,7 +569,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
t.C = csyntax
}
t.Align = align
- c.typedef[name.Value] = g
+ c.typedef[name.Name()] = g
}
case *dwarf.TypedefType:
@@ -588,8 +588,8 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
sub := c.Type(dt.Type)
t.Size = sub.Size
t.Align = sub.Align
- if _, ok := c.typedef[name.Value]; !ok {
- c.typedef[name.Value] = sub.Go
+ if _, ok := c.typedef[name.Name()]; !ok {
+ c.typedef[name.Name()] = sub.Go
}
case *dwarf.UcharType:
@@ -633,7 +633,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
}
s = strings.Join(strings.Split(s, " ", 0), "") // strip spaces
name := c.Ident("_C_" + s)
- c.typedef[name.Value] = t.Go
+ c.typedef[name.Name()] = t.Go
t.Go = name
}
}
@@ -710,7 +710,7 @@ func (c *typeConv) FuncType(dtype *dwarf.FuncType) *FuncType {
}
// Identifier
-func (c *typeConv) Ident(s string) *ast.Ident { return &ast.Ident{Value: s} }
+func (c *typeConv) Ident(s string) *ast.Ident { return ast.NewIdent(s) }
// Opaque type of n bytes.
func (c *typeConv) Opaque(n int64) ast.Expr {